Gnash  0.8.11dev
Classes | Public Member Functions | Protected Attributes | List of all members
gnash::Renderer Class Referenceabstract

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

Classes

class  External
 
class  Internal
 

Public Member Functions

 Renderer ()
 
virtual ~Renderer ()
 
virtual std::string description () const =0
 Return a description of this renderer. More...
 
virtual void set_scale (float, float)
 Sets the x/y scale for the movie. More...
 
virtual void set_translation (float, float)
 
void setQuality (Quality q)
 
virtual CachedBitmapcreateCachedBitmap (std::unique_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. More...
 
virtual void drawVideoFrame (image::GnashImage *frame, const Transform &xform, const SWFRect *bounds, bool smooth)=0
 Draws a video frame. More...
 
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. More...
 
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. More...
 
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). More...
 
virtual void renderToImage (std::unique_ptr< IOChannel >, FileType, int) const
 Draw the current rendering buffer to an image file. More...
 
virtual void set_invalidated_regions (const InvalidatedRanges &)
 Sets the update region (called prior to begin_display). More...
 
virtual geometry::Range2d< int > world_to_pixel (const SWFRect &worldbounds) const =0
 Converts world coordinates to pixel coordinates. More...
 
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) More...
 
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. More...
 
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. More...
 
RenderImages _render_images
 
typedef std::shared_ptr< GnashVaapiImageProxyRenderImage
 
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

§ RenderImage

==================================================================

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

§ RenderImages

Constructor & Destructor Documentation

§ Renderer()

gnash::Renderer::Renderer ( )
inline

§ ~Renderer()

virtual gnash::Renderer::~Renderer ( )
inlinevirtual

Member Function Documentation

§ begin_submit_mask()

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().

§ bounds_in_clipping_area()

virtual bool gnash::Renderer::bounds_in_clipping_area ( const geometry::Range2d< int > &  ) const
inlinevirtual

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.

References gnash::key::a, gnash::key::b, gnash::key::g, gnash::log_debug(), gnash::rgba::m_a, gnash::rgba::m_b, gnash::rgba::m_g, gnash::rgba::m_r, and gnash::key::r.

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

§ createCachedBitmap()

virtual CachedBitmap* gnash::Renderer::createCachedBitmap ( std::unique_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().

§ description()

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

§ disable_mask()

virtual void gnash::Renderer::disable_mask ( )
pure virtual

§ draw_poly()

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 gnash::TextField::display(), and test_renderer().

§ drawGlyph()

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().

§ drawLine()

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 gnash::SWF::TextRecord::displayRecords(), gnash::TextField::removeTextField(), and test_renderer().

§ drawShape()

virtual void gnash::Renderer::drawShape ( const SWF::ShapeRecord shape,
const Transform xform 
)
pure virtual

§ drawVideoFrame()

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 gnash::Video::display(), and test_renderer().

§ end_submit_mask()

virtual void gnash::Renderer::end_submit_mask ( )
pure virtual

§ getFirstRenderImage()

virtual RenderImages::const_iterator gnash::Renderer::getFirstRenderImage ( ) const
inlinevirtual

§ getLastRenderImage()

virtual RenderImages::const_iterator gnash::Renderer::getLastRenderImage ( ) const
inlinevirtual

§ pixel_to_world() [1/2]

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().

§ pixel_to_world() [2/2]

geometry::Range2d<int> gnash::Renderer::pixel_to_world ( const geometry::Range2d< int > &  pixelbounds) const
inline

§ renderToImage()

virtual void gnash::Renderer::renderToImage ( std::unique_ptr< IOChannel ,
FileType  ,
int   
) const
inlinevirtual

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 _, and gnash::log_debug().

Referenced by test_renderer(), and gnash::ScreenShotter::~ScreenShotter().

§ set_invalidated_regions()

virtual void gnash::Renderer::set_invalidated_regions ( const InvalidatedRanges )
inlinevirtual

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

§ set_scale()

virtual void gnash::Renderer::set_scale ( float  ,
float   
)
inlinevirtual

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().

§ set_translation()

virtual void gnash::Renderer::set_translation ( float  ,
float   
)
inlinevirtual

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.

§ setQuality()

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

§ world_to_pixel() [1/2]

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

§ world_to_pixel() [2/2]

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

Member Data Documentation

§ _quality

Quality gnash::Renderer::_quality
protected

Kept in parallel with movie_root's setting.

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

§ _render_images

RenderImages gnash::Renderer::_render_images
protected

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