Gnash  0.8.10
Classes | Public Member Functions | Protected Attributes
gnash::Renderer Class Reference

Base class for render handlers. More...

#include <Renderer.h>

Inheritance diagram for gnash::Renderer:
gnash::renderer::DirectFB::Renderer_DirectFB gnash::renderer::gles1::Renderer_gles1 gnash::renderer::openvg::Renderer_ovg gnash::Renderer_agg_base gnash::Renderer_cairo

List of all members.

Classes

class  External
class  Internal

Public Member Functions

 Renderer ()
virtual ~Renderer ()
virtual std::string description () const =0
 Return a description of this renderer.
virtual void set_scale (float, float)
 Sets the x/y scale for the movie.
virtual void set_translation (float, float)
void setQuality (Quality q)
virtual CachedBitmapcreateCachedBitmap (std::auto_ptr< image::GnashImage > im)=0
 Given an image, returns a pointer to a CachedBitmap class that can later be passed to FillStyleX_bitmap(), to set a bitmap fill style.
virtual void drawVideoFrame (image::GnashImage *frame, const Transform &xform, const SWFRect *bounds, bool smooth)=0
 Draws a video frame.
virtual void drawLine (const std::vector< point > &coords, const rgba &color, const SWFMatrix &mat)=0
 Draw a line-strip directly, using a thin, solid line.
virtual void draw_poly (const std::vector< point > &corners, const rgba &fill, const rgba &outline, const SWFMatrix &mat, bool masked)=0
 Draw a simple, solid filled polygon with a thin (~1 pixel) outline.
virtual void drawShape (const SWF::ShapeRecord &shape, const Transform &xform)=0
virtual void drawGlyph (const SWF::ShapeRecord &rec, const rgba &color, const SWFMatrix &mat)=0
 Draws a glyph (font character).
virtual void renderToImage (boost::shared_ptr< IOChannel >, FileType, int) const
 Draw the current rendering buffer to an image file.
virtual void set_invalidated_regions (const InvalidatedRanges &)
 Sets the update region (called prior to begin_display).
virtual geometry::Range2d< int > world_to_pixel (const SWFRect &worldbounds) const =0
 Converts world coordinates to pixel coordinates.
geometry::Range2d< int > world_to_pixel (const geometry::Range2d< int > &wb) const
virtual point pixel_to_world (int x, int y) const =0
 Converts pixel coordinates to world coordinates (TWIPS)
geometry::Range2d< int > pixel_to_world (const geometry::Range2d< int > &pixelbounds) const
virtual bool bounds_in_clipping_area (const geometry::Range2d< int > &) const
 Checks if the given bounds are (partially) in the current drawing clipping area.
virtual void begin_submit_mask ()=0
virtual void end_submit_mask ()=0
virtual void disable_mask ()=0

Protected Attributes

Quality _quality
 Kept in parallel with movie_root's setting.
RenderImages _render_images
typedef boost::shared_ptr
< GnashVaapiImageProxy
RenderImage
typedef std::vector< RenderImageRenderImages
virtual
RenderImages::const_iterator 
getFirstRenderImage () const
virtual
RenderImages::const_iterator 
getLastRenderImage () const

Detailed Description

Base class for render handlers.

You must define a subclass of Renderer, and pass an instance to the core (RunResources) *before* any SWF parsing begins.

For more info see page Render handler introduction.


Member Typedef Documentation

================================================================== Machinery for delayed images rendering (e.g. Xv with YV12 or VAAPI) ==================================================================


Constructor & Destructor Documentation

gnash::Renderer::Renderer ( ) [inline]
virtual gnash::Renderer::~Renderer ( ) [inline, virtual]

Member Function Documentation

virtual void gnash::Renderer::begin_submit_mask ( ) [pure virtual]

Masks

Masks are defined by drawing calls enclosed by begin_submit_mask() and end_submit_mask(). Between these two calls, no drawing is to occur. The shapes rendered between the two calls define the visible region of the mask. Graphics that are irrelevant in the context of a mask (lines and fill styles, for example) should be ignored. After use, disable_mask() is called to remove the mask.

Masks may be nested. That is, end_submit_mask() may be followed by a call to begin_submit_mask(). The resulting mask shall be an intersection of the previously created mask. disable_mask() shall result in the disabling or destruction of the last created mask.

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, gnash::Renderer_cairo, and gnash::renderer::DirectFB::Renderer_DirectFB.

Referenced by gnash::DisplayList::display(), and gnash::DisplayObject::MaskRenderer::MaskRenderer().

virtual bool gnash::Renderer::bounds_in_clipping_area ( const geometry::Range2d< int > &  ) const [inline, virtual]

Checks if the given bounds are (partially) in the current drawing clipping area.

A render handler implementing invalidated bounds should implement this method to avoid rendering of characters that are not visible anyway. By default this method always returns true, which will ensure correct rendering. If possible, it should be re-implemented by the renderer handler for better performance. b contains TWIPS coordinates.

Referenced by gnash::DisplayObject::boundsInClippingArea(), and test_geometry().

CachedBitmap * gnash::renderer::gles1::Renderer_gles1::createCachedBitmap ( std::auto_ptr< image::GnashImage im) [pure virtual]

Given an image, returns a pointer to a CachedBitmap class that can later be passed to FillStyleX_bitmap(), to set a bitmap fill style.

================================================================== Caching utitilies for core. ==================================================================

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, gnash::renderer::DirectFB::Renderer_DirectFB, and gnash::Renderer_cairo.

Referenced by gnash::SWF::DefineBitsTag::loader(), and test_renderer().

virtual std::string gnash::Renderer::description ( ) const [pure virtual]
virtual void gnash::Renderer::disable_mask ( ) [pure virtual]
virtual void gnash::Renderer::draw_poly ( const std::vector< point > &  corners,
const rgba fill,
const rgba outline,
const SWFMatrix mat,
bool  masked 
) [pure virtual]

Draw a simple, solid filled polygon with a thin (~1 pixel) outline.

This can't be used for Flash shapes but is intended for internal drawings like bounding boxes (editable text fields) and similar. The polygon should not contain self-intersections. If you do not wish a outline or a fill, then simply set the alpha value to zero.

The polygon need NOT be closed (ie: this function will automatically add an additional vertex to close it.

When masked==false, then any potential mask currently active will be ignored, otherwise it is respected.

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, and gnash::Renderer_cairo.

Referenced by test_renderer(), and gnash::TextField::display().

virtual void gnash::Renderer::drawGlyph ( const SWF::ShapeRecord rec,
const rgba color,
const SWFMatrix mat 
) [pure virtual]

Draws a glyph (font character).

Glyphs are defined just like shape characters with the difference that they do not have any fill or line styles. Instead, the shape must be drawn using the given color (solid fill). Please note that although the glyph paths may indicate subshapes, the renderer is to ignore that information.

Parameters:
def
mat
color

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::Renderer_cairo, gnash::renderer::openvg::Renderer_ovg, and gnash::renderer::DirectFB::Renderer_DirectFB.

Referenced by gnash::SWF::TextRecord::displayRecords().

virtual void gnash::Renderer::drawLine ( const std::vector< point > &  coords,
const rgba color,
const SWFMatrix mat 
) [pure virtual]

Draw a line-strip directly, using a thin, solid line.

Can be used to draw empty boxes and cursors.

an array of 16-bit signed integer coordinates. Even indices (and 0) are x coordinates, while uneven ones are y coordinates.

the number of x-y coordinates (vertices).

the color to be used to draw the line strip.

the SWFMatrix to be used to transform the vertices.

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, gnash::Renderer_cairo, and gnash::renderer::DirectFB::Renderer_DirectFB.

Referenced by test_renderer(), and gnash::SWF::TextRecord::displayRecords().

virtual void gnash::Renderer::drawShape ( const SWF::ShapeRecord shape,
const Transform xform 
) [pure virtual]
virtual void gnash::Renderer::drawVideoFrame ( image::GnashImage frame,
const Transform xform,
const SWFRect bounds,
bool  smooth 
) [pure virtual]

Draws a video frame.

================================================================== Rendering Interface. ================================================================== The frame has already been decoded and is available in RGB format only.

Parameters:
frameThe RGB video buffer frame. Ownership of the buffer is left to the caller.
matThe SWFMatrix with world coordinates used to retrieve the x and y coordinate of the video object. The scaling of the SWFMatrix only refers to the Flash instance, *not* to the video inside that instance. When a video object is placed on the stage and the loaded video is smaller, then the SWFMatrix is still an "identity matrix". However, if the video object is scaled via ActionScript, for example, then the SWFMatrix will change. This means the renderer has to find the correct scaling for the video inside the bounds.
boundsThe minX/minY fields of this SWFRect are always zero. The width and height determine the size of the Flash video instance on the stage (in TWIPS) prior to SWFMatrix transformations.

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, gnash::renderer::DirectFB::Renderer_DirectFB, and gnash::Renderer_cairo.

Referenced by test_renderer(), and gnash::Video::display().

virtual void gnash::Renderer::end_submit_mask ( ) [pure virtual]
virtual RenderImages::const_iterator gnash::Renderer::getFirstRenderImage ( ) const [inline, virtual]
virtual RenderImages::const_iterator gnash::Renderer::getLastRenderImage ( ) const [inline, virtual]
virtual point gnash::Renderer::pixel_to_world ( int  x,
int  y 
) const [pure virtual]

Converts pixel coordinates to world coordinates (TWIPS)

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, and gnash::Renderer_cairo.

Referenced by test_geometry().

geometry::Range2d<int> gnash::Renderer::pixel_to_world ( const geometry::Range2d< int > &  pixelbounds) const [inline]
virtual void gnash::Renderer::renderToImage ( boost::shared_ptr< IOChannel ,
FileType  ,
int   
) const [inline, virtual]

Draw the current rendering buffer to an image file.

Although this can be done at any time during the rendering cycle without harmful side effects, it's advisable only to do it when between advance() calls, when the frame is fully renderered.

Parameters:
ioThe IOChannel to write to.
typeThe type of image output required (PNG, JPEG, GIF). Note that not all FileTypes are images: rendering to an FLV will not work.

References _.

Referenced by test_renderer().

virtual void gnash::Renderer::set_invalidated_regions ( const InvalidatedRanges ) [inline, virtual]

Sets the update region (called prior to begin_display).

================================================================== Prepare drawing area and other utilities ================================================================== The renderer might do clipping and leave the region outside these bounds unchanged, but he is allowed to change them if that makes sense. After rendering a frame the area outside the invalidated region can be undefined and is not used.

It is not required for all renderers. Parameters are world coordinates (TWIPS).

For more info see page Detection of updated regions.

Reimplemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, gnash::renderer::DirectFB::Renderer_DirectFB, and gnash::Renderer_cairo.

Referenced by gnash::AOS4AggGlue::setInvalidatedRegions(), gnash::AOS4CairoGlue::setInvalidatedRegions(), gnash::HaikuAggGlue::setInvalidatedRegions(), gnash::KdeAggGlue::setInvalidatedRegions(), and gnash::SdlAggGlue::setInvalidatedRegions().

virtual void gnash::Renderer::set_scale ( float  ,
float   
) [inline, virtual]

Sets the x/y scale for the movie.

================================================================== Interfaces for adjusting renderer output. ==================================================================

Reimplemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, gnash::renderer::DirectFB::Renderer_DirectFB, and gnash::Renderer_cairo.

Referenced by gnash::GtkAggVaapiGlue::beforeRendering().

virtual void gnash::Renderer::set_translation ( float  ,
float   
) [inline, virtual]

Sets the x/y offset for the movie in pixels. This applies to all graphics drawn except the background, which must be drawn for the entire canvas, regardless of the translation.

Reimplemented in gnash::Renderer_cairo.

void gnash::Renderer::setQuality ( Quality  q) [inline]

References _quality, and gnash::key::q.

Referenced by gnash::movie_root::setQuality().

virtual geometry::Range2d<int> gnash::Renderer::world_to_pixel ( const SWFRect worldbounds) const [pure virtual]

Converts world coordinates to pixel coordinates.

================================================================== Interface for querying the renderer. ==================================================================

Implemented in gnash::renderer::gles1::Renderer_gles1, gnash::renderer::openvg::Renderer_ovg, and gnash::Renderer_cairo.

Referenced by gnash::AOS4AggGlue::setInvalidatedRegions(), gnash::AOS4CairoGlue::setInvalidatedRegions(), gnash::HaikuAggGlue::setInvalidatedRegions(), gnash::KdeAggGlue::setInvalidatedRegions(), gnash::SdlAggGlue::setInvalidatedRegions(), and test_geometry().

geometry::Range2d<int> gnash::Renderer::world_to_pixel ( const geometry::Range2d< int > &  wb) const [inline]

Member Data Documentation

Kept in parallel with movie_root's setting.

Referenced by gnash::Renderer_cairo::drawVideoFrame().


The documentation for this class was generated from the following files: