Go to the documentation of this file.
19 #ifndef RENDER_HANDLER_H
20 #define RENDER_HANDLER_H
145 #include <boost/noncopyable.hpp>
170 class GnashVaapiImageProxy;
265 virtual void drawLine(
const std::vector<point>& coords,
282 virtual void draw_poly(
const std::vector<point>& corners,
319 log_debug(
_(
"Rendering to image not implemented for this "
354 {
return _render_images.begin(); }
358 {
return _render_images.end(); }
402 point topleft = pixel_to_world(
404 point bottomright = pixel_to_world(
408 bottomright.
x, bottomright.
y);
441 virtual bool getPixel(
rgba& ,
int ,
int )
const {
443 log_debug(
"getPixel() not implemented for this renderer");
448 void addRenderImage(std::shared_ptr<GnashVaapiImageProxy> image) {
449 _render_images.push_back(image);
462 virtual bool getAveragePixel(rgba& color_return,
int x,
int y,
463 unsigned int radius)
const
469 if (radius==1)
return getPixel(color_return,
x,
y);
471 unsigned int r=0,
g=0,
b=0,
a=0;
481 for (
int yp=
y; yp<ye; yp++)
482 for (
int xp=
x; xp<xe; xp++)
484 if (!getPixel(pixel, xp, yp))
493 int pcount = radius*radius;
494 color_return.m_r =
r / pcount;
495 color_return.m_g =
g / pcount;
496 color_return.m_b =
b / pcount;
497 color_return.m_a =
a / pcount;
522 virtual bool initTestBuffer(
unsigned ,
unsigned ) {
533 virtual unsigned int getBitsPerPixel()
const {
547 float x0 = 0,
float x1 = 0,
float y0 = 0,
float y1 = 0)
551 _r.begin_display(
c,
w,
h, x0, x1, y0, y1);
569 _ext(_r.startInternalRender(im))
578 _r.endInternalRender();
604 virtual void begin_display(
const rgba& background_color,
605 int viewport_width,
int viewport_height,
606 float x0,
float x1,
float y0,
float y1) = 0;
608 virtual void end_display() = 0;
621 virtual void endInternalRender() = 0;
External(Renderer &r, const rgba &c, int w=0, int h=0, float x0=0, float x1=0, float y0=0, float y1=0)
Prepare the renderer for external rendering.
Definition: Renderer.h:546
virtual void set_invalidated_regions(const InvalidatedRanges &)
Sets the update region (called prior to begin_display).
Definition: Renderer.h:340
~External()
Definition: Renderer.h:554
Definition: Renderer.h:540
T getMaxY() const
Get max Y ordinate.
Definition: Range2d.h:633
RenderImages _render_images
Definition: Renderer.h:592
std::shared_ptr< GnashVaapiImageProxy > RenderImage
Definition: Renderer.h:349
void log_debug(StringType msg, Args... args)
Definition: log.h:301
std::int32_t y
Definition: BitmapData_as.cpp:435
Definition: Renderer.h:563
A basic RGBA type.
Definition: RGBA.h:36
virtual std::string description() const =0
Return a description of this renderer.
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.
#define _(String)
Definition: log.h:44
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
T getMaxX() const
Get max X ordinate.
Definition: Range2d.h:613
Renderer * renderer() const
Definition: Renderer.h:573
@ g
Definition: GnashKey.h:153
virtual CachedBitmap * createCachedBitmap(std::unique_ptr< image::GnashImage > im)=0
Given an image, returns a pointer to a CachedBitmap class that can later be passed to FillStyleX_bitm...
Base class for different types of bitmaps.
Definition: GnashImage.h:78
FileType
Definition: GnashEnums.h:25
geometry::Range2d< int > world_to_pixel(const geometry::Range2d< int > &wb) const
Definition: Renderer.h:388
Base class for render handlers.
Definition: Renderer.h:189
T getMinX() const
Get min X ordinate.
Definition: Range2d.h:603
std::vector< RenderImage > RenderImages
Definition: Renderer.h:350
virtual void disable_mask()=0
virtual void set_scale(float, float)
Sets the x/y scale for the movie
Definition: Renderer.h:204
bool isNull() const
Returns true if this is the NULL Range2d.
Definition: Range2d.h:181
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
geometry::Range2d< int > pixel_to_world(const geometry::Range2d< int > &pixelbounds) const
Definition: Renderer.h:399
virtual void set_translation(float, float)
Definition: Renderer.h:209
const VGfloat color[4]
Definition: testr_gtk.cpp:82
@ r
Definition: GnashKey.h:164
bool isWorld() const
Returns true if this is the WORLD Range2d.
Definition: Range2d.h:200
~Internal()
Definition: Renderer.h:577
VGPaint fill
Definition: testr_gtk.cpp:86
@ a
Definition: GnashKey.h:147
std::int32_t x
The x coordinate.
Definition: Point2d.h:43
Quality _quality
Kept in parallel with movie_root's setting.
Definition: Renderer.h:589
virtual RenderImages::const_iterator getFirstRenderImage() const
Definition: Renderer.h:353
virtual void drawGlyph(const SWF::ShapeRecord &rec, const rgba &color, const SWFMatrix &mat)=0
Draws a glyph (font character).
virtual geometry::Range2d< int > world_to_pixel(const SWFRect &worldbounds) const =0
Converts world coordinates to pixel coordinates.
T getMinY() const
Get min Y ordinate.
Definition: Range2d.h:623
virtual void drawVideoFrame(image::GnashImage *frame, const Transform &xform, const SWFRect *bounds, bool smooth)=0
Draws a video frame.
@ h
Definition: GnashKey.h:154
virtual void renderToImage(std::unique_ptr< IOChannel >, FileType, int) const
Draw the current rendering buffer to an image file.
Definition: Renderer.h:316
virtual ~Renderer()
Definition: Renderer.h:194
@ q
Definition: GnashKey.h:163
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.
Definition: SWFMatrix.h:54
2D Point class
Definition: Point2d.h:39
virtual point pixel_to_world(int x, int y) const =0
Converts pixel coordinates to world coordinates (TWIPS)
@ QUALITY_HIGH
Definition: GnashEnums.h:38
virtual void drawShape(const SWF::ShapeRecord &shape, const Transform &xform)=0
virtual void end_submit_mask()=0
@ c
Definition: GnashKey.h:149
void setQuality(Quality q)
Definition: Renderer.h:211
virtual void begin_submit_mask()=0
Renderer()
Definition: Renderer.h:192
#define DSOEXPORT
Definition: dsodefs.h:55
std::int32_t y
The y coordinate.
Definition: Point2d.h:46
Quality
Definition: GnashEnums.h:35
Holds information needed to draw a shape.
Definition: ShapeRecord.h:127
@ SWF
Definition: GnashKey.h:331
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:38
std::int32_t x
Definition: BitmapData_as.cpp:434
Internal(Renderer &r, image::GnashImage &im)
Prepare the renderer for internal rendering.
Definition: Renderer.h:566
@ b
Definition: GnashKey.h:148
virtual RenderImages::const_iterator getLastRenderImage() const
Definition: Renderer.h:357
virtual bool bounds_in_clipping_area(const geometry::Range2d< int > &) const
Checks if the given bounds are (partially) in the current drawing clipping area.
Definition: Renderer.h:422