public class PixelImageExporter extends Object
CanvasControl
into a WritableImage
.
Related Information in the Developers Guide:
Using PixelImageExporter
is described in the section
Exporting the Canvas's Content.
More information on the exporting pixel images can be found in the section Exporting the Canvas's Content.
Constructor and Description |
---|
PixelImageExporter(ContextConfigurator configurator)
Initializes a new
PixelImageExporter with the given
ContextConfigurator . |
PixelImageExporter(RectD worldBounds)
Initializes a new
PixelImageExporter that exports the content
of the given bounds in world coordinates. |
Modifier and Type | Method and Description |
---|---|
protected SnapshotParameters |
createSnapshotParameters()
Creates the SnapshotParameters to use for the
snapshot
call in exportToBitmap(CanvasControl) . |
WritableImage |
exportToBitmap(CanvasControl canvasControl)
Exports a region of the given
CanvasControl to a WritableImage . |
Paint |
getBackgroundFill()
Returns the background fill to use for image export.
|
ContextConfigurator |
getConfiguration()
Returns the
ContextConfigurator instance that is used to create
the canvas to paint the image onto and to configure the IRenderContext
that is passed to the export method
of the elements to export. |
void |
setBackgroundFill(Paint fill)
Sets the background fill to use for image export.
|
public PixelImageExporter(ContextConfigurator configurator)
PixelImageExporter
with the given
ContextConfigurator
.configurator
- determines the region and scale to export.public PixelImageExporter(RectD worldBounds)
PixelImageExporter
that exports the content
of the given bounds in world coordinates. This will initialize the
getConfiguration()
property with a default instance that has been
set to the given bounds.worldBounds
- The bounds of the content to export in world coordinates.protected SnapshotParameters createSnapshotParameters()
snapshot
call in exportToBitmap(CanvasControl)
.
This implementation creates a SnapshotParameters
instance using the default constructor and set its
fill
to Color.TRANSPARENT
if this should be used as
background fill
.
SnapshotParameters
instance.exportToBitmap(CanvasControl)
public WritableImage exportToBitmap(CanvasControl canvasControl)
CanvasControl
to a WritableImage
.
The region to export is determined by the exporter's ContextConfigurator
.
This method will use the value returned by createSnapshotParameters()
for the
Node.snapshot(javafx.scene.SnapshotParameters, javafx.scene.image.WritableImage)
call
that does the actual rendering of the image.
canvasControl
- the CanvasControl
to exportcreateSnapshotParameters()
public Paint getBackgroundFill()
public ContextConfigurator getConfiguration()
ContextConfigurator
instance that is used to create
the canvas to paint the image onto and to configure the IRenderContext
that is passed to the export method
of the elements to export.ContextConfigurator
that is used for image export.public void setBackgroundFill(Paint fill)
fill
- the desired background fill of the image