20130313
[gdash.git] / src / gfx / screen.hpp
blob251525c590e5d83560809141691eb850ecfcc539
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #ifndef _GD_GFX_SCREEN
17 #define _GD_GFX_SCREEN
19 #include "config.h"
21 class GdColor;
22 class ParticleSet;
24 #include "gfx/pixmap.hpp"
26 /// @ingroup Graphics
27 /// A class which represents a screen (or a drawing area in a window) to draw pixmaps to.
28 class Screen {
29 protected:
30 int w, h;
31 virtual void configure_size() = 0;
33 public:
34 Screen(): w(0), h(0) {}
35 virtual ~Screen() {}
36 void set_size(int w, int h);
37 virtual void reinit();
38 int get_width() const { return w; }
39 int get_height() const { return h; }
41 virtual void set_title(char const *title) = 0;
43 virtual void fill_rect(int x, int y, int w, int h, const GdColor& c)=0;
44 void fill(const GdColor &c) {
45 fill_rect(0, 0, get_width(), get_height(), c);
48 virtual void blit_full(Pixmap const &src, int dx, int dy, int x, int y, int w, int h) const=0;
49 void blit(Pixmap const &src, int dx, int dy) const { blit_full(src, dx, dy, 0, 0, src.get_width(), src.get_height()); }
51 virtual void set_clip_rect(int x1, int y1, int w, int h)=0;
52 virtual void remove_clip_rect()=0;
54 virtual void draw_particle_set(int dx, int dy, ParticleSet const &ps) {}
56 /**
57 * Signal the screen that drawing begins.
59 virtual void start_drawing();
61 /**
62 * Copies the contents of the drawing back buffer of the screen. To be called
63 * when drawing is finished.
65 virtual void flip();
68 #endif