comparison include/SDL_surface.h @ 4929:aa8888658021

Use the enumerated type for blend and scale mode instead of int Renamed SDL_TextureScaleMode to SDL_ScaleMode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Dec 2010 15:19:05 -0800
parents 274743af0430
children 68da5a234bba
comparison
equal deleted inserted replaced
4927:d716dff4b13e 4929:aa8888658021
30 #define _SDL_surface_h 30 #define _SDL_surface_h
31 31
32 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
33 #include "SDL_pixels.h" 33 #include "SDL_pixels.h"
34 #include "SDL_rect.h" 34 #include "SDL_rect.h"
35 #include "SDL_blendmode.h"
36 #include "SDL_scalemode.h"
35 #include "SDL_rwops.h" 37 #include "SDL_rwops.h"
36 38
37 #include "begin_code.h" 39 #include "begin_code.h"
38 /* Set up for C function definitions, even when using C++ */ 40 /* Set up for C function definitions, even when using C++ */
39 #ifdef __cplusplus 41 #ifdef __cplusplus
86 88
87 /** info for fast blit mapping to other surfaces */ 89 /** info for fast blit mapping to other surfaces */
88 struct SDL_BlitMap *map; /**< Private */ 90 struct SDL_BlitMap *map; /**< Private */
89 91
90 /** format version, bumped at every change to invalidate blit maps */ 92 /** format version, bumped at every change to invalidate blit maps */
91 unsigned int format_version; /**< Private */ 93 int format_version; /**< Private */
92 94
93 /** Reference count -- used when freeing surface */ 95 /** Reference count -- used when freeing surface */
94 int refcount; /**< Read-mostly */ 96 int refcount; /**< Read-mostly */
95 } SDL_Surface; 97 } SDL_Surface;
96 98
298 * \return 0 on success, or -1 if the parameters are not valid. 300 * \return 0 on success, or -1 if the parameters are not valid.
299 * 301 *
300 * \sa SDL_GetSurfaceBlendMode() 302 * \sa SDL_GetSurfaceBlendMode()
301 */ 303 */
302 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, 304 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
303 int blendMode); 305 SDL_BlendMode blendMode);
304 306
305 /** 307 /**
306 * \brief Get the blend mode used for blit operations. 308 * \brief Get the blend mode used for blit operations.
307 * 309 *
308 * \param surface The surface to query. 310 * \param surface The surface to query.
311 * \return 0 on success, or -1 if the surface is not valid. 313 * \return 0 on success, or -1 if the surface is not valid.
312 * 314 *
313 * \sa SDL_SetSurfaceBlendMode() 315 * \sa SDL_SetSurfaceBlendMode()
314 */ 316 */
315 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, 317 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
316 int *blendMode); 318 SDL_BlendMode *blendMode);
317 319
318 /** 320 /**
319 * \brief Set the scale mode used for blit operations. 321 * \brief Set the scale mode used for blit operations.
320 * 322 *
321 * \param surface The surface to update. 323 * \param surface The surface to update.
322 * \param scaleMode ::SDL_TextureScaleMode to use for blit scaling. 324 * \param scaleMode ::SDL_ScaleMode to use for blit scaling.
323 * 325 *
324 * \return 0 on success, or -1 if the surface is not valid or the scale mode is 326 * \return 0 on success, or -1 if the surface is not valid or the scale mode is
325 * not supported. 327 * not supported.
326 * 328 *
327 * \note If the scale mode is not supported, the closest supported mode is 329 * \note If the scale mode is not supported, the closest supported mode is
329 * surfaces. 331 * surfaces.
330 * 332 *
331 * \sa SDL_GetSurfaceScaleMode() 333 * \sa SDL_GetSurfaceScaleMode()
332 */ 334 */
333 extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface, 335 extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
334 int scaleMode); 336 SDL_ScaleMode scaleMode);
335 337
336 /** 338 /**
337 * \brief Get the scale mode used for blit operations. 339 * \brief Get the scale mode used for blit operations.
338 * 340 *
339 * \param surface The surface to query. 341 * \param surface The surface to query.
342 * \return 0 on success, or -1 if the surface is not valid. 344 * \return 0 on success, or -1 if the surface is not valid.
343 * 345 *
344 * \sa SDL_SetSurfaceScaleMode() 346 * \sa SDL_SetSurfaceScaleMode()
345 */ 347 */
346 extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface, 348 extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
347 int *scaleMode); 349 SDL_ScaleMode *scaleMode);
348 350
349 /** 351 /**
350 * Sets the clipping rectangle for the destination surface in a blit. 352 * Sets the clipping rectangle for the destination surface in a blit.
351 * 353 *
352 * If the clip rectangle is NULL, clipping will be disabled. 354 * If the clip rectangle is NULL, clipping will be disabled.
411 * 413 *
412 * \return 0 on success, or -1 on error. 414 * \return 0 on success, or -1 on error.
413 */ 415 */
414 extern DECLSPEC int SDLCALL SDL_BlendPoint 416 extern DECLSPEC int SDLCALL SDL_BlendPoint
415 (SDL_Surface * dst, int x, int y, 417 (SDL_Surface * dst, int x, int y,
416 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 418 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
417 extern DECLSPEC int SDLCALL SDL_BlendPoints 419 extern DECLSPEC int SDLCALL SDL_BlendPoints
418 (SDL_Surface * dst, const SDL_Point * points, int count, 420 (SDL_Surface * dst, const SDL_Point * points, int count,
419 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 421 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
420 422
421 /** 423 /**
422 * Draws a line with \c color. 424 * Draws a line with \c color.
423 * 425 *
424 * The color should be a pixel of the format used by the surface, and 426 * The color should be a pixel of the format used by the surface, and
436 * 438 *
437 * \return 0 on success, or -1 on error. 439 * \return 0 on success, or -1 on error.
438 */ 440 */
439 extern DECLSPEC int SDLCALL SDL_BlendLine 441 extern DECLSPEC int SDLCALL SDL_BlendLine
440 (SDL_Surface * dst, int x1, int y1, int x2, int y2, 442 (SDL_Surface * dst, int x1, int y1, int x2, int y2,
441 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 443 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
442 extern DECLSPEC int SDLCALL SDL_BlendLines 444 extern DECLSPEC int SDLCALL SDL_BlendLines
443 (SDL_Surface * dst, const SDL_Point * points, int count, 445 (SDL_Surface * dst, const SDL_Point * points, int count,
444 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 446 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
445 447
446 /** 448 /**
447 * Draws the given rectangle with \c color. 449 * Draws the given rectangle with \c color.
448 * 450 *
449 * If \c rect is NULL, the whole surface will be outlined with \c color. 451 * If \c rect is NULL, the whole surface will be outlined with \c color.
465 * 467 *
466 * \return 0 on success, or -1 on error. 468 * \return 0 on success, or -1 on error.
467 */ 469 */
468 extern DECLSPEC int SDLCALL SDL_BlendRect 470 extern DECLSPEC int SDLCALL SDL_BlendRect
469 (SDL_Surface * dst, const SDL_Rect * rect, 471 (SDL_Surface * dst, const SDL_Rect * rect,
470 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 472 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
471 extern DECLSPEC int SDLCALL SDL_BlendRects 473 extern DECLSPEC int SDLCALL SDL_BlendRects
472 (SDL_Surface * dst, const SDL_Rect ** rects, int count, 474 (SDL_Surface * dst, const SDL_Rect ** rects, int count,
473 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 475 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
474 476
475 /** 477 /**
476 * Performs a fast fill of the given rectangle with \c color. 478 * Performs a fast fill of the given rectangle with \c color.
477 * 479 *
478 * If \c rect is NULL, the whole surface will be filled with \c color. 480 * If \c rect is NULL, the whole surface will be filled with \c color.
494 * 496 *
495 * \return This function returns 0 on success, or -1 on error. 497 * \return This function returns 0 on success, or -1 on error.
496 */ 498 */
497 extern DECLSPEC int SDLCALL SDL_BlendFillRect 499 extern DECLSPEC int SDLCALL SDL_BlendFillRect
498 (SDL_Surface * dst, const SDL_Rect * rect, 500 (SDL_Surface * dst, const SDL_Rect * rect,
499 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 501 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
500 extern DECLSPEC int SDLCALL SDL_BlendFillRects 502 extern DECLSPEC int SDLCALL SDL_BlendFillRects
501 (SDL_Surface * dst, const SDL_Rect ** rects, int count, 503 (SDL_Surface * dst, const SDL_Rect ** rects, int count,
502 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); 504 SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
503
504 #if 0
505 /**
506 * Draws the given circle with \c color.
507 *
508 * The color should be a pixel of the format used by the surface, and
509 * can be generated by the SDL_MapRGB() function.
510 *
511 * \return 0 on success, or -1 on error.
512 */
513 extern DECLSPEC int SDLCALL SDL_DrawCircle
514 (SDL_Surface * dst, int x, int y, int radius, Uint32 color);
515
516 /**
517 * Blends an RGBA value into the outline of the given circle.
518 *
519 * \return 0 on success, or -1 on error.
520 */
521 extern DECLSPEC int SDLCALL SDL_BlendCircle
522 (SDL_Surface * dst, int x, int y, int radius,
523 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
524
525 /**
526 * Fills the given circle with \c color.
527 *
528 * The color should be a pixel of the format used by the surface, and
529 * can be generated by the SDL_MapRGB() function.
530 *
531 * \return 0 on success, or -1 on error.
532 */
533 extern DECLSPEC int SDLCALL SDL_FillCircle
534 (SDL_Surface * dst, int x, int y, int radius, Uint32 color);
535
536 /**
537 * Blends an RGBA value into the given circle.
538 *
539 * \return This function returns 0 on success, or -1 on error.
540 */
541 extern DECLSPEC int SDLCALL SDL_BlendFillCircle
542 (SDL_Surface * dst, int x, int y, int radius,
543 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
544
545 /**
546 * Draws the given ellipse with \c color.
547 *
548 * The color should be a pixel of the format used by the surface, and
549 * can be generated by the SDL_MapRGB() function.
550 *
551 * \return 0 on success, or -1 on error.
552 */
553 extern DECLSPEC int SDLCALL SDL_DrawEllipse
554 (SDL_Surface * dst, int x, int y, int w, int h, Uint32 color);
555
556 /**
557 * Blends an RGBA value into the outline of the given ellipse.
558 *
559 * \return 0 on success, or -1 on error.
560 */
561 extern DECLSPEC int SDLCALL SDL_BlendEllipse
562 (SDL_Surface * dst, int x, int y, int w, int h,
563 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
564
565 /**
566 * Fills the given ellipse with \c color.
567 *
568 * The color should be a pixel of the format used by the surface, and
569 * can be generated by the SDL_MapRGB() function.
570 *
571 * \return 0 on success, or -1 on error.
572 */
573 extern DECLSPEC int SDLCALL SDL_FillEllipse
574 (SDL_Surface * dst, int x, int y, int w, int h, Uint32 color);
575
576 /**
577 * Blends an RGBA value into the given ellipse.
578 *
579 * \return This function returns 0 on success, or -1 on error.
580 */
581 extern DECLSPEC int SDLCALL SDL_BlendFillEllipse
582 (SDL_Surface * dst, int x, int y, int w, int h,
583 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
584 #endif // 0
585 505
586 /** 506 /**
587 * Performs a fast blit from the source surface to the destination surface. 507 * Performs a fast blit from the source surface to the destination surface.
588 * 508 *
589 * This assumes that the source and destination rectangles are 509 * This assumes that the source and destination rectangles are