Gnash  0.8.11dev
OpenVGBitmap.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_OPENVG_BITMAP_H
20 #define GNASH_OPENVG_BITMAP_H
21 
22 #include "Geometry.h"
23 #include "CachedBitmap.h"
24 #include "GnashImage.h"
25 #include "Renderer.h"
26 #include "FillStyle.h"
27 #include "openvg/OpenVGRenderer.h"
28 
29 namespace gnash {
30 
31 class SWFCxForm;
32 
33 namespace renderer {
34 
35 namespace openvg {
36 
39 class OpenVGBitmap : public CachedBitmap
40 {
41 public:
44 
45  OpenVGBitmap(VGPaint paint);
46  OpenVGBitmap(CachedBitmap *bitmap, VGPaint vgpaint);
47  OpenVGBitmap(image::GnashImage *im, VGPaint vgpaint);
48  ~OpenVGBitmap();
49 
50  void dispose() { _image.reset(); }
51  bool disposed() const { return !_image.get(); }
52 
54  assert(!disposed());
55  return *_image;
56  };
57  VGPaint &vgimage() { return _vgimage; };
58 
59  // Accessors for the GnashImage internal data
60  VGPaint getFillPaint() const { return _vgpaint; }
61  int getWidth() { return _image->width(); }
62  int getHeight() { return _image->height(); }
63  std::uint8_t *getData() const { return _image->begin(); }
64 
65  OpenVGBitmap *createRadialBitmap(float x0, float y0, float x1, float y1,
66  float radial, const SWFCxForm& cx,
67  const GradientFill::GradientRecords &records,
68  VGPaint paint);
69  OpenVGBitmap *createLinearBitmap(float x0, float y0, float x1, float y1,
70  const SWFCxForm& cx,
71  const GradientFill::GradientRecords &records,
72  const VGPaint paint);
73 
75  bitmap_wrap_mode mode,
76  CachedBitmap *bitmap, VGPaint paint);
77 
78 private:
79  std::unique_ptr<image::GnashImage> _image;
80  VGImageFormat _pixel_format;
81  VGImage _vgimage;
82  VGPaint _vgpaint;
83  double _aspect_ratio;
84 };
85 
86 } // namespace gnash::renderer::openvg
87 } // namespace gnash::renderer
88 } // namespace gnash
89 
90 #endif // __RENDER_OPENVG_BITMAP_H__
91 
92 // local Variables:
93 // mode: C++
94 // indent-tabs-mode: nil
95 // End:
gnash::renderer::openvg::OpenVGBitmap::bitmap_wrap_mode
bitmap_wrap_mode
Set line and fill styles for mesh & line_strip rendering.
Definition: OpenVGBitmap.h:43
OpenVGRenderer.h
gnash::SWFCxForm::transform
rgba transform(const rgba &in) const
Transform the given color, return the result.
Definition: SWFCxForm.cpp:49
gnash::image::GnashImage::width
size_t width() const
Get the image's width.
Definition: GnashImage.h:126
gnash::image::GnashImage::stride
virtual size_t stride() const
Get the pitch of the image buffer.
Definition: GnashImage.h:112
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
gnash::key::i
@ i
Definition: GnashKey.h:155
gnash::rgba
A basic RGBA type.
Definition: RGBA.h:36
gnash::renderer::openvg::OpenVGBitmap::~OpenVGBitmap
~OpenVGBitmap()
Definition: OpenVGBitmap.cpp:127
gnash::SWFMatrix::invert
SWFMatrix & invert()
Invert this SWFMatrix and return the result.
Definition: SWFMatrix.cpp:288
_
#define _(String)
Definition: log.h:44
Renderer.h
Geometry.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::renderer::openvg::OpenVGBitmap::dispose
void dispose()
Free the memory associated with this CachedBitmap.
Definition: OpenVGBitmap.h:50
gnash::image::GnashImage
Base class for different types of bitmaps.
Definition: GnashImage.h:78
GNASH_REPORT_FUNCTION
#define GNASH_REPORT_FUNCTION
Definition: log.h:452
gnash::renderer::openvg::OpenVGBitmap::createLinearBitmap
OpenVGBitmap * createLinearBitmap(float x0, float y0, float x1, float y1, const SWFCxForm &cx, const GradientFill::GradientRecords &records, const VGPaint paint)
Definition: OpenVGBitmap.cpp:209
gnash::renderer::openvg::OpenVGBitmap::disposed
bool disposed() const
Whether the CachedBitmap has been disposed.
Definition: OpenVGBitmap.h:51
gnash::SWFCxForm
Color transformation record.
Definition: SWFCxForm.h:35
gnash::SWFMatrix::c
std::int32_t c() const
Definition: SWFMatrix.h:87
GnashImage.h
SWFCxForm.h
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::image::GnashImage::type
ImageType type() const
Return the ImageType of the image.
Definition: GnashImage.h:91
gnash::CachedBitmap::image
virtual image::GnashImage & image()=0
Return a GnashImage for manipulation.
gnash::renderer::openvg::OpenVGBitmap::getHeight
int getHeight()
Definition: OpenVGBitmap.h:62
CachedBitmap.h
OpenVGBitmap.h
color
const VGfloat color[4]
Definition: testr_gtk.cpp:82
gnash::SWFMatrix::a
std::int32_t a() const
Definition: SWFMatrix.h:79
gnash::SWFMatrix::d
std::int32_t d() const
Definition: SWFMatrix.h:91
gnash::SWFMatrix::b
std::int32_t b() const
Definition: SWFMatrix.h:83
gnash::renderer::openvg::OpenVGBitmap::OpenVGBitmap
OpenVGBitmap(VGPaint paint)
Definition: OpenVGBitmap.cpp:41
gnash::renderer::openvg::OpenVGBitmap::vgimage
VGPaint & vgimage()
Definition: OpenVGBitmap.h:57
gnash::SWFMatrix::tx
std::int32_t tx() const
Definition: SWFMatrix.h:95
gnash::renderer::openvg::OpenVGBitmap::WRAP_PAD
@ WRAP_PAD
Definition: OpenVGBitmap.h:43
gnash::renderer::openvg::OpenVGBitmap::WRAP_FILL
@ WRAP_FILL
Definition: OpenVGBitmap.h:43
gnash::renderer::openvg::OpenVGBitmap::applyPatternBitmap
OpenVGBitmap * applyPatternBitmap(const gnash::SWFMatrix &matrix, bitmap_wrap_mode mode, CachedBitmap *bitmap, VGPaint paint)
Definition: OpenVGBitmap.cpp:272
gnash::GradientFill::GradientRecords
std::vector< GradientRecord > GradientRecords
Definition: FillStyle.h:176
gnash::renderer::openvg::OpenVGBitmap::getWidth
int getWidth()
Definition: OpenVGBitmap.h:61
gnash::SWFMatrix
Definition: SWFMatrix.h:54
gnash::key::j
@ j
Definition: GnashKey.h:156
paint
VGPaint paint
Definition: testr_gtk.cpp:85
gnash::renderer::openvg::OpenVGBitmap::WRAP_REFLECT
@ WRAP_REFLECT
Definition: OpenVGBitmap.h:43
gnash::renderer::openvg::OpenVGBitmap
Definition: OpenVGBitmap.h:40
gnash::renderer::openvg::OpenVGBitmap::image
image::GnashImage & image()
Return a GnashImage for manipulation.
Definition: OpenVGBitmap.h:53
gnash::renderer::openvg::OpenVGBitmap::getData
std::uint8_t * getData() const
Definition: OpenVGBitmap.h:63
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::image::TYPE_RGB
@ TYPE_RGB
Definition: GnashImage.h:49
gnash::renderer::openvg::OpenVGBitmap::createRadialBitmap
OpenVGBitmap * createRadialBitmap(float x0, float y0, float x1, float y1, float radial, const SWFCxForm &cx, const GradientFill::GradientRecords &records, VGPaint paint)
Definition: OpenVGBitmap.cpp:154
gnash::image::GnashImage::begin
virtual iterator begin()
Access the raw data.
Definition: GnashImage.h:154
gnash::SWFMatrix::ty
std::int32_t ty() const
Definition: SWFMatrix.h:99
gnash::renderer::openvg::OpenVGBitmap::getFillPaint
VGPaint getFillPaint() const
Definition: OpenVGBitmap.h:60
FillStyle.h
gnash::renderer::openvg::OpenVGBitmap::WRAP_REPEAT
@ WRAP_REPEAT
Definition: OpenVGBitmap.h:43
gnash::CachedBitmap
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:38
gnash::renderer::openvg::Renderer_ovg::getErrorString
static const char * getErrorString(VGErrorCode error)
Definition: OpenVGRenderer.cpp:1583
gnash::image::TYPE_RGBA
@ TYPE_RGBA
Definition: GnashImage.h:50
gnash::image::GnashImage::height
size_t height() const
Get the image's width.
Definition: GnashImage.h:133