|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.Figure
org.eclipse.draw2d.ImageFigure
org.eclipse.gmf.runtime.draw2d.ui.render.figures.ScalableImageFigure
public class ScalableImageFigure
An implementation of ImageFigure
that allows
scaling the underlying image to the containing Figure's bounds, rather then
being fixed to the image size.
Any image that can be implemented inside the RenderedImage interface can be supported.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure |
---|
Figure.FigureIterator, Figure.IdentitySearch |
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure |
---|
IFigure.NoInsets |
Field Summary |
---|
Fields inherited from class org.eclipse.draw2d.Figure |
---|
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip |
Fields inherited from interface org.eclipse.draw2d.IFigure |
---|
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS |
Constructor Summary | |
---|---|
ScalableImageFigure(Image img)
|
|
ScalableImageFigure(RenderedImage renderedImage)
|
|
ScalableImageFigure(RenderedImage renderedImage,
boolean antiAlias)
Constructor for meta image sources. |
|
ScalableImageFigure(RenderedImage renderedImage,
boolean useDefaultImageSize,
boolean useOriginalColors,
boolean antiAlias)
Constructor for meta image sources. |
Method Summary | |
---|---|
Image |
getImage()
Override to return an image that is scaled to fit the bounds of the figure. |
Dimension |
getPreferredSize(int wHint,
int hHint)
Returns the size set specified by setPreferredImageSize() or the size specified by the image. |
RenderedImage |
getRenderedImage()
Gets the RenderedImage that is being displayed by this
figure. |
boolean |
isAntiAlias()
Accessor to determine if the rendered image will be anti-aliased (if possible). |
boolean |
isMaintainAspectRatio()
Accessor to determine if the rendered image will respect the original aspect ratio of the default image when resized. |
protected void |
paintFigure(Graphics graphics)
|
protected void |
paintFigureWhileRendering(Graphics g)
If the rendering is occuring on a separate thread, this method is a hook to draw a temporary image onto the drawing surface. |
void |
setAntiAlias(boolean antiAlias)
Sets a property to determine if the rendered image will be anti-aliased (if possible). |
void |
setBounds(Rectangle rect)
|
void |
setMaintainAspectRatio(boolean maintainAspectRatio)
Sets a property to determine if the rendered image will respect the original aspect ratio of the default image when resized. |
void |
setPreferredImageSize(int w,
int h)
Sets the preferred size of the image figure. |
void |
setRenderedImage(RenderedImage renderedImage)
Sets the RenderedImage that is to be displayed by this
figure |
boolean |
useOriginalColors()
|
Methods inherited from class org.eclipse.draw2d.ImageFigure |
---|
setAlignment, setImage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScalableImageFigure(Image img)
img
- the Image
to renderpublic ScalableImageFigure(RenderedImage renderedImage)
renderedImage
- public ScalableImageFigure(RenderedImage renderedImage, boolean antiAlias)
renderedImage
- the RenderedImage
that is used for rendering
the image.public ScalableImageFigure(RenderedImage renderedImage, boolean useDefaultImageSize, boolean useOriginalColors, boolean antiAlias)
renderedImage
- the RenderedImage
that is used for rendering
the image.useDefaultImageSize
- boolean
indicating whether to initialize the
preferred size with the default image size. Otherwise, a set
default will be used instead.useOriginalColors
- boolean
indicating whether to use the original
colors of the RenderedImage
or to replace black
with outline color and white with the fill color.Method Detail |
---|
public boolean isAntiAlias()
boolean
true
if anti aliasing is
on, false
otherwise.public void setAntiAlias(boolean antiAlias)
antiAlias
- boolean
true
if anti-aliasing is
to be turned on, false
otherwisepublic boolean isMaintainAspectRatio()
boolean
true
if maintain aspect
ratio is on, false
otherwise.public void setMaintainAspectRatio(boolean maintainAspectRatio)
maintainAspectRatio
- boolean
true
if maintain aspect
ratio is to be turned on, false
otherwisepublic void setPreferredImageSize(int w, int h)
w
- the preferred width of the imageh
- the preferred height of the imagepublic Dimension getPreferredSize(int wHint, int hHint)
getPreferredSize
in interface IFigure
getPreferredSize
in class ImageFigure
public void setBounds(Rectangle rect)
setBounds
in interface IFigure
setBounds
in class Figure
public Image getImage()
getImage
in class ImageFigure
public boolean useOriginalColors()
boolean
true
if the original
colors of the image should be used for rendering, or
false
indicates that black and white colors can
replaced by the specified outline and fill colors respectively of
the RenderInfo
.protected void paintFigureWhileRendering(Graphics g)
g
- the Graphics
object to paint the temporary image toprotected void paintFigure(Graphics graphics)
paintFigure
in class ImageFigure
public RenderedImage getRenderedImage()
RenderedImage
that is being displayed by this
figure.
RenderedImage
that is being displayed by this
figure.public void setRenderedImage(RenderedImage renderedImage)
RenderedImage
that is to be displayed by this
figure
the
- RenderedImage
that is to being displayed by
this figure
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.