SDL_blendpoint.c File Reference
`#include "../../SDL_internal.h"`
`#include "SDL_draw.h"`
`#include "SDL_blendpoint.h"`
Include dependency graph for SDL_blendpoint.c:

Go to the source code of this file.

## Functions

static int | SDL_BlendPoint_RGB555 (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
static int | SDL_BlendPoint_RGB565 (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
static int | SDL_BlendPoint_RGB888 (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
static int | SDL_BlendPoint_ARGB8888 (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
static int | SDL_BlendPoint_RGB (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
static int | SDL_BlendPoint_RGBA (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int | SDL_BlendPoint (SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int | SDL_BlendPoints (SDL_Surface *dst, const SDL_Point *points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)

## Function Documentation

int SDL_BlendPoint | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

Definition at line 196 of file SDL_blendpoint.c.

References SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, SDL_Surface::clip_rect, DRAW_MUL, SDL_Surface::format, SDL_Rect::h, SDL_PixelFormat::Rmask, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BlendPoint_ARGB8888(), SDL_BlendPoint_RGB(), SDL_BlendPoint_RGB555(), SDL_BlendPoint_RGB565(), SDL_BlendPoint_RGB888(), SDL_BlendPoint_RGBA(), SDL_SetError, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_BlendLines().

{
if (!dst) {
return SDL_SetError("Passed NULL destination surface");
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
}
/* Perform clipping */
if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
x >= (dst->clip_rect.x + dst->clip_rect.w) ||
y >= (dst->clip_rect.y + dst->clip_rect.h)) {
return 0;
}
if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
r = DRAW_MUL(r, a);
g = DRAW_MUL(g, a);
b = DRAW_MUL(b, a);
}
switch (dst->format->BitsPerPixel) {
case 15:
switch (dst->format->Rmask) {
case 0x7C00:
return SDL_BlendPoint_RGB555(dst, x, y, blendMode, r, g, b, a);
}
break;
case 16:
switch (dst->format->Rmask) {
case 0xF800:
return SDL_BlendPoint_RGB565(dst, x, y, blendMode, r, g, b, a);
}
break;
case 32:
switch (dst->format->Rmask) {
case 0x00FF0000:
if (!dst->format->Amask) {
return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b,
a);
} else {
return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b,
a);
}
break;
}
break;
default:
break;
}
if (!dst->format->Amask) {
return SDL_BlendPoint_RGB(dst, x, y, blendMode, r, g, b, a);
} else {
return SDL_BlendPoint_RGBA(dst, x, y, blendMode, r, g, b, a);
}
}
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
SDL_BlendPoint_RGBA
static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:167
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_BlendPoint_ARGB8888
static int SDL_BlendPoint_ARGB8888(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:99
SDL_BlendPoint_RGB888
static int SDL_BlendPoint_RGB888(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:76
SDL_BlendPoint_RGB565
static int SDL_BlendPoint_RGB565(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:53
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
g
GLboolean GLboolean g
Definition: SDL_opengl_glext.h:1109
SDL_BlendPoint_RGB555
static int SDL_BlendPoint_RGB555(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:30
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_PixelFormat::BitsPerPixel
Uint8 BitsPerPixel
Definition: SDL_pixels.h:303
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_Surface::clip_rect
SDL_Rect clip_rect
Definition: SDL_surface.h:85
SDL_BlendPoint_RGB
static int SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:122
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:306
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109
SDL_Rect::y
int y
Definition: SDL_rect.h:66
DRAW_MUL
#define DRAW_MUL(_a, _b)
Definition: SDL_draw.h:29
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44

static int SDL_BlendPoint_ARGB8888 | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

static

Definition at line 99 of file SDL_blendpoint.c.

References DRAW_SETPIXELXY_ADD_ARGB8888, DRAW_SETPIXELXY_ARGB8888, DRAW_SETPIXELXY_BLEND_ARGB8888, DRAW_SETPIXELXY_MOD_ARGB8888, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, and SDL_BLENDMODE_MOD.

Referenced by SDL_BlendPoint(), and SDL_BlendPoints().

{
unsigned inva = 0xff - a;
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY_BLEND_ARGB8888(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY_ADD_ARGB8888(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY_MOD_ARGB8888(x, y);
break;
default:
DRAW_SETPIXELXY_ARGB8888(x, y);
break;
}
return 0;
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
DRAW_SETPIXELXY_MOD_ARGB8888
#define DRAW_SETPIXELXY_MOD_ARGB8888(x, y)
Definition: SDL_draw.h:211
SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
DRAW_SETPIXELXY_ARGB8888
#define DRAW_SETPIXELXY_ARGB8888(x, y)
Definition: SDL_draw.h:202
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
DRAW_SETPIXELXY_BLEND_ARGB8888
#define DRAW_SETPIXELXY_BLEND_ARGB8888(x, y)
Definition: SDL_draw.h:205
DRAW_SETPIXELXY_ADD_ARGB8888
#define DRAW_SETPIXELXY_ADD_ARGB8888(x, y)
Definition: SDL_draw.h:208
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44

static int SDL_BlendPoint_RGB | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

static

Definition at line 122 of file SDL_blendpoint.c.

References SDL_PixelFormat::BytesPerPixel, DRAW_SETPIXELXY2_ADD_RGB, DRAW_SETPIXELXY2_BLEND_RGB, DRAW_SETPIXELXY2_MOD_RGB, DRAW_SETPIXELXY2_RGB, DRAW_SETPIXELXY4_ADD_RGB, DRAW_SETPIXELXY4_BLEND_RGB, DRAW_SETPIXELXY4_MOD_RGB, DRAW_SETPIXELXY4_RGB, SDL_Surface::format, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, and SDL_Unsupported.

Referenced by SDL_BlendPoint(), and SDL_BlendPoints().

{
SDL_PixelFormat *fmt = dst->format;
unsigned inva = 0xff - a;
switch (fmt->BytesPerPixel) {
case 2:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY2_BLEND_RGB(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY2_ADD_RGB(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY2_MOD_RGB(x, y);
break;
default:
DRAW_SETPIXELXY2_RGB(x, y);
break;
}
return 0;
case 4:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY4_BLEND_RGB(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY4_ADD_RGB(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY4_MOD_RGB(x, y);
break;
default:
DRAW_SETPIXELXY4_RGB(x, y);
break;
}
return 0;
default:
return SDL_Unsupported();
}
}
DRAW_SETPIXELXY2_RGB
#define DRAW_SETPIXELXY2_RGB(x, y)
Definition: SDL_draw.h:233
DRAW_SETPIXELXY4_MOD_RGB
#define DRAW_SETPIXELXY4_MOD_RGB(x, y)
Definition: SDL_draw.h:254
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
DRAW_SETPIXELXY2_BLEND_RGB
#define DRAW_SETPIXELXY2_BLEND_RGB(x, y)
Definition: SDL_draw.h:239
SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
DRAW_SETPIXELXY4_BLEND_RGB
#define DRAW_SETPIXELXY4_BLEND_RGB(x, y)
Definition: SDL_draw.h:242
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
SDL_PixelFormat
Definition: SDL_pixels.h:299
DRAW_SETPIXELXY2_ADD_RGB
#define DRAW_SETPIXELXY2_ADD_RGB(x, y)
Definition: SDL_draw.h:245
DRAW_SETPIXELXY4_ADD_RGB
#define DRAW_SETPIXELXY4_ADD_RGB(x, y)
Definition: SDL_draw.h:248
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
DRAW_SETPIXELXY4_RGB
#define DRAW_SETPIXELXY4_RGB(x, y)
Definition: SDL_draw.h:236
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44
DRAW_SETPIXELXY2_MOD_RGB
#define DRAW_SETPIXELXY2_MOD_RGB(x, y)
Definition: SDL_draw.h:251

static int SDL_BlendPoint_RGB555 | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

static

Definition at line 30 of file SDL_blendpoint.c.

References DRAW_SETPIXELXY_ADD_RGB555, DRAW_SETPIXELXY_BLEND_RGB555, DRAW_SETPIXELXY_MOD_RGB555, DRAW_SETPIXELXY_RGB555, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, and SDL_BLENDMODE_MOD.

Referenced by SDL_BlendPoint(), and SDL_BlendPoints().

{
unsigned inva = 0xff - a;
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY_BLEND_RGB555(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY_ADD_RGB555(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY_MOD_RGB555(x, y);
break;
default:
DRAW_SETPIXELXY_RGB555(x, y);
break;
}
return 0;
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
DRAW_SETPIXELXY_BLEND_RGB555
#define DRAW_SETPIXELXY_BLEND_RGB555(x, y)
Definition: SDL_draw.h:112
DRAW_SETPIXELXY_MOD_RGB555
#define DRAW_SETPIXELXY_MOD_RGB555(x, y)
Definition: SDL_draw.h:118
DRAW_SETPIXELXY_ADD_RGB555
#define DRAW_SETPIXELXY_ADD_RGB555(x, y)
Definition: SDL_draw.h:115
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
DRAW_SETPIXELXY_RGB555
#define DRAW_SETPIXELXY_RGB555(x, y)
Definition: SDL_draw.h:109
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44

static int SDL_BlendPoint_RGB565 | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

static

Definition at line 53 of file SDL_blendpoint.c.

References DRAW_SETPIXELXY_ADD_RGB565, DRAW_SETPIXELXY_BLEND_RGB565, DRAW_SETPIXELXY_MOD_RGB565, DRAW_SETPIXELXY_RGB565, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, and SDL_BLENDMODE_MOD.

Referenced by SDL_BlendPoint(), and SDL_BlendPoints().

{
unsigned inva = 0xff - a;
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY_BLEND_RGB565(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY_ADD_RGB565(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY_MOD_RGB565(x, y);
break;
default:
DRAW_SETPIXELXY_RGB565(x, y);
break;
}
return 0;
}
DRAW_SETPIXELXY_RGB565
#define DRAW_SETPIXELXY_RGB565(x, y)
Definition: SDL_draw.h:140
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
DRAW_SETPIXELXY_MOD_RGB565
#define DRAW_SETPIXELXY_MOD_RGB565(x, y)
Definition: SDL_draw.h:149
DRAW_SETPIXELXY_BLEND_RGB565
#define DRAW_SETPIXELXY_BLEND_RGB565(x, y)
Definition: SDL_draw.h:143
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44
DRAW_SETPIXELXY_ADD_RGB565
#define DRAW_SETPIXELXY_ADD_RGB565(x, y)
Definition: SDL_draw.h:146

static int SDL_BlendPoint_RGB888 | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

static

Definition at line 76 of file SDL_blendpoint.c.

References DRAW_SETPIXELXY_ADD_RGB888, DRAW_SETPIXELXY_BLEND_RGB888, DRAW_SETPIXELXY_MOD_RGB888, DRAW_SETPIXELXY_RGB888, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, and SDL_BLENDMODE_MOD.

Referenced by SDL_BlendPoint(), and SDL_BlendPoints().

{
unsigned inva = 0xff - a;
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY_BLEND_RGB888(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY_ADD_RGB888(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY_MOD_RGB888(x, y);
break;
default:
DRAW_SETPIXELXY_RGB888(x, y);
break;
}
return 0;
}
DRAW_SETPIXELXY_ADD_RGB888
#define DRAW_SETPIXELXY_ADD_RGB888(x, y)
Definition: SDL_draw.h:177
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
DRAW_SETPIXELXY_BLEND_RGB888
#define DRAW_SETPIXELXY_BLEND_RGB888(x, y)
Definition: SDL_draw.h:174
DRAW_SETPIXELXY_MOD_RGB888
#define DRAW_SETPIXELXY_MOD_RGB888(x, y)
Definition: SDL_draw.h:180
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
DRAW_SETPIXELXY_RGB888
#define DRAW_SETPIXELXY_RGB888(x, y)
Definition: SDL_draw.h:171
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44

static int SDL_BlendPoint_RGBA | ( | SDL_Surface * | dst,
|  | int | x,
|  | int | y,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

static

Definition at line 167 of file SDL_blendpoint.c.

References SDL_PixelFormat::BytesPerPixel, DRAW_SETPIXELXY4_ADD_RGBA, DRAW_SETPIXELXY4_BLEND_RGBA, DRAW_SETPIXELXY4_MOD_RGBA, DRAW_SETPIXELXY4_RGBA, SDL_Surface::format, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, and SDL_Unsupported.

Referenced by SDL_BlendPoint(), and SDL_BlendPoints().

{
SDL_PixelFormat *fmt = dst->format;
unsigned inva = 0xff - a;
switch (fmt->BytesPerPixel) {
case 4:
switch (blendMode) {
case SDL_BLENDMODE_BLEND:
DRAW_SETPIXELXY4_BLEND_RGBA(x, y);
break;
case SDL_BLENDMODE_ADD:
DRAW_SETPIXELXY4_ADD_RGBA(x, y);
break;
case SDL_BLENDMODE_MOD:
DRAW_SETPIXELXY4_MOD_RGBA(x, y);
break;
default:
DRAW_SETPIXELXY4_RGBA(x, y);
break;
}
return 0;
default:
return SDL_Unsupported();
}
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
DRAW_SETPIXELXY4_RGBA
#define DRAW_SETPIXELXY4_RGBA(x, y)
Definition: SDL_draw.h:277
DRAW_SETPIXELXY4_ADD_RGBA
#define DRAW_SETPIXELXY4_ADD_RGBA(x, y)
Definition: SDL_draw.h:283
DRAW_SETPIXELXY4_MOD_RGBA
#define DRAW_SETPIXELXY4_MOD_RGBA(x, y)
Definition: SDL_draw.h:286
SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
SDL_PixelFormat
Definition: SDL_pixels.h:299
DRAW_SETPIXELXY4_BLEND_RGBA
#define DRAW_SETPIXELXY4_BLEND_RGBA(x, y)
Definition: SDL_draw.h:280
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
SDL_Unsupported
#define SDL_Unsupported()
Definition: SDL_error.h:53
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44

int SDL_BlendPoints | ( | SDL_Surface * | dst,
|  | const SDL_Point * | points,
|  | int | count,
|  | SDL_BlendMode | blendMode,
|  | Uint8 | r,
|  | Uint8 | g,
|  | Uint8 | b,
|  | Uint8 | a
| ) |  |

Definition at line 259 of file SDL_blendpoint.c.

References SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, blendMode, SDL_Surface::clip_rect, DRAW_MUL, SDL_Surface::format, SDL_Rect::h, i, NULL, SDL_PixelFormat::Rmask, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BlendPoint_ARGB8888(), SDL_BlendPoint_RGB(), SDL_BlendPoint_RGB555(), SDL_BlendPoint_RGB565(), SDL_BlendPoint_RGB888(), SDL_BlendPoint_RGBA(), SDL_SetError, SDL_Rect::w, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.

Referenced by SW_RenderDrawPoints().

{
int minx, miny;
int maxx, maxy;
int i;
int x, y;
int (*func)(SDL_Surface * dst, int x, int y,
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
int status = 0;
if (!dst) {
return SDL_SetError("Passed NULL destination surface");
}
/* This function doesn't work on surfaces < 8 bpp */
if (dst->format->BitsPerPixel < 8) {
return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
}
if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
r = DRAW_MUL(r, a);
g = DRAW_MUL(g, a);
b = DRAW_MUL(b, a);
}
/* FIXME: Does this function pointer slow things down significantly? */
switch (dst->format->BitsPerPixel) {
case 15:
switch (dst->format->Rmask) {
case 0x7C00:
func = SDL_BlendPoint_RGB555;
break;
}
break;
case 16:
switch (dst->format->Rmask) {
case 0xF800:
func = SDL_BlendPoint_RGB565;
break;
}
break;
case 32:
switch (dst->format->Rmask) {
case 0x00FF0000:
if (!dst->format->Amask) {
func = SDL_BlendPoint_RGB888;
} else {
func = SDL_BlendPoint_ARGB8888;
}
break;
}
break;
default:
break;
}
if (!func) {
if (!dst->format->Amask) {
func = SDL_BlendPoint_RGB;
} else {
func = SDL_BlendPoint_RGBA;
}
}
minx = dst->clip_rect.x;
maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
miny = dst->clip_rect.y;
maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
for (i = 0; i < count; ++i) {
x = points[i].x;
y = points[i].y;
if (x < minx || x > maxx || y < miny || y > maxy) {
continue;
}
status = func(dst, x, y, blendMode, r, g, b, a);
}
return status;
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
SDL_BlendPoint_RGBA
static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:167
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_BlendMode
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:40
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1564
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_BlendPoint_ARGB8888
static int SDL_BlendPoint_ARGB8888(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:99
SDL_BlendPoint_RGB888
static int SDL_BlendPoint_RGB888(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:76
SDL_BlendPoint_RGB565
static int SDL_BlendPoint_RGB565(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:53
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
g
GLboolean GLboolean g
Definition: SDL_opengl_glext.h:1109
SDL_Point::x
int x
Definition: SDL_rect.h:50
SDL_BlendPoint_RGB555
static int SDL_BlendPoint_RGB555(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:30
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SDL_Point::y
int y
Definition: SDL_rect.h:51
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
SDL_PixelFormat::BitsPerPixel
Uint8 BitsPerPixel
Definition: SDL_pixels.h:303
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_Surface::clip_rect
SDL_Rect clip_rect
Definition: SDL_surface.h:85
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
SDL_BlendPoint_RGB
static int SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:122
NULL
#define NULL
Definition: begin_code.h:143
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:36
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:306
func
GLenum func
Definition: SDL_opengl_glext.h:657
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109
SDL_Rect::y
int y
Definition: SDL_rect.h:66
DRAW_MUL
#define DRAW_MUL(_a, _b)
Definition: SDL_draw.h:29
SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44