|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--mit.ai.techniques.BinaryDrawingCanvas
This canvas allows the user to draw big, blocky, binary images with the mouse. It can export its data in the form of a binary array.
| Inner classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
| Field Summary | |
private boolean |
currentDrawSetting
True -> drawing black pixels, false -> drawing white pixels. |
private static int |
PIX_MULT
Pixel size. |
private boolean[][] |
pixels
Pixel state storage. |
| Fields inherited from class java.awt.Canvas |
base, nameCounter, serialVersionUID |
| Fields inherited from class java.awt.Component |
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
BinaryDrawingCanvas()
Construct a canvas, default size is 15 x 15 big, blocky pixels. |
|
BinaryDrawingCanvas(boolean[][] initPixels)
Constrct a canvas that displays the values in initPixels (true -> black, false -> white). |
|
| Method Summary | |
void |
clearCanvas()
Clear the canvas (and associated data structures). |
void |
drawPixel(int x,
int y,
boolean start)
Accepts real-screen pixels, and adds their big, blocky superset pixels to the screen and internal data structure. |
int |
getBigPixelHeight()
Return canvas height in big pixels. |
int |
getBigPixelWidth()
Return canvas width in big pixels. |
boolean[][] |
getBinaryData()
Get the binary data. |
int |
getHeight()
Return canvas height. |
int |
getWidth()
Return canvas width. |
void |
paint(java.awt.Graphics g)
Paint the screen with the big, blocky pixels demanded by the current set of pixels we have drawn over. |
void |
randomize(double blackPercentage)
Randomize the canvas value to produce a given percentage of black pixels. |
void |
setSize(int xPixels,
int yPixels)
Set the size in big, blocky pixels. |
void |
update(java.awt.Graphics g)
Usual lazy update routine. |
| Methods inherited from class java.awt.Canvas |
|
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setVisible, show, show, size, toString, transferFocus, validate, writeObject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
| Field Detail |
private static final int PIX_MULT
private boolean[][] pixels
private boolean currentDrawSetting
| Constructor Detail |
public BinaryDrawingCanvas()
public BinaryDrawingCanvas(boolean[][] initPixels)
| Method Detail |
public int getBigPixelWidth()
public int getBigPixelHeight()
public int getWidth()
getWidth in class java.awt.Componentpublic int getHeight()
getHeight in class java.awt.Componentpublic void clearCanvas()
public void randomize(double blackPercentage)
public boolean[][] getBinaryData()
public void setSize(int xPixels,
int yPixels)
setSize in class java.awt.Componentpublic void update(java.awt.Graphics g)
update in class java.awt.Componentpublic void paint(java.awt.Graphics g)
paint in class java.awt.Canvas
public void drawPixel(int x,
int y,
boolean start)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||