]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/scout-gfx/include/png_image
update
[l4.git] / l4 / pkg / scout-gfx / include / png_image
1 // vi:ft=cpp
2 /*
3  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  */
10 #pragma once
11
12 #include <l4/scout-gfx/widget>
13 #include <l4/mag-gfx/texture>
14
15 namespace Scout_gfx {
16
17 /**
18  * PNG Image
19  */
20 class Png_image : public Widget
21 {
22 private:
23
24   void            *_png_data;
25   Mag_gfx::Texture *_texture;
26
27 public:
28
29   /**
30    * Constructor
31    */
32   explicit Png_image(void *png_data)
33     : _png_data(png_data), _texture(0)
34   {}
35
36   /**
37    * Accessor functions
38    */
39   inline void *png_data() const { return _png_data; }
40
41   /**
42    * Element interface
43    */
44   void fill_cache(Mag_gfx::Pixel_info const *);
45   void flush_cache(Mag_gfx::Pixel_info const *);
46   void draw(Canvas *c, Point const &p);
47
48
49   Area min_size() const { return _size; }
50   Area preferred_size() const { return _size; }
51   Area max_size() const { return _size; }
52   bool empty() const { return false; }
53   Orientations expanding() const { return 0; }
54   void set_geometry(Rect const &s) { _pos = s.p1(); }
55 };
56
57 }