public class EditableImageRenderer extends JComponent
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected double |
angle
The current rotation.
|
protected EditingTool |
editingTool
The current EditingTool.
|
protected org.imajine.image.EditableImage |
image
The original image to be displayed.
|
static double |
MAX_SCALE
The maximum allowed value for scale.
|
static double |
MIN_SCALE
The maximum allowed value for scale.
|
protected double |
scale
The current scale.
|
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
EditableImageRenderer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addImageRendererListener(EditableImageRendererListener listener) |
void |
addOverlay(Overlay overlay)
Adds an overlay to be shown over the image.
|
void |
centerImage()
Centers the image on the renderer, keeping the current scale.
|
protected Point |
computeOrigin(Point imagePoint,
Point componentPoint,
double scale)
Computes a new origin so that the given image point is shown at the given
relative coordinates.
|
Point |
convertImagePointToComponentPoint(Point imagePoint)
Given a point in image coordinates, returns the coordinates of the
component point which renders that image point.
|
protected void |
fireEditingToolActivated(EditingTool editingTool) |
protected void |
fireEditingToolDeactivated(EditingTool editingTool) |
void |
fitToDisplaySize() |
void |
flushAllCaches()
Flush all image caches.
|
void |
flushScaledImageCache()
Flush the cached scaled image.
|
double |
getAngle() |
EditingTool |
getEditingTool() |
double |
getFitScale() |
org.imajine.image.EditableImage |
getImage()
Returns the displayed image.
|
Border |
getImageBorder() |
Insets |
getMargin()
Returns the maximum margin that can be shown around the image.
|
double |
getMaxScale() |
double |
getMinScale() |
org.imajine.image.EditableImage |
getOptimizedImage()
Returns a possibly optimized version of the image.
|
Point |
getOrigin() |
Point |
getPositionOverImage(Point componentPoint)
Given a point in component coordinates, returns the coordinates of the
image pixel rendered at that point.
|
org.imajine.image.render.PreviewSettings |
getPreviewSettings()
Gets the preview settings.
|
org.imajine.image.Quality |
getRotateQuality()
Returns the quality used for scale operations.
|
double |
getScale() |
org.imajine.image.Quality |
getScaleQuality()
Returns the quality used for scale operations.
|
boolean |
isOptimizedImageEnabled()
Returns the status of the rgb image caching feature.
|
boolean |
isRepaintEnabled()
Returns the state of repaint.
|
boolean |
isScaledImageCachingEnabled()
Returns the status of the caching of a scaled image for faster speed.
|
boolean |
isScrollBarsVisible()
Return true if the scrollbars are visible.
|
void |
moveOrigin(int deltaX,
int deltaY) |
void |
paint(Graphics g)
Renders this component.
|
void |
removeImageRendererListener(EditableImageRendererListener listener) |
void |
removeOverlay(Overlay overlay) |
void |
setAngle(double angle) |
void |
setClippingShape(Shape clippingShape)
Sets a shape to clip rendering against.
|
void |
setFitToDisplaySize(boolean fitToDisplaySize)
Enables or disables the fit-to-display-size feature.
|
void |
setImage(org.imajine.image.EditableImage image)
Sets the image to display.
|
void |
setImageBorder(Border imageBorder) |
void |
setMargin(Insets margin)
Sets the maximum margin that can be shown around the image.
|
void |
setMaxScale(double maxScale) |
void |
setMinScale(double minScale) |
void |
setOptimizedImageEnabled(boolean optimizedImageEnabled)
Enables or disables the use of an optimized copy of the image.
|
void |
setOrigin(Point origin)
Sets the image point which is displayed in the top left corner (coordinates
are in actual image pixels).
|
void |
setPositionOverImage(Point imagePoint,
Point componentPoint)
Ensures that the given image pixel is shown at the given component
coordinates.
|
void |
setPreviewSettings(org.imajine.image.render.PreviewSettings previewSettings)
Sets the preview settings.
|
void |
setRepaintEnabled(boolean repaintEnabled)
Turns on/off repaint.
|
void |
setRotateQuality(org.imajine.image.Quality rotateQuality)
Sets the quality used for rotate operations.
|
void |
setScale(double scale)
Sets the explicit scale for displaying the current image.
|
void |
setScale(double scale,
Point pivotPoint)
Sets the explicit scale for displaying the current image.
|
void |
setScaledImageCachingEnabled(boolean scaledImageCachingEnabled)
Enables or disables the caching of a scaled image for faster speed.
|
void |
setScaleQuality(org.imajine.image.Quality scaleQuality)
Sets the quality used for scale operations.
|
void |
setScrollBarsVisible(boolean scrollBarsVisible)
Sets the scrollbars visible or not.
|
void |
update(Graphics g) |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUIadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, 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, transferFocusBackward, transferFocusUpCyclepublic static final double MAX_SCALE
public static final double MIN_SCALE
protected org.imajine.image.EditableImage image
protected double scale
protected double angle
protected EditingTool editingTool
public void setImage(org.imajine.image.EditableImage image)
image - the imagepublic org.imajine.image.EditableImage getImage()
public org.imajine.image.EditableImage getOptimizedImage()
public void setRepaintEnabled(boolean repaintEnabled)
repaintEnabled - the new settingpublic boolean isRepaintEnabled()
public void setOrigin(Point origin)
origin - the originpublic Point getOrigin()
public double getScale()
public void setAngle(double angle)
public double getAngle()
public EditingTool getEditingTool()
public void setImageBorder(Border imageBorder)
public Border getImageBorder()
public Point getPositionOverImage(Point componentPoint)
componentPoint - the point in relative coordinatespublic Point convertImagePointToComponentPoint(Point imagePoint)
imagePoint - the point in image coordinatespublic void setPositionOverImage(Point imagePoint, Point componentPoint)
imagePoint - the coordinates of the image pixelcomponentPoint - the relative coordinates where to show imagePointpublic void setMargin(Insets margin)
margin - the new marginpublic Insets getMargin()
public void setScrollBarsVisible(boolean scrollBarsVisible)
scrollBarsVisible - the new settingpublic boolean isScrollBarsVisible()
protected Point computeOrigin(Point imagePoint, Point componentPoint, double scale)
imagePoint - the coordinates of the image pixelcomponentPoint - the relative coordinates where to show imagePointpublic void setScaleQuality(org.imajine.image.Quality scaleQuality)
repaint(), so it must be explicitly invoked if you want to see
immediately the quality change.quality - the qualitypublic org.imajine.image.Quality getScaleQuality()
public void setRotateQuality(org.imajine.image.Quality rotateQuality)
repaint(), so it must be explicitly invoked if you want to see
immediately the quality change.quality - the qualitypublic org.imajine.image.Quality getRotateQuality()
public void setScaledImageCachingEnabled(boolean scaledImageCachingEnabled)
cacheScaleImageEnabled - the switch for this propertypublic boolean isScaledImageCachingEnabled()
public void setOptimizedImageEnabled(boolean optimizedImageEnabled)
optimizedImageEnabled - the switch for this propertypublic boolean isOptimizedImageEnabled()
public void setClippingShape(Shape clippingShape)
clippingShape - the clipping shapepublic void addOverlay(Overlay overlay)
overlay - the overlaypublic void removeOverlay(Overlay overlay)
public void setPreviewSettings(org.imajine.image.render.PreviewSettings previewSettings)
public org.imajine.image.render.PreviewSettings getPreviewSettings()
public void update(Graphics g)
update in class JComponentpublic void paint(Graphics g)
paint in class JComponentpublic void flushAllCaches()
public void flushScaledImageCache()
public void moveOrigin(int deltaX,
int deltaY)
public void setScale(double scale)
scale - the new scalepublic void setScale(double scale,
Point pivotPoint)
scale - the new scalepivotPoint - the pivot point (if null, the center of the renderer
is used)public void setMaxScale(double maxScale)
public double getMaxScale()
public void setMinScale(double minScale)
public double getMinScale()
public double getFitScale()
public void centerImage()
public void fitToDisplaySize()
public void setFitToDisplaySize(boolean fitToDisplaySize)
public void addImageRendererListener(EditableImageRendererListener listener)
public void removeImageRendererListener(EditableImageRendererListener listener)
protected void fireEditingToolActivated(EditingTool editingTool)
protected void fireEditingToolDeactivated(EditingTool editingTool)
Copyright © 2003–2014 Tidalwave s.a.s. (http://tidalwave.it). All rights reserved.