Interface Renderable
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractRenderer
,AbstractRenderToImageAwareRenderer
,AbstractRenderToImageDataRenderer
,AbstractSvgDataToGraphics2DRenderer
,AwtComponentRendererImpl
,BarbecueRendererImpl
,DrawChartRendererImpl
,JCommonDrawableRendererImpl
,JRVirtualPrintPage.JRIdHolderRenderer
,ResourceRenderer
,SimpleDataRenderer
,SimpleRenderToImageAwareDataRenderer
,UnusedSpaceImageRenderer
,WrappingImageDataToGraphics2DRenderer
,WrappingRenderToImageDataRenderer
,WrappingSvgDataToGraphics2DRenderer
public interface Renderable extends Serializable
Provides functionality for image rendering.The content of an image element can come either directly from an image file like a JPG, GIF, PNG, or can be a Scalable Vector Graphics (SVG) file that is rendered using some business logic or a special graphics API like a charting or a barcode library. Either way, JasperReports treats images in a very transparent way because it relies on a special interface called
Renderable
to offer a common way to render images.The
Graphics2DRenderable
interface has a method calledGraphics2DRenderable.render(JasperReportsContext, Graphics2D, Rectangle2D)
, which gets called by the engine each time it needs to draw the image on a given device or graphic context. This approach provides the best quality for the SVG images when they must be drawn on unknown devices or zoomed into without losing sharpness.The
DataRenderable
interface has a method calledDataRenderable.getData(JasperReportsContext)
, which gets called by the engine each time it needs the actual image data either to embed it directly into the exported documents, or to use it to draw the image or the graphic onto a device or graphic context.When a renderable object provides only binary data, the engine uses wrapping renderable implementations to add rendering functionality to the source renderable object. On the other hand, when the renderable object provides only direct rendering functionality, the engine wraps it into special renderable implementations that would allow producing image data out of the source rendering routines.
The library comes with a default implementation for the
DataRenderable
interface that wraps images that come from files or binary image data in JPG, GIF, or PNG format. This is theSimpleDataRenderer
class. For wrapping SVG data, theSimpleRenderToImageAwareDataRenderer
is better suited because it allows providing additional information about required resolution of the graphic, when converted to and image, as the engine needs to do that for certain document formats at export time.Image renderers are serializable because inside the generated document for each image is a renderer object kept as reference, which is serialized along with the whole JasperPrint object.
When a
SimpleDataRenderer
instance is serialized, so is the binary image data it contains.However, if the image element must be lazy loaded (see the
isLazy
image attribute), then the engine will not load the binary image data at report-filling time. Rather, it stores inside the renderer only thejava.lang.String
location of the image. The actual image data is loaded only when needed for rendering at report-export or view time. Lazy image renderers are represented by the theResourceRenderer
implementation and require the image data to be loaded at export time for certain export formats.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_IMAGE_DPI
Specifies the image resolution in dots-per-inch, for the images created by the engine when rasterizing SVGs or when clipping other renderers.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getId()
-
-
-
Field Detail
-
PROPERTY_IMAGE_DPI
static final String PROPERTY_IMAGE_DPI
Specifies the image resolution in dots-per-inch, for the images created by the engine when rasterizing SVGs or when clipping other renderers.- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
String getId()
-
-