Class AWTColorbarLegend
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.view.AbstractViewportManager
-
- org.jzy3d.plot3d.rendering.view.AWTImageViewport
-
- org.jzy3d.plot3d.rendering.legends.AWTLegend
-
- org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend
-
- All Implemented Interfaces:
IDrawableListener
,IColorbarLegend
,ILegend
,IImageViewport
public class AWTColorbarLegend extends AWTLegend implements IColorbarLegend
Handle a colorbar rendered as an AWTBufferedImage
.Content and coloring
A colorbar is configured with- a colormap defined by the input
Drawable
if it isIMultiColorable
and if it has aColorMapper
defined. - a set of axis ticks defined and formated by
IAxisLayout
.
Layout
The size of the colorbar image is driven byAWTLegend.setViewPort(int, int, float, float)
which indicates the canvas dimension on screen and the slice that the colorbar should occupy. The image width will beimageWidth = width * (right - left)
. The viewport is set byViewAndColorbarsLayout
.
ViewAndColorbarsLayout
which render the prepared image at the layout given position for this colorbar (which is defined with left/right parameters). Schema sourcesRendering path
EmulGL and Native have different rendering pathes- Native chart have their colorbar image rendered by
render(IPainter)
. - EmulGL chart have their colorbar image rendered by AWT as bypassed by
EmulGLViewAndColorbarLayout
, which customize the way pixel scale should be handled for rendering such image in a good layoout
-
-
Field Summary
Fields Modifier and Type Field Description protected int
askedHeight
protected int
askedWidth
protected static int
DEFAULT_MARGIN_HEIGHT
protected Font
font
protected ITickProvider
provider
protected ITickRenderer
renderer
protected boolean
usePixelScale
-
Fields inherited from class org.jzy3d.plot3d.rendering.legends.AWTLegend
background, drawable, foreground, imageGenerator, minimumDimension
-
Fields inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
image, IMAGE_Z, imageData, imageHeight, imageWidth, margin, pixelScale
-
Fields inherited from class org.jzy3d.plot3d.rendering.view.AbstractViewportManager
apply_WindowsHiDPI_Workaround, lastViewPort, mode, ratioHeight, ratioWidth, screenBottom, screenGridDisplayed, screenHeight, screenLeft, screenSquaredDim, screenWidth, screenXOffset, screenYOffset
-
-
Constructor Summary
Constructors Constructor Description AWTColorbarLegend(Drawable parent, Chart chart)
AWTColorbarLegend(Drawable parent, AxisLayout layout)
AWTColorbarLegend(Drawable parent, AxisLayout layout, Color foreground)
AWTColorbarLegend(Drawable parent, AxisLayout layout, Color foreground, Color background)
AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer)
AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer, Color foreground, Color background)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Font
getFont()
int
getHeight()
AWTColorbarImageGenerator
getImageGenerator()
int
getWidth()
protected void
initImageGenerator(Drawable parent, ITickProvider provider, ITickRenderer renderer)
boolean
isUsePixelScale()
void
render(IPainter painter)
Renders the picture into the window, according to the viewport settings.void
setFont(Font font)
Update image generator fontvoid
setMargin(Dimension margin)
Update image according to new margin.void
setUsePixelScale(boolean usePixelScale)
BufferedImage
toImage(int width, int height)
protected BufferedImage
toImage(int width, int height, Dimension margin, Coord2d pixelScale)
Generate an image for this dimension, margin and pixel scale.void
updateImage()
Recompute the picture, using last used dimensions.protected void
updatePixelScale(Coord2d pixelScale)
Update the image with pixel scale if scale changed-
Methods inherited from class org.jzy3d.plot3d.rendering.legends.AWTLegend
dispose, drawableChanged, getBackground, getForeground, getMinimumDimension, saveImage, setBackground, setForeground, setGeneratorColors, setMinimumDimension, setMinimumWidth, setViewPort
-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
getImage, getMargin, renderImage, setImage, setImage, setImage
-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AbstractViewportManager
applyViewport, getLastViewPort, getRectangle, getScreenBottom, getScreenHeight, getScreenLeft, getScreenWidth, getScreenXOffset, getScreenYOffset, getSliceWidth, getViewportMode, isScreenGridDisplayed, renderSubScreenGrid, setScreenGridDisplayed, setViewPort, setViewPort, setViewportMode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jzy3d.plot3d.rendering.legends.colorbars.IColorbarLegend
drawableChanged, getMinimumDimension, setMinimumDimension
-
Methods inherited from interface org.jzy3d.plot3d.rendering.view.IImageViewport
getLastViewPort, getSliceWidth, getViewportMode, setViewPort, setViewPort, setViewportMode
-
-
-
-
Field Detail
-
provider
protected ITickProvider provider
-
renderer
protected ITickRenderer renderer
-
askedWidth
protected int askedWidth
-
askedHeight
protected int askedHeight
-
font
protected Font font
-
usePixelScale
protected boolean usePixelScale
-
DEFAULT_MARGIN_HEIGHT
protected static final int DEFAULT_MARGIN_HEIGHT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, AxisLayout layout)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, AxisLayout layout, Color foreground)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, AxisLayout layout, Color foreground, Color background)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer, Color foreground, Color background)
-
-
Method Detail
-
initImageGenerator
protected void initImageGenerator(Drawable parent, ITickProvider provider, ITickRenderer renderer)
-
render
public void render(IPainter painter)
Description copied from interface:IImageViewport
Renders the picture into the window, according to the viewport settings. If the picture is bigger than the viewport, it is simply centered in it, otherwise, it is scaled in order to fit into the viewport.- Specified by:
render
in interfaceIColorbarLegend
- Specified by:
render
in interfaceIImageViewport
- Overrides:
render
in classAWTImageViewport
-
toImage
public BufferedImage toImage(int width, int height)
-
toImage
protected BufferedImage toImage(int width, int height, Dimension margin, Coord2d pixelScale)
Generate an image for this dimension, margin and pixel scale. If running on a HiDPI screen, width and height parameter will grow.
-
updateImage
public void updateImage()
Description copied from interface:ILegend
Recompute the picture, using last used dimensions.- Specified by:
updateImage
in interfaceILegend
- Overrides:
updateImage
in classAWTLegend
-
setMargin
public void setMargin(Dimension margin)
Update image according to new margin.- Overrides:
setMargin
in classAWTImageViewport
-
updatePixelScale
protected void updatePixelScale(Coord2d pixelScale)
Update the image with pixel scale if scale changed- Overrides:
updatePixelScale
in classAWTImageViewport
-
setFont
public void setFont(Font font)
Update image generator font
-
getImageGenerator
public AWTColorbarImageGenerator getImageGenerator()
-
isUsePixelScale
public boolean isUsePixelScale()
-
setUsePixelScale
public void setUsePixelScale(boolean usePixelScale)
-
-