|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel org.alchemy.core.AlcCanvas
public class AlcCanvas
The Alchemy canvas
Stores all shapes created and handles all graphics related stuff
Think saving pdfs, printing, and of course displaying!
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
java.util.ArrayList<AlcShape> |
affectShapes
Array list containing shapes currently in use by affect modules |
java.util.ArrayList<AlcShape> |
createShapes
Array list containing shapes currently in use by create modules |
java.util.ArrayList<AlcShape> |
guideShapes
Array list containing shapes used as visual guides - not actual geometry |
java.util.ArrayList<AlcShape> |
shapes
Array list containing shapes that have been commited. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
---|---|
void |
clear()
Clear all shapes and then redraws the canvas |
void |
commitAffectShapes()
Commit all affect shapes to the main shapes array |
void |
commitCreateShapes()
Commit all create shapes to the main shapes array |
void |
commitShapes()
Commit all shapes to the main shapes array and render the image buffer |
void |
forceRedraw()
Force the canvas to redraw regardless of the current redraw setting |
int |
getAlpha()
Get the current alpha value |
java.awt.Color |
getBackgroundColor()
Get the background color |
java.awt.Color |
getColor()
Get the current color |
AlcShape |
getCurrentAffectShape()
Returns the most recently added affect shape |
AlcShape |
getCurrentCreateShape()
Returns the most recently added create shape |
AlcShape |
getCurrentGuideShape()
Returns the most recently added guide shape |
AlcShape |
getCurrentShape()
Returns the most recently added shape |
java.awt.Color |
getForegroundColor()
Get the current forground color This method returns the foreground color even if it is not currently active. |
java.awt.Image |
getImage()
Get the current image |
java.awt.Point |
getImageLocation()
Get the location where the image is displayed on the canvas |
float |
getLineWidth()
Get the current line width |
java.awt.geom.Point2D.Float |
getPenLocation()
Pen Location as a new Point2D.Float object. |
float |
getPenPressure()
Get the pen pressure (if available) |
java.awt.geom.Point2D.Float |
getPenTilt()
Pen Tilt if available |
int |
getPenType()
The type of pen being used |
int |
getStyle()
Get the current style |
boolean |
hasAffectShapes()
Check if there are affectShapes available |
boolean |
hasCreateShapes()
Check if there are createShapes available |
boolean |
hasShapes()
Check if there are shapes available |
boolean |
isBackgroundColorActive()
Whether the background is active or not |
boolean |
isImageDisplayEnabled()
Check if image display is enabled |
boolean |
isImageSet()
Check if an Image is defined or not |
boolean |
isMouseDown()
Pen (or mouse) down or up |
boolean |
isPenDown()
Pen (or mouse) down or up |
boolean |
isPenLocationChanged()
Has the pen location changed - useful for filtering out repeats |
boolean |
isRecordIndicatorEnabled()
Returns if the record indicator (used with session auto-saving) is enabled |
boolean |
isRedraw()
Get the canvas redraw state |
void |
mouseClicked(java.awt.event.MouseEvent event)
|
void |
mouseDragged(java.awt.event.MouseEvent event)
|
void |
mouseEntered(java.awt.event.MouseEvent event)
|
void |
mouseExited(java.awt.event.MouseEvent event)
|
void |
mouseMoved(java.awt.event.MouseEvent event)
|
void |
mousePressed(java.awt.event.MouseEvent event)
|
void |
mouseReleased(java.awt.event.MouseEvent event)
|
void |
paintComponent(java.awt.Graphics g)
Bitmap Canvas Draws all current shapes on top of the buffered image |
void |
penButtonEvent(jpen.PButtonEvent arg0)
|
void |
penKindEvent(jpen.PKindEvent ev)
|
void |
penLevelEvent(jpen.PLevelEvent ev)
|
void |
penScrollEvent(jpen.PScrollEvent arg0)
|
void |
penTock(long arg0)
|
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat format,
int pageIndex)
This is the method defined by the Printable interface. |
void |
redraw()
Redraw the canvas |
void |
redraw(boolean fullRedraw)
Redraw the canvas |
void |
removeCurrentAffectShape()
Removes the most recently added affect shape |
void |
removeCurrentCreateShape()
Removes the most recently added create shape |
void |
removeCurrentGuideShape()
Removes the most recently added guide shape |
void |
removeCurrentShape()
Removes the most recently added shape |
void |
resetImageLocation()
Reset the image location back to zero |
void |
resizeCanvas(java.awt.Dimension windowSize)
Resize the canvas - called when the window is resized |
void |
restoreCursor()
Restore the cursor |
void |
setAffectEvents(boolean affectEvents)
Turn on/off mouse/pen events being sent to affect modules |
void |
setAlpha(int alpha)
Set the current alpha value |
void |
setBackgroundColor(java.awt.Color color)
Set the background Color |
void |
setBackgroundColorActive(boolean backgroundActive)
Set the background color to be active |
void |
setColor(java.awt.Color color)
Set the current color |
void |
setCreateEvents(boolean createEvents)
Turn on/off mouse/pen events being sent to create modules |
void |
setCurrentAffectShape(AlcShape shape)
Sets the most recently added affect shape |
void |
setCurrentCreateShape(AlcShape shape)
Sets the most recently added create shape |
void |
setCurrentGuideShape(AlcShape shape)
Sets the most recently added guide shape |
void |
setCurrentShape(AlcShape shape)
Sets the most recently added shape |
void |
setEvents(boolean events)
Turn on/off mouse/pen events being sent to modules |
void |
setForegroundColor(java.awt.Color color)
Set the foreground color |
void |
setImage(java.awt.image.BufferedImage image)
Set the Image to be drawn on the canvas |
void |
setImageDisplay(boolean imageDisplay)
Set image display to on or off |
void |
setImageLocation(int x,
int y)
Set the location for the image to be displayed on the canvas |
void |
setImageLocation(java.awt.Point p)
Set the location for the image to be displayed on the canvas |
void |
setLineWidth(float lineWidth)
Set the current line width |
void |
setRecordIndicator(boolean recordIndicator)
Set the display of the record indicator (used with session auto-saving) |
void |
setRedraw(boolean redraw)
Set the canvas redraw state |
void |
setStyle(int style)
Set the current style |
void |
setTempCursor(java.awt.Cursor cursor)
Set the cursor temporarily - can be restored with restoreCursor() |
void |
toggleStyle()
Toggle the style between line and solid |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.util.ArrayList<AlcShape> shapes
public java.util.ArrayList<AlcShape> createShapes
public java.util.ArrayList<AlcShape> affectShapes
public java.util.ArrayList<AlcShape> guideShapes
Method Detail |
---|
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- Graphics Object to draw onpublic void redraw()
public void redraw(boolean fullRedraw)
fullRedraw
- Specify if the full set of vector shapes should be redrawn
or just add the new shape to the existing buffer imagepublic void forceRedraw()
public void setRedraw(boolean redraw)
redraw
- Redraw statepublic boolean isRedraw()
public void setEvents(boolean events)
events
- public void setCreateEvents(boolean createEvents)
createEvents
- public void setAffectEvents(boolean affectEvents)
affectEvents
- public boolean isPenDown()
public boolean isMouseDown()
public float getPenPressure()
public java.awt.geom.Point2D.Float getPenTilt()
public java.awt.geom.Point2D.Float getPenLocation()
MouseEvent
public boolean isPenLocationChanged()
public int getPenType()
AlcConstants.PEN_STYLUS
, AlcConstants.PEN_ERASER
, AlcConstants.PEN_CURSOR
or ZERO for unknownpublic void resizeCanvas(java.awt.Dimension windowSize)
windowSize
- The new window sizepublic void clear()
public void setTempCursor(java.awt.Cursor cursor)
restoreCursor()
cursor
- New temp cursorpublic void restoreCursor()
public void commitShapes()
shapes
array and render the image buffer
public boolean hasShapes()
shapes
available
public AlcShape getCurrentShape()
public void setCurrentShape(AlcShape shape)
shape
- (@link AlcShape} to become the current shapepublic void removeCurrentShape()
public boolean hasCreateShapes()
createShapes
available
public AlcShape getCurrentCreateShape()
public void setCurrentCreateShape(AlcShape shape)
shape
- (@link AlcShape} to become the current create shapepublic void removeCurrentCreateShape()
public void commitCreateShapes()
public boolean hasAffectShapes()
affectShapes
available
public AlcShape getCurrentAffectShape()
public void setCurrentAffectShape(AlcShape shape)
shape
- (@link AlcShape} to become the current affect shapepublic void removeCurrentAffectShape()
public void commitAffectShapes()
public AlcShape getCurrentGuideShape()
public void setCurrentGuideShape(AlcShape shape)
shape
- Shape to become the current guide shapepublic void removeCurrentGuideShape()
public java.awt.Color getColor()
public void setColor(java.awt.Color color)
color
- public boolean isBackgroundColorActive()
public void setBackgroundColorActive(boolean backgroundActive)
backgroundActive
- public java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color color)
color
- public java.awt.Color getForegroundColor()
public void setForegroundColor(java.awt.Color color)
color
- public int getAlpha()
public void setAlpha(int alpha)
alpha
- public int getStyle()
public void setStyle(int style)
style
- public void toggleStyle()
public float getLineWidth()
public void setLineWidth(float lineWidth)
lineWidth
- public boolean isRecordIndicatorEnabled()
public void setRecordIndicator(boolean recordIndicator)
recordIndicator
- On or offpublic void setImage(java.awt.image.BufferedImage image)
image
- Image to be drawnpublic java.awt.Image getImage()
public boolean isImageSet()
public void setImageDisplay(boolean imageDisplay)
imageDisplay
- Image display on or offpublic boolean isImageDisplayEnabled()
public void setImageLocation(java.awt.Point p)
p
- public void setImageLocation(int x, int y)
x
- y
- public java.awt.Point getImageLocation()
public void resetImageLocation()
public int print(java.awt.Graphics g, java.awt.print.PageFormat format, int pageIndex) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
g
- format
- pageIndex
-
java.awt.print.PrinterException
public void mouseMoved(java.awt.event.MouseEvent event)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void penKindEvent(jpen.PKindEvent ev)
penKindEvent
in interface jpen.event.PenListener
public void penLevelEvent(jpen.PLevelEvent ev)
penLevelEvent
in interface jpen.event.PenListener
public void penButtonEvent(jpen.PButtonEvent arg0)
penButtonEvent
in interface jpen.event.PenListener
public void penScrollEvent(jpen.PScrollEvent arg0)
penScrollEvent
in interface jpen.event.PenListener
public void penTock(long arg0)
penTock
in interface jpen.event.PenListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |