1
0
mirror of synced 2026-04-13 23:53:51 +00:00

*** empty log message ***

This commit is contained in:
Eric Smith
2001-12-27 11:17:28 +00:00
parent 52c945f753
commit 6677da8362
3 changed files with 35 additions and 15 deletions

View File

@@ -72,9 +72,7 @@ Bitmap *bitblt (Bitmap *src_bitmap,
Rect src_rect,
Bitmap *dest_bitmap,
Point dest_upper_left,
boolean flip_horizontal,
boolean flip_vertical,
boolean transpose,
int scan,
int tfn)
{
Point src_point, dest_point;
@@ -82,7 +80,7 @@ Bitmap *bitblt (Bitmap *src_bitmap,
if (! dest_bitmap)
{
if (transpose)
if (scan & TRANSPOSE)
dest_bitmap = create_bitmap (rect_height (src_rect),
rect_width (src_rect));
else
@@ -102,17 +100,32 @@ Bitmap *bitblt (Bitmap *src_bitmap,
{
boolean a, b, c;
if (transpose)
if (scan & TRANSPOSE)
{
dest_point.x = dest_upper_left.x + (src_point.y - src_rect.upper_left.y);
dest_point.y = dest_upper_left.y + (src_point.x - src_rect.upper_left.x);
dest_point.x = src_point.y - src_rect.upper_left.y;
dest_point.y = src_point.x - src_rect.upper_left.x;
if (scan & FLIP_H)
dest_point.x = (rect_height (src_rect) - 1) - dest_point.x;
if (scan & FLIP_V)
dest_point.y = (rect_width (src_rect) - 1) - dest_point.y;
}
else
{
dest_point.x = dest_upper_left.x + (src_point.x - src_rect.upper_left.x);
dest_point.y = dest_upper_left.y + (src_point.y - src_rect.upper_left.y);
dest_point.x = src_point.x - src_rect.upper_left.x;
dest_point.y = src_point.y - src_rect.upper_left.y;
if (scan & FLIP_H)
dest_point.x = (rect_width (src_rect) - 1) - dest_point.x;
if (scan & FLIP_V)
dest_point.y = (rect_height (src_rect) - 1) - dest_point.y;
}
dest_point.x += dest_upper_left.x;
dest_point.y += dest_upper_left.y;
a = get_pixel (src_bitmap, src_point);
b = get_pixel (dest_bitmap, dest_point);
c = (tfn & (1 << (a * 2 + b))) != 0;

View File

@@ -29,6 +29,16 @@ typedef struct Bitmap
#define TF_XOR 0x6
#define FLIP_H 0x1
#define FLIP_V 0x2
#define TRANSPOSE 0x4
#define ROT_0 0x0
#define ROT_90 (TRANSPOSE + FLIP_H)
#define ROT_180 (FLIP_H + FLIP_V)
#define ROT_270 (TRANSPOSE + FLIP_V)
Bitmap *create_bitmap (u32 width, u32 height);
void free_bitmap (Bitmap *bitmap);
boolean get_pixel (Bitmap *bitmap, Point coord);
@@ -38,7 +48,5 @@ Bitmap *bitblt (Bitmap *src_bitmap,
Rect src_rect,
Bitmap *dest_bitmap,
Point dest_upper_left,
boolean flip_horizontal,
boolean flip_vertical,
boolean transpose,
int scan,
int tfn);

View File

@@ -16,7 +16,7 @@ char test_data [HEIGHT][WIDTH] =
".....X....X...X.....",
".....X.....X..X.....",
".....XXXXXXXXXX.....",
".....XXXXXXXXXX....."
".....X.X.X.X.X......"
};
Bitmap *setup (void)
@@ -82,8 +82,7 @@ int main (int argc, char *argv[])
b2 = bitblt (b, r,
NULL, p,
0, 0,
1, /* transpose */
ROT_90,
TF_SRC);
if (! b2)
{