f420875dfce0def8a76759d1a716a721fa95e74e
[org.ibex.core.git] / src / org / xwt / DoubleBuffer.java
1 // Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL]
2 package org.xwt;
3
4 /**
5  *  <p>
6  *  A block of pixels which can be drawn on and rapidly copied to the
7  *  screen. Drawing operations are performed on this class; it is
8  *  then rendered to the screen with Surface.blit().
9  *  </p>
10  *
11  *  <p>
12  *  Implementations of the Platform class should return objects
13  *  supporting this interface from the _createDoubleBuffer()
14  *  method. These implementations may choose to use off-screen video
15  *  ram for this purpose (for example, a Pixmap on X11).
16  *  </p>
17  *
18  *  <p>
19  *  A note on coordinates: all members on DoubleBuffer specify
20  *  coordinates in terms of x1,y1,x2,y2 even though the Box class
21  *  represents regions internally as x,y,w,h.
22  *  </p>
23  */
24 public abstract class DoubleBuffer {
25
26     /** Draw the region of source within (sx1, sy1, sx2, sy2) onto the region of this DoubleBuffer within (dx1, dy1, dx2, dy2), scaling as needed. */
27     public abstract void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2);
28
29     /** Draw source onto this DoubleBuffer at (x,y) */
30     public abstract void drawPicture(Picture source, int x, int y);
31
32     /** Draw <tt>text</tt> in <tt>font</tt> and <tt>color</tt> on this DoubleBuffer, with the upper left corner of the text at (x, y) */
33     public abstract void drawString(String font, String text, int x, int y, int color);
34
35     /** Fill the region (x1, y1, x2, y2) with <tt>color</tt> (AARRGGBB format); the alpha channel component is ignored */
36     public abstract void fillRect(int x1, int y1, int x2, int y2, int color);
37
38     /** Sets the clip region for this DoubleBuffer to (x,y,x2,y2) */
39     public abstract void setClip(int x, int y, int x2, int y2);
40
41     public abstract int getHeight();
42     public abstract int getWidth();
43 }