]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/mag-gfx/include/texture
3f48e15295c139f06a0717f95c6f9272686484e8
[l4.git] / l4 / pkg / mag-gfx / include / texture
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/mag-gfx/geometry>
13 #include <l4/mag-gfx/gfx_colors>
14
15 namespace Mag_gfx {
16
17 class Texture
18 {
19 protected:
20   Area _size;
21   void *_pixels;
22   Pixel_info const *_type;
23
24   bool _extra_alpha;
25
26   Texture(Pixel_info const *type, void *pixels, Area const &size, bool xalpha)
27   : _size(size), _pixels(pixels), _type(type), _extra_alpha(xalpha) {}
28
29 public:
30   Pixel_info const *type() const { return _type; }
31   Area const &size() const { return _size; }
32   void size(Area const &s) { _size = s; }
33   void *pixels() { return _pixels; }
34   void const *pixels() const { return _pixels; }
35   void pixels(void *pixels) { _pixels = pixels; }
36
37   virtual void blit(Texture const *src, int start_line = 0) = 0;
38   bool extra_alpha() const { return _extra_alpha; }
39
40   virtual ~Texture() {}
41 };
42
43 }