windows
Class PixelOperater

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byjavax.swing.JApplet
                      extended bywindows.WindowWithListeners
                          extended bywindows.WindowWithVideo
                              extended bywindows.PixelOperater
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, javax.swing.RootPaneContainer, java.io.Serializable, VideoListener, java.awt.event.WindowListener

public class PixelOperater
extends WindowWithVideo

Provides some simple methods for getting playing with the pixels within the video.

See Also:
Serialized Form

Field Summary
 java.awt.image.ConvolveOp blur
          A ConvolveOp object for blurring.
 java.awt.image.ConvolveOp edge
          A ConvolveOp object for finding edges.
 java.awt.image.BufferedImage myBuffer
           
 java.awt.Graphics2D myGraphics
           
 java.awt.image.WritableRaster myRaster
           
 int[] rgb
           
 int threshold
           
 
Fields inherited from class windows.WindowWithVideo
elapsedTime, prefsFileName, ps, startTime
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PixelOperater(java.lang.String[] args, int _w, int _h)
           
 
Method Summary
 void blurRaster(java.awt.image.WritableRaster _raster)
           
 void edgeRaster(java.awt.image.WritableRaster _raster)
           
 void grabReference()
          This stores the current frame for future reference.
 void keyPressed(java.awt.event.KeyEvent e)
           
static void main(java.lang.String[] args)
          Notice I start video now in main
 void newFrame()
          This is the classice nested video loops for scanning through each row and then each column with the row of vdeo.
 void paint(java.awt.Graphics g)
          This gets called everytime you repaint the screen.
 void performPixelOp(int _x, int _y)
          I farmed this out to another method because this is the most likely thing you would want to overide
 void setBlur(int size)
          Sets the degree of blur.
 void setEdge(float[] matrix, int size)
          Set up the edge detection.
 
Methods inherited from class windows.WindowWithVideo
destroy, init, initVideo, start, update, useParameters
 
Methods inherited from class windows.WindowWithListeners
addParameterNames, applicationStuff, getParameters, getParameters, isApplication, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, put, setFullScreen, setTitle, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class javax.swing.JApplet
getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

blur

public java.awt.image.ConvolveOp blur
A ConvolveOp object for blurring.


edge

public java.awt.image.ConvolveOp edge
A ConvolveOp object for finding edges.


threshold

public int threshold

myBuffer

public java.awt.image.BufferedImage myBuffer

myGraphics

public java.awt.Graphics2D myGraphics

myRaster

public java.awt.image.WritableRaster myRaster

rgb

public int[] rgb
Constructor Detail

PixelOperater

public PixelOperater(java.lang.String[] args,
                     int _w,
                     int _h)
Method Detail

main

public static void main(java.lang.String[] args)
Notice I start video now in main


grabReference

public void grabReference()
This stores the current frame for future reference.


newFrame

public void newFrame()
This is the classice nested video loops for scanning through each row and then each column with the row of vdeo.

Specified by:
newFrame in interface VideoListener
Overrides:
newFrame in class WindowWithVideo

performPixelOp

public void performPixelOp(int _x,
                           int _y)
I farmed this out to another method because this is the most likely thing you would want to overide


paint

public void paint(java.awt.Graphics g)
Description copied from class: WindowWithVideo
This gets called everytime you repaint the screen. You would want to override this if you want anything but side by side pictures

Overrides:
paint in class WindowWithVideo

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class WindowWithVideo

setEdge

public void setEdge(float[] matrix,
                    int size)
Set up the edge detection. This sets the kernel in case you know what that is. You never really have to set this. The default matrix is,
{ 0.0f, -1.0f, 0.0f,
-1.0f, 4.0f, -1.0f,
0.0f, -1.0f, 0.0f };
always a classic. The size is 3 as in 3x3.


setBlur

public void setBlur(int size)
Sets the degree of blur. This takes an integer that describes how many pixels around each pixel to take into account when averaging. The default is 5 and bigger numbers will really slow things down.


blurRaster

public void blurRaster(java.awt.image.WritableRaster _raster)

edgeRaster

public void edgeRaster(java.awt.image.WritableRaster _raster)