SDL 2.0
SDL_blendline.h File Reference
+ Include dependency graph for SDL_blendline.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SDL_BlendLine (SDL_Surface *dst, int x1, int y1, int x2, int y2, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
int SDL_BlendLines (SDL_Surface *dst, const SDL_Point *points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 

Function Documentation

◆ SDL_BlendLine()

int SDL_BlendLine ( SDL_Surface dst,
int  x1,
int  y1,
int  x2,
int  y2,
SDL_BlendMode  blendMode,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Definition at line 708 of file SDL_blendline.c.

710{
712
713 if (!dst) {
714 return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface");
715 }
716
718 if (!func) {
719 return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
720 }
721
722 /* Perform clipping */
723 /* FIXME: We don't actually want to clip, as it may change line slope */
724 if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
725 return 0;
726 }
727
728 func(dst, x1, y1, x2, y2, blendMode, r, g, b, a, SDL_TRUE);
729 return 0;
730}
void(* BlendLineFunc)(SDL_Surface *dst, int x1, int y1, int x2, int y2, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a, SDL_bool draw_end)
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
#define SDL_SetError
#define SDL_IntersectRectAndLine
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
GLboolean GLboolean GLboolean b
GLenum func
GLfixed GLfixed GLfixed y2
GLfixed y1
GLuint GLfloat GLfloat GLfloat x1
GLboolean GLboolean GLboolean GLboolean a
GLfixed GLfixed x2
GLenum GLenum dst
GLboolean GLboolean g
@ SDL_TRUE
Definition: SDL_stdinc.h:164
static SDL_BlendMode blendMode
Definition: testdraw2.c:34

References blendMode, SDL_CalculateBlendLineFunc(), SDL_IntersectRectAndLine, SDL_SetError, and SDL_TRUE.

◆ SDL_BlendLines()

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

Definition at line 733 of file SDL_blendline.c.

735{
736 int i;
737 int x1, y1;
738 int x2, y2;
739 SDL_bool draw_end;
741
742 if (!dst) {
743 return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
744 }
745
747 if (!func) {
748 return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
749 }
750
751 for (i = 1; i < count; ++i) {
752 x1 = points[i-1].x;
753 y1 = points[i-1].y;
754 x2 = points[i].x;
755 y2 = points[i].y;
756
757 /* Perform clipping */
758 /* FIXME: We don't actually want to clip, as it may change line slope */
759 if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
760 continue;
761 }
762
763 /* Draw the end if it was clipped */
764 draw_end = (x2 != points[i].x || y2 != points[i].y);
765
766 func(dst, x1, y1, x2, y2, blendMode, r, g, b, a, draw_end);
767 }
768 if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
770 blendMode, r, g, b, a);
771 }
772 return 0;
773}
int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLfixed GLfixed GLint GLint GLfixed points
SDL_bool
Definition: SDL_stdinc.h:162
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:50

References blendMode, i, SDL_BlendPoint(), SDL_CalculateBlendLineFunc(), SDL_IntersectRectAndLine, and SDL_SetError.

Referenced by SW_RunCommandQueue().