diff options
author | Sam Lantinga <slouken@libsdl.org> | 2009-12-23 01:55:00 +0000 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2009-12-23 01:55:00 +0000 |
commit | 6da163ab8179090b9f8d238976ced6e285c045cb (patch) | |
tree | 1798ca7984f8e6997dc9697c899a761510715343 /include | |
parent | d45158ea855a538a2299e9603170b0edfdccf753 (diff) |
Added SDL_RenderClear() as a fast method of clearing the screen to the drawing color.
Renamed SDL_RenderPoint() and SDL_RenderLine() to SDL_RenderDrawPoint() and SDL_RenderDrawLine().
Added API for rectangle drawing (as opposed to filling)
Added placeholder API functions for circles and ellipses ... I'm not sure whether these will stay.
Optimized software line drawing quite a bit.
Added support for Wu's anti-aliased line drawing, currently disabled by default.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404346
Diffstat (limited to 'include')
-rw-r--r-- | include/SDL_compat.h | 4 | ||||
-rw-r--r-- | include/SDL_surface.h | 93 | ||||
-rw-r--r-- | include/SDL_video.h | 72 |
3 files changed, 152 insertions, 17 deletions
diff --git a/include/SDL_compat.h b/include/SDL_compat.h index 49bd9f8c..e77808d6 100644 --- a/include/SDL_compat.h +++ b/include/SDL_compat.h @@ -295,7 +295,9 @@ extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); -#define SDL_RenderFill SDL_RenderRect +#define SDL_RenderPoint SDL_RenderDrawPoint +#define SDL_RenderLine SDL_RenderDrawLine +#define SDL_RenderFill(X) (X) ? SDL_RenderFillRect(X) : SDL_RenderClear() extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); diff --git a/include/SDL_surface.h b/include/SDL_surface.h index b4cdf0ce..653d0e16 100644 --- a/include/SDL_surface.h +++ b/include/SDL_surface.h @@ -411,12 +411,9 @@ extern DECLSPEC int SDLCALL SDL_DrawPoints /** * Blends a point with an RGBA value. * - * The color should be a pixel of the format used by the surface, and - * can be generated by the SDL_MapRGB() function. - * * \return 0 on success, or -1 on error. */ -extern DECLSPEC int SDLCALL SDL_BlendDrawPoint +extern DECLSPEC int SDLCALL SDL_BlendPoint (SDL_Surface * dst, int x, int y, int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); extern DECLSPEC int SDLCALL SDL_BlendPoints @@ -464,9 +461,9 @@ extern DECLSPEC int SDLCALL SDL_DrawRects (SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color); /** - * Blends the given rectangle with \c color. + * Blends an RGBA value into the outline of the given rectangle. * - * If \c rect is NULL, the whole surface will have a blended outline of \c color. + * If \c rect is NULL, the whole surface will have a blended outline. * * \return 0 on success, or -1 on error. */ @@ -495,7 +492,7 @@ extern DECLSPEC int SDLCALL SDL_FillRects /** * Blends an RGBA value into the given rectangle. * - * If \c rect is NULL, the whole surface will be blended with \c color. + * If \c rect is NULL, the whole surface will be blended with the color. * * \return This function returns 0 on success, or -1 on error. */ @@ -506,6 +503,88 @@ extern DECLSPEC int SDLCALL SDL_BlendFillRects (SDL_Surface * dst, const SDL_Rect ** rects, int count, int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +#if 0 +/** + * Draws the given circle with \c color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_DrawCircle + (SDL_Surface * dst, int x, int y, int radius, Uint32 color); + +/** + * Blends an RGBA value into the outline of the given circle. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_BlendCircle + (SDL_Surface * dst, int x, int y, int radius, + int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); + +/** + * Fills the given circle with \c color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_FillCircle + (SDL_Surface * dst, int x, int y, int radius, Uint32 color); + +/** + * Blends an RGBA value into the given circle. + * + * \return This function returns 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_BlendFillCircle + (SDL_Surface * dst, int x, int y, int radius, + int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); + +/** + * Draws the given ellipse with \c color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_DrawEllipse + (SDL_Surface * dst, int x, int y, int w, int h, Uint32 color); + +/** + * Blends an RGBA value into the outline of the given ellipse. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_BlendEllipse + (SDL_Surface * dst, int x, int y, int w, int h, + int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); + +/** + * Fills the given ellipse with \c color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_FillEllipse + (SDL_Surface * dst, int x, int y, int w, int h, Uint32 color); + +/** + * Blends an RGBA value into the given ellipse. + * + * \return This function returns 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_BlendFillEllipse + (SDL_Surface * dst, int x, int y, int w, int h, + int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +#endif // 0 + /** * Performs a fast blit from the source surface to the destination surface. * diff --git a/include/SDL_video.h b/include/SDL_video.h index 63b18ca0..e8196c29 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -1138,6 +1138,11 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode); extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode); /** + * \brief Clear the current rendering target with the drawing color + */ +extern DECLSPEC int SDLCALL SDL_RenderClear(); + +/** * \brief Draw a point on the current rendering target. * * \param x The x coordinate of the point. @@ -1145,7 +1150,7 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode); * * \return 0 on success, or -1 if there is no rendering context current. */ -extern DECLSPEC int SDLCALL SDL_RenderPoint(int x, int y); +extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(int x, int y); /** * \brief Draw some number of points on the current rendering target. @@ -1155,8 +1160,8 @@ extern DECLSPEC int SDLCALL SDL_RenderPoint(int x, int y); * * \return 0 on success, or -1 if there is no rendering context current. */ -extern DECLSPEC int SDLCALL SDL_RenderPoints(const SDL_Point * points, - int count); +extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(const SDL_Point * points, + int count); /** * \brief Draw a line on the current rendering target. @@ -1168,7 +1173,7 @@ extern DECLSPEC int SDLCALL SDL_RenderPoints(const SDL_Point * points, * * \return 0 on success, or -1 if there is no rendering context current. */ -extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2); +extern DECLSPEC int SDLCALL SDL_RenderDrawLine(int x1, int y1, int x2, int y2); /** * \brief Draw a series of connected lines on the current rendering target. @@ -1178,18 +1183,37 @@ extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2); * * \return 0 on success, or -1 if there is no rendering context current. */ -extern DECLSPEC int SDLCALL SDL_RenderLines(const SDL_Point * points, - int count); +extern DECLSPEC int SDLCALL SDL_RenderDrawLines(const SDL_Point * points, + int count); + +/** + * \brief Draw a rectangle on the current rendering target with the drawing color. + * + * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * \return 0 on success, or -1 if there is no rendering context current. + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRect(const SDL_Rect * rect); /** - * \brief Fill the current rendering target with the drawing color. + * \brief Draw some number of rectangles in the current rendering target with the drawing color. + * + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 if there is no rendering context current. + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRects(const SDL_Rect ** rect, int count); + +/** + * \brief Fill a rectangle on the current rendering target with the drawing color. * * \param rect A pointer to the destination rectangle, or NULL for the entire * rendering target. * * \return 0 on success, or -1 if there is no rendering context current. */ -extern DECLSPEC int SDLCALL SDL_RenderRect(const SDL_Rect * rect); +extern DECLSPEC int SDLCALL SDL_RenderFillRect(const SDL_Rect * rect); /** * \brief Fill some number of rectangles in the current rendering target with the drawing color. @@ -1199,7 +1223,37 @@ extern DECLSPEC int SDLCALL SDL_RenderRect(const SDL_Rect * rect); * * \return 0 on success, or -1 if there is no rendering context current. */ -extern DECLSPEC int SDLCALL SDL_RenderRects(const SDL_Rect ** rect, int count); +extern DECLSPEC int SDLCALL SDL_RenderFillRects(const SDL_Rect ** rect, int count); + +#if 0 +/** + * \brief Draw a circle on the current rendering target with the drawing color. + * + * \return 0 on success, or -1 if there is no rendering context current. + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawCircle(int x, int y, int radius); + +/** + * \brief Fill a circle on the current rendering target with the drawing color. + * + * \return 0 on success, or -1 if there is no rendering context current. + */ +extern DECLSPEC int SDLCALL SDL_RenderFillCircle(int x, int y, int radius); + +/** + * \brief Draw an ellipse on the current rendering target with the drawing color. + * + * \return 0 on success, or -1 if there is no rendering context current. + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawEllipse(int x, int y, int w, int h); + +/** + * \brief Fill an ellipse on the current rendering target with the drawing color. + * + * \return 0 on success, or -1 if there is no rendering context current. + */ +extern DECLSPEC int SDLCALL SDL_RenderFillEllipse(int x, int y, int w, int h); +#endif // 0 /** * \brief Copy a portion of the texture to the current rendering target. |