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  boost::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  boost::scoped_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: