Classes | Public Member Functions | Protected Attributes

gnash::Renderer Class Reference

Base class for render handlers. More...

#include <Renderer.h>

Inheritance diagram for gnash::Renderer:
Inheritance graph
[legend]

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 bitmap_info 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 point *corners, size_t corner_count, 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) 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)=0
 Converts world coordinates to pixel coordinates.
virtual point pixel_to_world (int x, int y)=0
 Converts pixel coordinates to world coordinates (TWIPS).
virtual geometry::Range2d< int > pixel_to_world (const geometry::Range2d< int > &pixelbounds)
virtual geometry::Range2d< int > world_to_pixel (const geometry::Range2d< int > &worldbounds)
virtual bool bounds_in_clipping_area (const SWFRect &bounds)
 Checks if the given bounds are (partially) in the current drawing clipping area.
virtual bool bounds_in_clipping_area (const InvalidatedRanges &ranges)
virtual bool bounds_in_clipping_area (const geometry::Range2d< int > &)

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::iterator getFirstRenderImage ()
virtual
RenderImages::const_iterator 
getFirstRenderImage () const
virtual RenderImages::iterator getLastRenderImage ()
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_cairo.

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

virtual bool gnash::Renderer::bounds_in_clipping_area ( const SWFRect bounds  )  [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. 'bounds' contains TWIPS coordinates.

TODO: Take a Range2d<T> rather then a gnash::SWFRect ? Would T==int be good ? TWIPS as integer types ?

See also gnash::renderer::bounds_in_clipping_area

References gnash::SWFRect::getRange().

Referenced by gnash::DisplayObject::boundsInClippingArea().

virtual bool gnash::Renderer::bounds_in_clipping_area ( const InvalidatedRanges ranges  )  [inline, virtual]
virtual bool gnash::Renderer::bounds_in_clipping_area ( const geometry::Range2d< int > &   )  [inline, virtual]
virtual CachedBitmap* gnash::Renderer::createCachedBitmap ( std::auto_ptr< image::GnashImage im  )  [pure virtual]

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

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

Implemented in gnash::Renderer_cairo.

virtual std::string gnash::Renderer::description (  )  const [pure virtual]

Return a description of this renderer.

Implemented in gnash::Renderer_cairo.

virtual void gnash::Renderer::disable_mask (  )  [pure virtual]
virtual void gnash::Renderer::draw_poly ( const point corners,
size_t  corner_count,
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_cairo.

Referenced by 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_cairo.

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_cairo.

Referenced by 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:
frame The RGB video buffer frame. Ownership of the buffer is left to the caller.
mat The 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.
bounds The 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_cairo.

virtual void gnash::Renderer::end_submit_mask (  )  [pure virtual]
virtual RenderImages::iterator gnash::Renderer::getFirstRenderImage (  )  [inline, virtual]
virtual RenderImages::const_iterator gnash::Renderer::getFirstRenderImage (  )  const [inline, virtual]
virtual RenderImages::iterator gnash::Renderer::getLastRenderImage (  )  [inline, virtual]
virtual RenderImages::const_iterator gnash::Renderer::getLastRenderImage (  )  const [inline, virtual]
virtual geometry::Range2d<int> gnash::Renderer::pixel_to_world ( const geometry::Range2d< int > &  pixelbounds  )  [inline, virtual]
virtual point gnash::Renderer::pixel_to_world ( int  x,
int  y 
) [pure virtual]

Converts pixel coordinates to world coordinates (TWIPS).

Implemented in gnash::Renderer_cairo.

virtual void gnash::Renderer::renderToImage ( boost::shared_ptr< IOChannel ,
FileType   
) 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:
io The IOChannel to write to.
type The type of image output required (PNG, JPEG, GIF). Note that not all FileTypes are images: rendering to an FLV will not work.

References _.

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_cairo.

Referenced by gnash::SdlAggGlue::setInvalidatedRegions(), gnash::HaikuAggGlue::setInvalidatedRegions(), gnash::AOS4CairoGlue::setInvalidatedRegions(), and gnash::AOS4AggGlue::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_cairo.

Referenced by gnash::GtkAggVaapiGlue::beforeRendering(), gnash::GtkAggXvGlue::render(), and gnash::MovieTester::resizeStage().

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.

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

Converts world coordinates to pixel coordinates.

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

Implemented in gnash::Renderer_cairo.

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

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

Member Data Documentation

Kept in parallel with movie_root's setting.


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