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 806 of file SDL_blendline.c.

808 {
810 
811  if (!dst) {
812  return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface");
813  }
814 
816  if (!func) {
817  return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
818  }
819 
820  /* Perform clipping */
821  /* FIXME: We don't actually want to clip, as it may change line slope */
822  if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
823  return 0;
824  }
825 
826  func(dst, x1, y1, x2, y2, blendMode, r, g, b, a, SDL_TRUE);
827  return 0;
828 }

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 831 of file SDL_blendline.c.

833 {
834  int i;
835  int x1, y1;
836  int x2, y2;
837  SDL_bool draw_end;
839 
840  if (!dst) {
841  return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
842  }
843 
845  if (!func) {
846  return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
847  }
848 
849  for (i = 1; i < count; ++i) {
850  x1 = points[i-1].x;
851  y1 = points[i-1].y;
852  x2 = points[i].x;
853  y2 = points[i].y;
854 
855  /* Perform clipping */
856  /* FIXME: We don't actually want to clip, as it may change line slope */
857  if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
858  continue;
859  }
860 
861  /* Draw the end if it was clipped */
862  draw_end = (x2 != points[i].x || y2 != points[i].y);
863 
864  func(dst, x1, y1, x2, y2, blendMode, r, g, b, a, draw_end);
865  }
866  if (points[0].x != points[count-1].x || points[0].y != points[count-1].y) {
868  blendMode, r, g, b, a);
869  }
870  return 0;
871 }

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

Referenced by SW_RunCommandQueue().

points
GLfixed GLfixed GLint GLint GLfixed points
Definition: SDL_opengl_glext.h:4561
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
g
GLboolean GLboolean g
Definition: SDL_opengl_glext.h:1112
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
x1
GLuint GLfloat GLfloat GLfloat x1
Definition: SDL_opengl_glext.h:8586
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
func
GLenum func
Definition: SDL_opengl_glext.h:660
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_BlendPoint
int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_blendpoint.c:217
BlendLineFunc
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)
Definition: SDL_blendline.c:768
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
x2
GLfixed GLfixed x2
Definition: SDL_opengl_glext.h:4586
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
y1
GLfixed y1
Definition: SDL_opengl_glext.h:4586
y2
GLfixed GLfixed GLfixed y2
Definition: SDL_opengl_glext.h:4586
SDL_CalculateBlendLineFunc
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
Definition: SDL_blendline.c:775
SDL_IntersectRectAndLine
#define SDL_IntersectRectAndLine
Definition: SDL_dynapi_overrides.h:297
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:50
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161