Drawing functions take their color as a Color argument, instead of as separate r, g, and b arguments.
This paves the way for using draw operations with an alpha channel. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3369 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -303,7 +303,7 @@ FixContextFontEffect (void)
|
||||
RECT r = { {0, 0}, {w, h} };
|
||||
Color color = _get_context_fg_color ();
|
||||
|
||||
TFB_DrawImage_Rect (&r, color.r, color.g, color.b, img);
|
||||
TFB_DrawImage_Rect (&r, color, img);
|
||||
}
|
||||
|
||||
_pCurContext->FontBacking = img;
|
||||
|
||||
@@ -254,7 +254,7 @@ RotateFrame (FRAME Frame, int angle_deg)
|
||||
void
|
||||
SetFrameTransparentColor (FRAME Frame, Color color)
|
||||
{
|
||||
TFB_DrawCanvas_SetTransparentColor (Frame->image->NormalImg,
|
||||
color.r, color.g, color.b, FALSE);
|
||||
TFB_DrawCanvas_SetTransparentColor (Frame->image->NormalImg, color,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ enum
|
||||
typedef struct tfb_dc_line
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
int r, g, b;
|
||||
Color color;
|
||||
SCREEN destBuffer;
|
||||
} TFB_DrawCommand_Line;
|
||||
|
||||
typedef struct tfb_dc_rect
|
||||
{
|
||||
RECT rect;
|
||||
int r, g, b;
|
||||
Color color;
|
||||
SCREEN destBuffer;
|
||||
} TFB_DrawCommand_Rect;
|
||||
|
||||
@@ -70,7 +70,7 @@ typedef struct tfb_dc_filledimg
|
||||
{
|
||||
TFB_Image *image;
|
||||
int x, y;
|
||||
int r, g, b;
|
||||
Color color;
|
||||
SCREEN destBuffer;
|
||||
int scale;
|
||||
} TFB_DrawCommand_FilledImage;
|
||||
@@ -104,7 +104,7 @@ typedef struct tfb_dc_scissor
|
||||
typedef struct tfb_dc_setpal
|
||||
{
|
||||
int index;
|
||||
int r, g, b;
|
||||
Color color;
|
||||
} TFB_DrawCommand_SetPalette;
|
||||
|
||||
typedef struct tfb_dc_setmip
|
||||
|
||||
@@ -42,40 +42,42 @@ TFB_DrawCanvas_Initialize (void)
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_Line (int x1, int y1, int x2, int y2, int r, int g, int b, TFB_Canvas target)
|
||||
TFB_DrawCanvas_Line (int x1, int y1, int x2, int y2, Color color,
|
||||
TFB_Canvas target)
|
||||
{
|
||||
Uint32 color;
|
||||
Uint32 sdlColor;
|
||||
PutPixelFn screen_plot;
|
||||
|
||||
screen_plot = putpixel_for (target);
|
||||
color = SDL_MapRGB (((NativeCanvas) target)->format, r, g, b);
|
||||
sdlColor = SDL_MapRGB (((NativeCanvas) target)->format,
|
||||
color.r, color.g, color.b);
|
||||
|
||||
SDL_LockSurface ((NativeCanvas) target);
|
||||
line (x1, y1, x2, y2, color, screen_plot, (NativeCanvas) target);
|
||||
line (x1, y1, x2, y2, sdlColor, screen_plot, (NativeCanvas) target);
|
||||
SDL_UnlockSurface ((NativeCanvas) target);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_Rect (RECT *rect, int r, int g, int b, TFB_Canvas target)
|
||||
TFB_DrawCanvas_Rect (RECT *rect, Color color, TFB_Canvas target)
|
||||
{
|
||||
SDL_Surface *dst = target;
|
||||
SDL_PixelFormat *fmt = dst->format;
|
||||
Uint32 color;
|
||||
Uint32 sdlColor;
|
||||
SDL_Rect sr;
|
||||
sr.x = rect->corner.x;
|
||||
sr.y = rect->corner.y;
|
||||
sr.w = rect->extent.width;
|
||||
sr.h = rect->extent.height;
|
||||
|
||||
color = SDL_MapRGB (fmt, r, g, b);
|
||||
sdlColor = SDL_MapRGB (fmt, color.r, color.g, color.b);
|
||||
if (fmt->Amask && (dst->flags & SDL_SRCCOLORKEY))
|
||||
{ // special case -- alpha surface with colorkey
|
||||
// colorkey rects are transparent
|
||||
if ((color & ~fmt->Amask) == (fmt->colorkey & ~fmt->Amask))
|
||||
color &= ~fmt->Amask; // make transparent
|
||||
if ((sdlColor & ~fmt->Amask) == (fmt->colorkey & ~fmt->Amask))
|
||||
sdlColor &= ~fmt->Amask; // make transparent
|
||||
}
|
||||
|
||||
SDL_FillRect (dst, &sr, color);
|
||||
SDL_FillRect (dst, &sr, sdlColor);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -88,7 +90,8 @@ TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, int scale,
|
||||
|
||||
if (img == 0)
|
||||
{
|
||||
log_add (log_Warning, "ERROR: TFB_DrawCanvas_Image passed null image ptr");
|
||||
log_add (log_Warning,
|
||||
"ERROR: TFB_DrawCanvas_Image passed null image ptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -240,7 +243,8 @@ TFB_DrawCanvas_Fill (TFB_Canvas source, int width, int height,
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Canvas target)
|
||||
TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
Color color, TFB_Canvas target)
|
||||
{
|
||||
SDL_Rect srcRect, targetRect, *pSrcRect;
|
||||
SDL_Surface *surf;
|
||||
@@ -249,7 +253,8 @@ TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int
|
||||
|
||||
if (img == 0)
|
||||
{
|
||||
log_add (log_Warning, "ERROR: TFB_DrawCanvas_FilledImage passed null image ptr");
|
||||
log_add (log_Warning,
|
||||
"ERROR: TFB_DrawCanvas_FilledImage passed null image ptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,9 +311,9 @@ TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
pal[i].r = r;
|
||||
pal[i].g = g;
|
||||
pal[i].b = b;
|
||||
pal[i].r = color.r;
|
||||
pal[i].g = color.g;
|
||||
pal[i].b = color.b;
|
||||
}
|
||||
SDL_SetColors (surf, pal, 0, 256);
|
||||
// reflect the change in *actual* image palette
|
||||
@@ -338,19 +343,19 @@ TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int
|
||||
}
|
||||
|
||||
if (force_fill ||
|
||||
img->last_fill.r != r ||
|
||||
img->last_fill.g != g ||
|
||||
img->last_fill.b != b)
|
||||
img->last_fill.r != color.r ||
|
||||
img->last_fill.g != color.g ||
|
||||
img->last_fill.b != color.b)
|
||||
{ // image or fillcolor changed - regenerate
|
||||
TFB_DrawCanvas_Fill (surf, surf->w, surf->h,
|
||||
SDL_MapRGBA (newfill->format, r, g, b, 0), newfill);
|
||||
TFB_DrawCanvas_Fill (surf, surf->w, surf->h, SDL_MapRGBA (
|
||||
newfill->format, color.r, color.g, color.b, 0), newfill);
|
||||
// important to keep alpha=0 in fillcolor
|
||||
// -- we process alpha ourselves
|
||||
|
||||
// cache filled image if possible
|
||||
img->last_fill.r = r;
|
||||
img->last_fill.g = g;
|
||||
img->last_fill.b = b;
|
||||
img->last_fill.r = color.r;
|
||||
img->last_fill.g = color.g;
|
||||
img->last_fill.b = color.b;
|
||||
}
|
||||
|
||||
img->FilledImg = newfill;
|
||||
@@ -687,7 +692,8 @@ TFB_DrawCanvas_SetTransparentIndex (TFB_Canvas canvas, int index, BOOLEAN rleacc
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_CopyTransparencyInfo (TFB_Canvas src_canvas, TFB_Canvas dst_canvas)
|
||||
TFB_DrawCanvas_CopyTransparencyInfo (TFB_Canvas src_canvas,
|
||||
TFB_Canvas dst_canvas)
|
||||
{
|
||||
SDL_Surface* src = (SDL_Surface*)src_canvas;
|
||||
|
||||
@@ -699,14 +705,14 @@ TFB_DrawCanvas_CopyTransparencyInfo (TFB_Canvas src_canvas, TFB_Canvas dst_canva
|
||||
}
|
||||
else
|
||||
{
|
||||
int r, g, b;
|
||||
if (TFB_DrawCanvas_GetTransparentColor (src_canvas, &r, &g, &b))
|
||||
TFB_DrawCanvas_SetTransparentColor (dst_canvas, r, g, b, FALSE);
|
||||
Color color;
|
||||
if (TFB_DrawCanvas_GetTransparentColor (src_canvas, &color))
|
||||
TFB_DrawCanvas_SetTransparentColor (dst_canvas, color, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
TFB_DrawCanvas_GetTransparentColor (TFB_Canvas canvas, int *r, int *g, int *b)
|
||||
TFB_DrawCanvas_GetTransparentColor (TFB_Canvas canvas, Color *color)
|
||||
{
|
||||
if (!TFB_DrawCanvas_IsPaletted (canvas)
|
||||
&& (((SDL_Surface *)canvas)->flags & SDL_SRCCOLORKEY) )
|
||||
@@ -714,24 +720,26 @@ TFB_DrawCanvas_GetTransparentColor (TFB_Canvas canvas, int *r, int *g, int *b)
|
||||
Uint8 ur, ug, ub;
|
||||
int colorkey = ((SDL_Surface *)canvas)->format->colorkey;
|
||||
SDL_GetRGB (colorkey, ((SDL_Surface *)canvas)->format, &ur, &ug, &ub);
|
||||
*r = ur;
|
||||
*g = ug;
|
||||
*b = ub;
|
||||
color->r = ur;
|
||||
color->g = ug;
|
||||
color->b = ub;
|
||||
color->a = 0xff;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas, int r, int g, int b,
|
||||
TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas, Color color,
|
||||
BOOLEAN rleaccel)
|
||||
{
|
||||
Uint32 color;
|
||||
Uint32 sdlColor;
|
||||
int flags = SDL_SRCCOLORKEY;
|
||||
if (rleaccel)
|
||||
flags |= SDL_RLEACCEL;
|
||||
color = SDL_MapRGBA (((SDL_Surface *)canvas)->format, r, g, b, 0);
|
||||
SDL_SetColorKey ((SDL_Surface *)canvas, flags, color);
|
||||
sdlColor = SDL_MapRGBA (((SDL_Surface *)canvas)->format,
|
||||
color.r, color.g, color.b, 0);
|
||||
SDL_SetColorKey ((SDL_Surface *)canvas, flags, sdlColor);
|
||||
|
||||
if (!TFB_DrawCanvas_IsPaletted (canvas))
|
||||
{
|
||||
@@ -1591,7 +1599,7 @@ TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line)
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, int *r, int *g, int *b)
|
||||
TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, Color *color)
|
||||
{
|
||||
SDL_Surface* surf = (SDL_Surface *)canvas;
|
||||
Uint8 ur, ug, ub;
|
||||
@@ -1601,18 +1609,19 @@ TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, int *r, int *g, int *b
|
||||
getpixel = getpixel_for(surf);
|
||||
pixel = (*getpixel)(surf, x, y);
|
||||
SDL_GetRGB (pixel, surf->format, &ur, &ug, &ub);
|
||||
*r = ur;
|
||||
*g = ug;
|
||||
*b = ub;
|
||||
color->r = ur;
|
||||
color->g = ug;
|
||||
color->b = ub;
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_Rotate (TFB_Canvas src_canvas, TFB_Canvas dst_canvas, int angle, EXTENT size)
|
||||
TFB_DrawCanvas_Rotate (TFB_Canvas src_canvas, TFB_Canvas dst_canvas,
|
||||
int angle, EXTENT size)
|
||||
{
|
||||
SDL_Surface *src = (SDL_Surface *)src_canvas;
|
||||
SDL_Surface *dst = (SDL_Surface *)dst_canvas;
|
||||
int ret;
|
||||
int r, g, b;
|
||||
Color color;
|
||||
|
||||
if (size.width > dst->w || size.height > dst->h)
|
||||
{
|
||||
@@ -1623,11 +1632,12 @@ TFB_DrawCanvas_Rotate (TFB_Canvas src_canvas, TFB_Canvas dst_canvas, int angle,
|
||||
return;
|
||||
}
|
||||
|
||||
if (TFB_DrawCanvas_GetTransparentColor (src, &r, &g, &b))
|
||||
if (TFB_DrawCanvas_GetTransparentColor (src, &color))
|
||||
{
|
||||
TFB_DrawCanvas_SetTransparentColor (dst, r, g, b, FALSE);
|
||||
TFB_DrawCanvas_SetTransparentColor (dst, color, FALSE);
|
||||
/* fill destination with transparent color before rotating */
|
||||
SDL_FillRect(dst, NULL, SDL_MapRGBA (dst->format, r, g, b, 0));
|
||||
SDL_FillRect(dst, NULL, SDL_MapRGBA (dst->format,
|
||||
color.r, color.g, color.b, 0));
|
||||
}
|
||||
|
||||
ret = rotateSurface (src, dst, angle, 0);
|
||||
|
||||
@@ -150,7 +150,8 @@ PutPixelFn putpixel_for(SDL_Surface *surface)
|
||||
* Adapted from Paul Heckbert's implementation of Bresenham's algorithm,
|
||||
* 3 Sep 85; taken from Graphics Gems I */
|
||||
|
||||
void line(int x1, int y1, int x2, int y2, Uint32 color, PutPixelFn plot, SDL_Surface *surface)
|
||||
void line(int x1, int y1, int x2, int y2, Uint32 color, PutPixelFn plot,
|
||||
SDL_Surface *surface)
|
||||
{
|
||||
int d, x, y, ax, ay, sx, sy, dx, dy;
|
||||
SDL_Rect r;
|
||||
|
||||
@@ -724,8 +724,7 @@ TFB_FlushGraphics (void) // Only call from main thread!!
|
||||
|
||||
TFB_DrawCanvas_FilledImage (DC.data.filledimage.image,
|
||||
DC.data.filledimage.x, DC.data.filledimage.y,
|
||||
DC.data.filledimage.scale, DC.data.filledimage.r,
|
||||
DC.data.filledimage.g, DC.data.filledimage.b,
|
||||
DC.data.filledimage.scale, DC.data.filledimage.color,
|
||||
SDL_Screens[DC.data.filledimage.destBuffer]);
|
||||
|
||||
if (DC.data.filledimage.destBuffer == 0)
|
||||
@@ -778,7 +777,7 @@ TFB_FlushGraphics (void) // Only call from main thread!!
|
||||
}
|
||||
TFB_DrawCanvas_Line (DC.data.line.x1, DC.data.line.y1,
|
||||
DC.data.line.x2, DC.data.line.y2,
|
||||
DC.data.line.r, DC.data.line.g, DC.data.line.b,
|
||||
DC.data.line.color,
|
||||
SDL_Screens[DC.data.line.destBuffer]);
|
||||
break;
|
||||
}
|
||||
@@ -786,8 +785,7 @@ TFB_FlushGraphics (void) // Only call from main thread!!
|
||||
{
|
||||
if (DC.data.rect.destBuffer == 0)
|
||||
TFB_BBox_RegisterRect (&DC.data.rect.rect);
|
||||
TFB_DrawCanvas_Rect (&DC.data.rect.rect, DC.data.rect.r,
|
||||
DC.data.rect.g, DC.data.rect.b,
|
||||
TFB_DrawCanvas_Rect (&DC.data.rect.rect, DC.data.rect.color,
|
||||
SDL_Screens[DC.data.rect.destBuffer]);
|
||||
|
||||
break;
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
static const HOT_SPOT NullHs = {0, 0};
|
||||
|
||||
void
|
||||
TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
SCREEN dest)
|
||||
TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, Color color, SCREEN dest)
|
||||
{
|
||||
TFB_DrawCommand DC;
|
||||
|
||||
@@ -34,16 +33,14 @@ TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
DC.data.line.y1 = y1;
|
||||
DC.data.line.x2 = x2;
|
||||
DC.data.line.y2 = y2;
|
||||
DC.data.line.r = r;
|
||||
DC.data.line.g = g;
|
||||
DC.data.line.b = b;
|
||||
DC.data.line.color = color;
|
||||
DC.data.line.destBuffer = dest;
|
||||
|
||||
TFB_EnqueueDrawCommand (&DC);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawScreen_Rect (RECT *rect, int r, int g, int b, SCREEN dest)
|
||||
TFB_DrawScreen_Rect (RECT *rect, Color color, SCREEN dest)
|
||||
{
|
||||
RECT locRect;
|
||||
TFB_DrawCommand DC;
|
||||
@@ -58,9 +55,7 @@ TFB_DrawScreen_Rect (RECT *rect, int r, int g, int b, SCREEN dest)
|
||||
|
||||
DC.Type = TFB_DRAWCOMMANDTYPE_RECTANGLE;
|
||||
DC.data.rect.rect = *rect;
|
||||
DC.data.rect.r = r;
|
||||
DC.data.rect.g = g;
|
||||
DC.data.rect.b = b;
|
||||
DC.data.rect.color = color;
|
||||
DC.data.rect.destBuffer = dest;
|
||||
|
||||
TFB_EnqueueDrawCommand (&DC);
|
||||
@@ -85,7 +80,7 @@ TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale,
|
||||
|
||||
void
|
||||
TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
int r, int g, int b, SCREEN dest)
|
||||
Color color, SCREEN dest)
|
||||
{
|
||||
TFB_DrawCommand DC;
|
||||
|
||||
@@ -94,9 +89,7 @@ TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
DC.data.filledimage.x = x;
|
||||
DC.data.filledimage.y = y;
|
||||
DC.data.filledimage.scale = (scale == GSCALE_IDENTITY) ? 0 : scale;
|
||||
DC.data.filledimage.r = r;
|
||||
DC.data.filledimage.g = g;
|
||||
DC.data.filledimage.b = b;
|
||||
DC.data.filledimage.color = color;
|
||||
DC.data.filledimage.destBuffer = dest;
|
||||
|
||||
TFB_EnqueueDrawCommand (&DC);
|
||||
@@ -240,20 +233,20 @@ TFB_DrawScreen_Callback (void (*callback) (void *arg), void *arg)
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
TFB_DrawImage_Line (int x1, int y1, int x2, int y2, Color color,
|
||||
TFB_Image *dest)
|
||||
{
|
||||
LockMutex (dest->mutex);
|
||||
TFB_DrawCanvas_Line (x1, y1, x2, y2, r, g, b, dest->NormalImg);
|
||||
TFB_DrawCanvas_Line (x1, y1, x2, y2, color, dest->NormalImg);
|
||||
dest->dirty = TRUE;
|
||||
UnlockMutex (dest->mutex);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawImage_Rect (RECT *rect, int r, int g, int b, TFB_Image *image)
|
||||
TFB_DrawImage_Rect (RECT *rect, Color color, TFB_Image *image)
|
||||
{
|
||||
LockMutex (image->mutex);
|
||||
TFB_DrawCanvas_Rect (rect, r, g, b, image->NormalImg);
|
||||
TFB_DrawCanvas_Rect (rect, color, image->NormalImg);
|
||||
image->dirty = TRUE;
|
||||
UnlockMutex (image->mutex);
|
||||
}
|
||||
@@ -270,10 +263,10 @@ TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale,
|
||||
|
||||
void
|
||||
TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
int r, int g, int b, TFB_Image *target)
|
||||
Color color, TFB_Image *target)
|
||||
{
|
||||
LockMutex (target->mutex);
|
||||
TFB_DrawCanvas_FilledImage (img, x, y, scale, r, g, b, target->NormalImg);
|
||||
TFB_DrawCanvas_FilledImage (img, x, y, scale, color, target->NormalImg);
|
||||
target->dirty = TRUE;
|
||||
UnlockMutex (target->mutex);
|
||||
}
|
||||
|
||||
@@ -79,14 +79,14 @@ typedef struct tfb_pixelformat
|
||||
|
||||
// Drawing commands
|
||||
|
||||
void TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
void TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, Color color,
|
||||
SCREEN dest);
|
||||
void TFB_DrawScreen_Rect (RECT *rect, int r, int g, int b, SCREEN dest);
|
||||
void TFB_DrawScreen_Rect (RECT *rect, Color color, SCREEN dest);
|
||||
void TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale,
|
||||
TFB_ColorMap *cmap, SCREEN dest);
|
||||
void TFB_DrawScreen_Copy (RECT *r, SCREEN src, SCREEN dest);
|
||||
void TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
int r, int g, int b, SCREEN dest);
|
||||
Color color, SCREEN dest);
|
||||
void TFB_DrawScreen_FontChar (TFB_Char *, TFB_Image *backing, int x, int y,
|
||||
SCREEN dest);
|
||||
|
||||
@@ -107,13 +107,13 @@ void TFB_DrawImage_SetMipmap (TFB_Image *img, TFB_Image *mmimg, int hotx,
|
||||
void TFB_DrawImage_Delete (TFB_Image *image);
|
||||
void TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type);
|
||||
|
||||
void TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
void TFB_DrawImage_Line (int x1, int y1, int x2, int y2, Color color,
|
||||
TFB_Image *dest);
|
||||
void TFB_DrawImage_Rect (RECT *rect, int r, int g, int b, TFB_Image *image);
|
||||
void TFB_DrawImage_Rect (RECT *rect, Color color, TFB_Image *image);
|
||||
void TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale,
|
||||
TFB_ColorMap *cmap, TFB_Image *target);
|
||||
void TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
int r, int g, int b, TFB_Image *target);
|
||||
Color color, TFB_Image *target);
|
||||
void TFB_DrawImage_FontChar (TFB_Char *, TFB_Image *backing, int x, int y,
|
||||
TFB_Image *target);
|
||||
|
||||
@@ -143,13 +143,13 @@ void TFB_DrawCanvas_GetExtent (TFB_Canvas canvas, EXTENT *size);
|
||||
|
||||
void TFB_DrawCanvas_Delete (TFB_Canvas canvas);
|
||||
|
||||
void TFB_DrawCanvas_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
void TFB_DrawCanvas_Line (int x1, int y1, int x2, int y2, Color color,
|
||||
TFB_Canvas dest);
|
||||
void TFB_DrawCanvas_Rect (RECT *rect, int r, int g, int b, TFB_Canvas image);
|
||||
void TFB_DrawCanvas_Rect (RECT *rect, Color color, TFB_Canvas image);
|
||||
void TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, int scale,
|
||||
TFB_ColorMap *cmap, TFB_Canvas target);
|
||||
void TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale,
|
||||
int r, int g, int b, TFB_Canvas target);
|
||||
Color color, TFB_Canvas target);
|
||||
void TFB_DrawCanvas_FontChar (TFB_Char *, TFB_Image *backing, int x, int y,
|
||||
TFB_Canvas target);
|
||||
|
||||
@@ -159,9 +159,9 @@ int TFB_DrawCanvas_GetTransparentIndex (TFB_Canvas canvas);
|
||||
void TFB_DrawCanvas_SetTransparentIndex (TFB_Canvas canvas, int i,
|
||||
BOOLEAN rleaccel);
|
||||
BOOLEAN TFB_DrawCanvas_GetTransparentColor (TFB_Canvas canvas,
|
||||
int *r, int *g, int *b);
|
||||
Color *color);
|
||||
void TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas,
|
||||
int r, int g, int b, BOOLEAN rleaccel);
|
||||
Color color, BOOLEAN rleaccel);
|
||||
void TFB_DrawCanvas_CopyTransparencyInfo (TFB_Canvas src, TFB_Canvas dst);
|
||||
void TFB_DrawCanvas_Initialize (void);
|
||||
void TFB_DrawCanvas_Lock (TFB_Canvas canvas);
|
||||
@@ -169,8 +169,7 @@ void TFB_DrawCanvas_Unlock (TFB_Canvas canvas);
|
||||
void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt);
|
||||
int TFB_DrawCanvas_GetStride (TFB_Canvas canvas);
|
||||
void *TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line);
|
||||
void TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y,
|
||||
int *r, int *g, int *b);
|
||||
void TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, Color *color);
|
||||
|
||||
TFB_Canvas TFB_GetScreenCanvas (SCREEN screen);
|
||||
|
||||
|
||||
@@ -38,10 +38,9 @@ TFB_Prim_Point (POINT *p, Color color)
|
||||
r.extent.width = r.extent.height = 1;
|
||||
|
||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||
TFB_DrawScreen_Rect (&r, color.r, color.g, color.b, TFB_SCREEN_MAIN);
|
||||
TFB_DrawScreen_Rect (&r, color, TFB_SCREEN_MAIN);
|
||||
else
|
||||
TFB_DrawImage_Rect (&r, color.r, color.g, color.b,
|
||||
_CurFramePtr->image);
|
||||
TFB_DrawImage_Rect (&r, color, _CurFramePtr->image);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -87,18 +86,14 @@ TFB_Prim_FillRect (RECT *r, Color color)
|
||||
+ (GSCALE_IDENTITY >> 1)) / GSCALE_IDENTITY;
|
||||
rect.extent.height = (rect.extent.height * gscale
|
||||
+ (GSCALE_IDENTITY >> 1)) / GSCALE_IDENTITY;
|
||||
rect.corner.x += (r->extent.width -
|
||||
rect.extent.width) >> 1;
|
||||
rect.corner.y += (r->extent.height -
|
||||
rect.extent.height) >> 1;
|
||||
rect.corner.x += (r->extent.width - rect.extent.width) >> 1;
|
||||
rect.corner.y += (r->extent.height - rect.extent.height) >> 1;
|
||||
}
|
||||
|
||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||
TFB_DrawScreen_Rect (&rect, color.r, color.g, color.b,
|
||||
TFB_SCREEN_MAIN);
|
||||
TFB_DrawScreen_Rect (&rect, color, TFB_SCREEN_MAIN);
|
||||
else
|
||||
TFB_DrawImage_Rect (&rect, color.r, color.g, color.b,
|
||||
_CurFramePtr->image);
|
||||
TFB_DrawImage_Rect (&rect, color, _CurFramePtr->image);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -112,11 +107,9 @@ TFB_Prim_Line (LINE *line, Color color)
|
||||
y2=line->second.y - _CurFramePtr->HotSpot.y;
|
||||
|
||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||
TFB_DrawScreen_Line (x1, y1, x2, y2, color.r, color.g, color.b,
|
||||
TFB_SCREEN_MAIN);
|
||||
TFB_DrawScreen_Line (x1, y1, x2, y2, color, TFB_SCREEN_MAIN);
|
||||
else
|
||||
TFB_DrawImage_Line (x1, y1, x2, y2, color.r, color.g, color.b,
|
||||
_CurFramePtr->image);
|
||||
TFB_DrawImage_Line (x1, y1, x2, y2, color, _CurFramePtr->image);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -174,7 +167,6 @@ TFB_Prim_StampFill (STAMP *stmp, Color color)
|
||||
int x, y;
|
||||
FRAME SrcFramePtr;
|
||||
TFB_Image *img;
|
||||
int r, g, b;
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = stmp->frame;
|
||||
@@ -199,21 +191,16 @@ TFB_Prim_StampFill (STAMP *stmp, Color color)
|
||||
x = stmp->origin.x - _CurFramePtr->HotSpot.x;
|
||||
y = stmp->origin.y - _CurFramePtr->HotSpot.y;
|
||||
|
||||
r = color.r;
|
||||
g = color.g;
|
||||
b = color.b;
|
||||
|
||||
UnlockMutex (img->mutex);
|
||||
|
||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||
{
|
||||
TFB_DrawScreen_FilledImage (img, x, y, gscale, r, g, b,
|
||||
TFB_SCREEN_MAIN);
|
||||
TFB_DrawScreen_FilledImage (img, x, y, gscale, color, TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_DrawImage_FilledImage (img, x, y, gscale, r, g, b,
|
||||
_CurFramePtr->image);
|
||||
TFB_DrawImage_FilledImage (img, x, y, gscale, color,
|
||||
_CurFramePtr->image);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,13 +214,11 @@ TFB_Prim_FontChar (POINT *origin, TFB_Char *fontChar, TFB_Image *backing)
|
||||
|
||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||
{
|
||||
TFB_DrawScreen_FontChar (fontChar, backing, x, y,
|
||||
TFB_SCREEN_MAIN);
|
||||
TFB_DrawScreen_FontChar (fontChar, backing, x, y, TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_DrawImage_FontChar (fontChar, backing, x, y,
|
||||
_CurFramePtr->image);
|
||||
TFB_DrawImage_FontChar (fontChar, backing, x, y, _CurFramePtr->image);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,18 +94,21 @@ DrawOscilloscope (void)
|
||||
TFB_DrawImage_Image (scope_bg, 0, 0, 0, NULL, scope_surf);
|
||||
if (GraphForegroundStream (scope_data, RADAR_WIDTH - 2, RADAR_HEIGHT - 2))
|
||||
{
|
||||
int i, r, g, b;
|
||||
int i;
|
||||
Color color;
|
||||
|
||||
TFB_DrawCanvas_GetPixel (scope_bg->NormalImg,
|
||||
scope_bg->extent.width / 2, scope_bg->extent.height / 2,
|
||||
&r, &g, &b);
|
||||
&color);
|
||||
for (i = 0; i < RADAR_WIDTH - 3; ++i)
|
||||
TFB_DrawImage_Line (i + 1, scope_data[i] + 1, i + 2,
|
||||
scope_data[i + 1] + 1, r, g, b, scope_surf);
|
||||
scope_data[i + 1] + 1, color, scope_surf);
|
||||
}
|
||||
TFB_DrawImage_Image (scope_surf, 0, 0, 0, NULL, scope_frame->image);
|
||||
|
||||
s.frame = scope_frame;
|
||||
s.origin.x = s.origin.y = 0;
|
||||
s.origin.x = 0;
|
||||
s.origin.y = 0;
|
||||
DrawStamp (&s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user