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 }

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 }

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:4558
blendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109
g
GLboolean GLboolean g
Definition: SDL_opengl_glext.h:1109
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:8583
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
func
GLenum func
Definition: SDL_opengl_glext.h:657
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
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:196
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:670
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:4583
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
y1
GLfixed y1
Definition: SDL_opengl_glext.h:4583
y2
GLfixed GLfixed GLfixed y2
Definition: SDL_opengl_glext.h:4583
SDL_CalculateBlendLineFunc
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
Definition: SDL_blendline.c:677
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