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:
VGPaint & vgimage()
Definition: OpenVGBitmap.h:57
OpenVGBitmap * createLinearBitmap(float x0, float y0, float x1, float y1, const SWFCxForm &cx, const GradientFill::GradientRecords &records, const VGPaint paint)
Definition: OpenVGBitmap.cpp:209
Definition: SWFMatrix.h:53
OpenVGBitmap * applyPatternBitmap(const gnash::SWFMatrix &matrix, bitmap_wrap_mode mode, CachedBitmap *bitmap, VGPaint paint)
Definition: OpenVGBitmap.cpp:272
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
~OpenVGBitmap()
Definition: OpenVGBitmap.cpp:127
Color transformation record.
Definition: SWFCxForm.h:34
VGPaint getFillPaint() const
Definition: OpenVGBitmap.h:60
std::uint8_t * getData() const
Definition: OpenVGBitmap.h:63
bitmap_wrap_mode
Set line and fill styles for mesh & line_strip rendering.
Definition: OpenVGBitmap.h:43
void dispose()
Free the memory associated with this CachedBitmap.
Definition: OpenVGBitmap.h:50
bool disposed() const
Whether the CachedBitmap has been disposed.
Definition: OpenVGBitmap.h:51
Definition: OpenVGBitmap.h:39
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
Base class for different types of bitmaps.
Definition: GnashImage.h:77
std::vector< GradientRecord > GradientRecords
Definition: FillStyle.h:176
image::GnashImage & image()
Return a GnashImage for manipulation.
Definition: OpenVGBitmap.h:53
OpenVGBitmap(VGPaint paint)
Definition: OpenVGBitmap.cpp:41
int getHeight()
Definition: OpenVGBitmap.h:62
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:37
int getWidth()
Definition: OpenVGBitmap.h:61
VGPaint paint
Definition: testr_gtk.cpp:85