Renderer
is an object that is capable of rendering content into a desired output format, usually HTML
.
Renderer
defines an interface for classes that handle displaying of graphics data to a render context. All rendering state and tasks should be handled through this class.
Developers usually do not need to create a Renderer by constructors directly, alternatively a renderer can be created by calling the static {@code create} methods or the {@code add} methods. @author e-ryu
Renderer
is responsible for taking rendering commands and executing them on the underlying video hardware.
@author Kirill Vainer
The output using default settings complies with the "text/plain; format=flowed" (DelSp=No) protocol described in RFC3676.
Many properties are available to customise the output, possibly the most significant of which being {@link #setMaxLineLength(int) MaxLineLength}. See the individual property descriptions for details.
Use one of the following methods to obtain the output:
The rendering of some constructs, especially tables, is very rudimentary. No attempt is made to render nested tables properly, except to ensure that all of the text content is included in the output.
Rendering an entire {@link Source} object performs a {@linkplain Source#fullSequentialParse() full sequential parse} automatically.
Any aspect of the algorithm not specifically mentioned here is subject to change without notice in future versions.
To extract pure text without any rendering of the markup, use the {@link TextExtractor} class instead.
RendererFactory
implementation. Renderer
is used to render GraphNode
s. The difference between this and a TYpeRenderer is that this renders a node without doing CallBacks, while a TypeRenderlet might delegate parts of the rendering by doing callbacks.
@author mir, reto
@version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/Renderer.java#0 $) $Date: 10-nov-2005.18:50:17 $ @author The Oracle ADF Faces Team
Renderers are the most essential parts of the Preview as they contain the code that actually draws the item on the canvas. Each item (e.g. node, edge) should have its renderer.
Rendering is a three-steps process:
preProcess()
method is called on all renderers to let them initialize additional attributes for their items. The best example is the edge renderer which will initialize the source and target position in the EdgeItem
object during this phase. In general the preProcess()
method is the best for complex algorithms or gathering data from other items. Note that the preProcess()
method is called only once per refresh, unlike render()
which is called many times.isRendererForitem()
is then used to determine which renderer should be used to render an item. The method provides an access to the preview properties. For instance, if the properties says the edge display is disabled, the edge renderer should return false
for every item. Note that nothing avoids several renderer to returns true
for the same item.render()
method is finally called for every item which the renderer returned true
at isRendererForitem()
. It receives the properties and the render target. It uses the item attributes and properties to determine item aspects and the render target to obtain the canvas. Renderers also provide a list of {@link PreviewProperty} which the user canedit. All properties are put in the central {@link PreviewProperties} so thougheach renderer defines it's properties it can read/write any property through PreviewProperties
.
If your plugin renderer extends one of the default renderers, your plugin renderer will automatically replace the extended renderer. This means the default renderer will not even be available in the renderers manager.
Also, if more than one plugin extends the same default renderer, the one with lowest position will be enabled by the default, but others will still be available for activation in the renderers manager.
The list of default renderers is the following (contained in Preview Plugin module);
Renderers are singleton services and implementations need to add the following annotation to be recognized by the system:
@ServiceProvider(service=Renderer.class, position=XXX)
Position parameter optional but recommended in order to control the default order in which the available renderers are executed.
@author Yudi Xue, Mathieu Bastian
if (moleculeIsNew) { renderer.setScale(molecule); Rectangle diagramBounds = renderer.calculateDiagramBounds(molecule); renderer.setZoomToFit(diagramBounds, drawArea); renderer.paintMolecule(molecule, visitor); } else { Rectangle diagramSize = renderer.paintMolecule(molecule, visitor); // ...update scroll bars here }finally, if you are scrolling, and have not changed the diagram:
renderer.repaint(visitor)will just repaint the previously generated diagram, at the same scale.
There are two sets of methods for painting IChemObjects - those that take a Rectangle that represents the desired draw area, and those that return a Rectangle that represents the actual draw area. The first are intended for drawing molecules fitted to the screen (where 'screen' means any drawing area) while the second type of method are for drawing bonds at the length defined by the {@link JChemPaintRendererModel} parameter bondLength.
There are two numbers used to transform the model so that it fits on screen. The first is scale, which is used to map model coordinates to screen coordinates. The second is zoom which is used to, well, zoom the on screen coordinates. If the diagram is fit-to-screen, then the ratio of the bounds when drawn using bondLength and the bounds of the screen is used as the zoom.
So, if the bond length on screen is set to 40, and the average bond length of the model is 2 (unitless, but roughly Ångstrom scale) then the scale will be 20. If the model is 10 units wide, then the diagram drawn at 100% zoom will be 10 * 20 = 200 in width on screen. If the screen is 400 pixels wide, then fitting it to the screen will make the zoom 200%. Since the zoom is just a floating point number, 100% = 1 and 200% = 2. @author maclean @cdk.module renderextra
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|