Gnash  0.8.11dev
Public Member Functions | List of all members
gnash::Renderer_cairo Class Reference

#include <Renderer_cairo.h>

Inheritance diagram for gnash::Renderer_cairo:
gnash::Renderer

Public Member Functions

 Renderer_cairo ()
 Implementation of Renderer_cairo class. More...
 
 ~Renderer_cairo ()
 
std::string description () const
 Return a description of this renderer. More...
 
CachedBitmapcreateCachedBitmap (std::unique_ptr< image::GnashImage > im)
 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...
 
void drawVideoFrame (image::GnashImage *baseframe, const Transform &xform, const SWFRect *bounds, bool smooth)
 Draws a video frame. More...
 
virtual geometry::Range2d< int > world_to_pixel (const SWFRect &worldbounds) const
 Converts world coordinates to pixel coordinates. More...
 
virtual point pixel_to_world (int x, int y) const
 Converts pixel coordinates to world coordinates (TWIPS) More...
 
void set_color (const rgba &c)
 
void set_invalidated_regions (const InvalidatedRanges &ranges)
 Sets the update region (called prior to begin_display). More...
 
virtual RendererstartInternalRender (image::GnashImage &)
 Setup the renderer to draw to an internal buffer. More...
 
virtual void endInternalRender ()
 Finish internal rendering. More...
 
virtual void begin_display (const rgba &bg_color, int viewport_width, int viewport_height, float x0, float x1, float y0, float y1)
 Bracket the displaying of a frame from a movie. More...
 
virtual void end_display ()
 
void set_scale (float xscale, float yscale)
 Sets the x/y scale for the movie. More...
 
void set_translation (float xoff, float yoff)
 
void drawLine (const std::vector< point > &coords, const rgba &color, const SWFMatrix &mat)
 Draw a line-strip directly, using a thin, solid line. More...
 
void draw_poly (const std::vector< point > &corners, const rgba &fill, const rgba &outline, const SWFMatrix &mat, bool masked)
 Draw a simple, solid filled polygon with a thin (~1 pixel) outline. More...
 
void set_antialiased (bool enable)
 
void begin_submit_mask ()
 
void end_submit_mask ()
 
void disable_mask ()
 
void add_path (cairo_t *cr, const Path &cur_path)
 
void apply_line_style (const LineStyle &style, const SWFCxForm &cx, const SWFMatrix &mat)
 
void draw_outlines (const PathVec &path_vec, const std::vector< LineStyle > &line_styles, const SWFCxForm &cx, const SWFMatrix &mat)
 
std::vector< PathVec::const_iterator > find_subshapes (const PathVec &path_vec)
 
void draw_subshape (const PathVec &path_vec, const SWFMatrix &mat, const SWFCxForm &cx, const std::vector< FillStyle > &FillStyles, const std::vector< LineStyle > &line_styles)
 
void draw_mask (const PathVec &path_vec)
 
void add_paths (const PathVec &path_vec)
 
void apply_matrix_to_paths (std::vector< Path > &paths, const SWFMatrix &mat)
 Takes a path and translates it using the given SWFMatrix. More...
 
void drawShape (const SWF::ShapeRecord &shape, const Transform &xform)
 
void drawGlyph (const SWF::ShapeRecord &rec, const rgba &color, const SWFMatrix &mat)
 Draws a glyph (font character). More...
 
void set_context (cairo_t *context)
 
unsigned int getBitsPerPixel () const
 
bool getPixel (rgba &color_return, int x, int y) const
 
bool initTestBuffer (unsigned width, unsigned height)
 
- Public Member Functions inherited from gnash::Renderer
 Renderer ()
 
virtual ~Renderer ()
 
void setQuality (Quality q)
 
virtual void renderToImage (std::unique_ptr< IOChannel >, FileType, int) const
 Draw the current rendering buffer to an image file. More...
 
geometry::Range2d< int > world_to_pixel (const geometry::Range2d< int > &wb) const
 
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 RenderImages::const_iterator getFirstRenderImage () const
 
virtual RenderImages::const_iterator getLastRenderImage () const
 

Additional Inherited Members

- Public Types inherited from gnash::Renderer
typedef std::shared_ptr< GnashVaapiImageProxyRenderImage
 
typedef std::vector< RenderImageRenderImages
 
- Protected Attributes inherited from gnash::Renderer
Quality _quality
 Kept in parallel with movie_root's setting. More...
 
RenderImages _render_images
 

Constructor & Destructor Documentation

§ Renderer_cairo()

gnash::Renderer_cairo::Renderer_cairo ( )

Implementation of Renderer_cairo class.

Referenced by gnash::renderer::cairo::create_handler().

§ ~Renderer_cairo()

gnash::Renderer_cairo::~Renderer_cairo ( )

Member Function Documentation

§ add_path()

void gnash::Renderer_cairo::add_path ( cairo_t *  cr,
const Path cur_path 
)

§ add_paths()

void gnash::Renderer_cairo::add_paths ( const PathVec path_vec)

References add_path().

Referenced by end_submit_mask().

§ apply_line_style()

void gnash::Renderer_cairo::apply_line_style ( const LineStyle style,
const SWFCxForm cx,
const SWFMatrix mat 
)

§ apply_matrix_to_paths()

void gnash::Renderer_cairo::apply_matrix_to_paths ( std::vector< Path > &  paths,
const SWFMatrix mat 
)

Takes a path and translates it using the given SWFMatrix.

References gnash::key::_1, gnash::renderer::opengl::for_each(), and gnash::Path::transform().

Referenced by drawShape().

§ begin_display()

void gnash::Renderer_cairo::begin_display ( const rgba background_color,
int  viewport_width,
int  viewport_height,
float  x0,
float  x1,
float  y0,
float  y1 
)
virtual

Bracket the displaying of a frame from a movie.

Set up to render a full frame from a movie and fills the background. Sets up necessary transforms, to scale the movie to fit within the given dimensions. Call end_display() when you're done. Most of the arguments are only for the ogl renderer. See documentation in that class. Do not use these arguments for new renderers!

Implements gnash::Renderer.

References gnash::geometry::Range2d< T >::getMaxX(), gnash::geometry::Range2d< T >::getMaxY(), gnash::geometry::Range2d< T >::getMinX(), gnash::geometry::Range2d< T >::getMinY(), gnash::geometry::SnappingRanges2d< T >::getRange(), gnash::geometry::Range2d< T >::isNull(), gnash::geometry::Range2d< T >::isWorld(), gnash::rgba::m_a, set_color(), gnash::geometry::SnappingRanges2d< T >::size(), x, and y.

§ begin_submit_mask()

void gnash::Renderer_cairo::begin_submit_mask ( )
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.  

Implements gnash::Renderer.

§ createCachedBitmap()

CachedBitmap * gnash::Renderer_cairo::createCachedBitmap ( std::unique_ptr< image::GnashImage im)
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.

Implements gnash::Renderer.

References gnash::image::TYPE_RGB, and gnash::image::TYPE_RGBA.

§ description()

std::string gnash::Renderer_cairo::description ( ) const
inlinevirtual

Return a description of this renderer.

Implements gnash::Renderer.

References gnash::key::c, x, and y.

§ disable_mask()

void gnash::Renderer_cairo::disable_mask ( )
virtual

Implements gnash::Renderer.

§ draw_mask()

void gnash::Renderer_cairo::draw_mask ( const PathVec path_vec)

Referenced by drawShape().

§ draw_outlines()

void gnash::Renderer_cairo::draw_outlines ( const PathVec path_vec,
const std::vector< LineStyle > &  line_styles,
const SWFCxForm cx,
const SWFMatrix mat 
)

References add_path(), and apply_line_style().

Referenced by draw_subshape().

§ draw_poly()

void gnash::Renderer_cairo::draw_poly ( const std::vector< point > &  corners,
const rgba fill,
const rgba outline,
const SWFMatrix mat,
bool  masked 
)
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.

Implements gnash::Renderer.

References gnash::rgba::m_a, set_color(), x, and y.

§ draw_subshape()

void gnash::Renderer_cairo::draw_subshape ( const PathVec path_vec,
const SWFMatrix mat,
const SWFCxForm cx,
const std::vector< FillStyle > &  FillStyles,
const std::vector< LineStyle > &  line_styles 
)

References draw_outlines().

Referenced by drawGlyph(), and drawShape().

§ drawGlyph()

void gnash::Renderer_cairo::drawGlyph ( const SWF::ShapeRecord rec,
const rgba color,
const SWFMatrix mat 
)
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

Implements gnash::Renderer.

References draw_subshape(), gnash::SWF::ShapeRecord::getBounds(), gnash::SWFRect::is_null(), and gnash::SWF::ShapeRecord::subshapes().

§ drawLine()

void gnash::Renderer_cairo::drawLine ( const std::vector< point > &  coords,
const rgba color,
const SWFMatrix mat 
)
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.

Implements gnash::Renderer.

References gnash::key::e, gnash::key::i, set_color(), x, and y.

§ drawShape()

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

§ drawVideoFrame()

void gnash::Renderer_cairo::drawVideoFrame ( image::GnashImage frame,
const Transform xform,
const SWFRect bounds,
bool  smooth 
)
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.

Implements gnash::Renderer.

References _, gnash::Renderer::_quality, gnash::SWFRect::get_x_min(), gnash::SWFRect::get_y_min(), gnash::geometry::Range2d< T >::getMinX(), gnash::geometry::Range2d< T >::getMinY(), gnash::SWFRect::getRange(), gnash::key::h, gnash::SWFRect::height(), gnash::image::GnashImage::height(), gnash::geometry::Range2d< T >::height(), gnash::log_error(), LOG_ONCE, gnash::Transform::matrix, gnash::QUALITY_BEST, gnash::QUALITY_HIGH, gnash::QUALITY_LOW, gnash::QUALITY_MEDIUM, gnash::SWFMatrix::transform(), gnash::image::GnashImage::type(), gnash::image::TYPE_RGBA, test::w, gnash::SWFRect::width(), gnash::image::GnashImage::width(), and gnash::geometry::Range2d< T >::width().

§ end_display()

void gnash::Renderer_cairo::end_display ( )
virtual

Implements gnash::Renderer.

§ end_submit_mask()

void gnash::Renderer_cairo::end_submit_mask ( )
virtual

Implements gnash::Renderer.

References add_paths().

§ endInternalRender()

virtual void gnash::Renderer_cairo::endInternalRender ( )
inlinevirtual

Finish internal rendering.

Any rendering after this function has been called must apply to the external buffer.

Implements gnash::Renderer.

References color, gnash::renderer::DirectFB::create_handler(), fill, height, gnash::renderer::cairo::set_context(), and width.

§ find_subshapes()

std::vector<PathVec::const_iterator> gnash::Renderer_cairo::find_subshapes ( const PathVec path_vec)

§ getBitsPerPixel()

unsigned int gnash::Renderer_cairo::getBitsPerPixel ( ) const

§ getPixel()

bool gnash::Renderer_cairo::getPixel ( rgba color_return,
int  x,
int  y 
) const

§ initTestBuffer()

bool gnash::Renderer_cairo::initTestBuffer ( unsigned  width,
unsigned  height 
)

References set_context().

§ pixel_to_world()

point gnash::Renderer_cairo::pixel_to_world ( int  x,
int  y 
) const
virtual

Converts pixel coordinates to world coordinates (TWIPS)

Implements gnash::Renderer.

References x, and y.

§ set_antialiased()

void gnash::Renderer_cairo::set_antialiased ( bool  enable)

§ set_color()

void gnash::Renderer_cairo::set_color ( const rgba c)

§ set_context()

void gnash::Renderer_cairo::set_context ( cairo_t *  context)

§ set_invalidated_regions()

void gnash::Renderer_cairo::set_invalidated_regions ( const InvalidatedRanges )
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 from gnash::Renderer.

§ set_scale()

void gnash::Renderer_cairo::set_scale ( float  ,
float   
)
virtual

Sets the x/y scale for the movie.

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

Interfaces for adjusting renderer output.

Reimplemented from gnash::Renderer.

§ set_translation()

void gnash::Renderer_cairo::set_translation ( float  ,
float   
)
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 from gnash::Renderer.

§ startInternalRender()

virtual Renderer* gnash::Renderer_cairo::startInternalRender ( image::GnashImage buffer)
inlinevirtual

Setup the renderer to draw to an internal buffer.

Implementations are free to return a new renderer if they choose.

Returns
0 if the renderer does not support this.

Implements gnash::Renderer.

§ world_to_pixel()

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

Converts world coordinates to pixel coordinates.

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

Interface for querying the renderer.

Implements gnash::Renderer.

References gnash::SWFRect::get_x_max(), gnash::SWFRect::get_x_min(), gnash::SWFRect::get_y_max(), and gnash::SWFRect::get_y_min().


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