3 * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
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.
12 #include <l4/mag-gfx/geometry>
13 #include <l4/mag-gfx/gfx_colors>
27 Canvas(Area const &sz) : _clip(Point(0,0), sz), _size(sz) {}
28 virtual void flush_pixels(Rect const &) {}
31 enum Mix_mode { Solid, Mixed, Masked, Alpha };
33 void set_clipping(Rect const &c)
34 { _clip = Rect(Point(0,0), _size) & c; }
36 Rect const &clip() const { return _clip; }
37 bool clip_valid() const { return _clip.valid(); }
39 Area const &size() const { return _size; }
43 virtual Pixel_info const *type() const = 0;
44 virtual void draw_box(Rect const &rect, Rgba32::Color color) = 0;
45 virtual void draw_string(Point const &pos, Font const *f, Rgba32::Color color, char const *str, unsigned len = -1) = 0;
46 virtual void draw_texture(Texture const *src, Rgb32::Color mix_color, Point const &pos, Mix_mode mode) = 0;
48 virtual void *buffer() const = 0;
49 virtual void buffer(void *buffer) = 0;
50 virtual int bytes_per_line() const = 0;
52 void draw_rect(Rect const &r, Rgba32::Color color);