public class MemoryImageNodeStyle extends Object implements INodeStyle, Cloneable
INodeStyle interface that uses BitmapSource that are built
from memory as visual representation of a node.
During serialization this instance will serialize the contents of the image.
Note: by default the image contents are serialized in PNG format. Since the PNG conversion depends on classes
in packages javax.imageio and javafx.embed.swing image serialization will not be handled on
platforms where these packages are not available (e.g. Android). Developers who want to provide serialization support
for images on these platforms have to register a custom
serialization and
deserialization
handler.
com.yworks.yfiles.drawing.ImageNodeStyle| Constructor and Description |
|---|
MemoryImageNodeStyle()
Creates a new instance.
|
MemoryImageNodeStyle(Image imageSource)
Creates a new instance with the given
imageSource. |
MemoryImageNodeStyle(Image imageSource,
INodeStyleRenderer renderer)
Creates a new instance using the specified image and a custom renderer instance.
|
| Modifier and Type | Method and Description |
|---|---|
MemoryImageNodeStyle |
clone()
This implementation performs a shallow copy with respect to the
BitmapSource property. |
Image |
getBitmapSource()
Gets the bitmap source.
|
GeneralPath |
getNormalizedOutline()
Gets the normalized outline of the image that will be displayed.
|
INodeStyleRenderer |
getRenderer()
Gets the renderer implementation that can be queried for implementations that provide details about the visual
appearance and visual behavior for a given node and this style instance.
|
void |
setBitmapSource(Image value)
Sets the bitmap source.
|
void |
setNormalizedOutline(GeneralPath value)
Sets the normalized outline of the image that will be displayed.
|
public MemoryImageNodeStyle()
public MemoryImageNodeStyle(Image imageSource)
imageSource.imageSource - The image to use.public MemoryImageNodeStyle(Image imageSource, INodeStyleRenderer renderer)
image - The image to use.renderer - The custom renderer for this instance.public MemoryImageNodeStyle clone()
BitmapSource property.
If clients need to have a deep copy of this instance, they need to manually clone and reassign the BitmapSource
to the clone.
clone in interface ICloneableclone in class ObjectObject.clone()public Image getBitmapSource()
The default value is null.
setBitmapSource(Image)public final GeneralPath getNormalizedOutline()
This shape will be used to satisfy requests to IMarqueeTestable.isInBox(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.RectD)
and IHitTestable.isHit(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.PointD) and
may be left null to indicate default (rectangular) behavior.
#setOutlineShape(Shape)public final INodeStyleRenderer getRenderer()
INodeStyle
The idiom for retrieving, e.g. an IVisualCreator implementation for a given style is:
getRenderer in interface INodeStylepublic void setBitmapSource(Image value)
The default value is null.
value - The bitmap source.getBitmapSource()public final void setNormalizedOutline(GeneralPath value)
This shape will be used to satisfy requests to IMarqueeTestable.isInBox(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.RectD)
and IHitTestable.isHit(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.PointD) and
may be left null to indicate default (rectangular) behavior.
value - The OutlineShape to set.#getOutlineShape()