blob: 26cf9e1df777b15059a1f57555dfb65279f9b1fe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package qtrees;
import java.io.IOException;
import java.io.Writer;
/**
* Representation of a node in a QTree
* @author Sjaak Smetsers
* @author Camil Staps, s4498062
*
* Note: the version by Sjaak Smetsers contained a sameLeaf method. This seems to be reduntant though, so I removed it.
*/
public abstract class QTNode {
/**
* Fill a (part of a) bitmap with this node
* @param x the x coordinate of the top left corner
* @param y the y coordinate of the top left corner
* @param width the width of the part of the bitmap to fill
* @param bitmap the bitmap to fill
*/
public abstract void fillBitmap( int x, int y, int width, Bitmap bitmap );
/**
* Write a node as bitstream
* @param out Writer to write to
* @throws IOException is passed on from Writer
*/
public abstract void writeNode( Writer out ) throws IOException;
/**
* Fill a complete area of a bitmap with a particular value
* @param x the x coordinate of the top left corner
* @param y the y coordinate of the top left corner
* @param width the width (and height) of the area to fill
* @param bitmap the bitmap to fill
* @param val the value to fill the area with
*/
public static void fillArea( int x, int y, int width, Bitmap bitmap, boolean val ){
for (int i = 0; i < width; i++) {
for (int j = 0; j < width; j++) {
bitmap.setBit(x+i, y+j, val);
}
}
}
}
|