comparison include/SDL_video.h @ 2275:12ea0fdc0df2

Split out the SDL_rect and SDL_surface functions into their own headers. Removed unused count from the dirty rect list.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Sep 2007 12:20:02 +0000
parents c785543d1843
children 478fa831910f 47519ce71def
comparison
equal deleted inserted replaced
2274:aedfcdeb69b6 2275:12ea0fdc0df2
21 */ 21 */
22 22
23 /** 23 /**
24 * \file SDL_video.h 24 * \file SDL_video.h
25 * 25 *
26 * Header file for access to the SDL raw framebuffer window 26 * Header file for SDL video functions.
27 */ 27 */
28 28
29 #ifndef _SDL_video_h 29 #ifndef _SDL_video_h
30 #define _SDL_video_h 30 #define _SDL_video_h
31 31
32 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
33 #include "SDL_error.h"
34 #include "SDL_pixels.h" 33 #include "SDL_pixels.h"
35 #include "SDL_rwops.h" 34 #include "SDL_rect.h"
35 #include "SDL_surface.h"
36 36
37 #include "begin_code.h" 37 #include "begin_code.h"
38 /* Set up for C function definitions, even when using C++ */ 38 /* Set up for C function definitions, even when using C++ */
39 #ifdef __cplusplus 39 #ifdef __cplusplus
40 /* *INDENT-OFF* */ 40 /* *INDENT-OFF* */
41 extern "C" { 41 extern "C" {
42 /* *INDENT-ON* */ 42 /* *INDENT-ON* */
43 #endif 43 #endif
44
45 /* Transparency definitions: These define alpha as the opacity of a surface */
46 #define SDL_ALPHA_OPAQUE 255
47 #define SDL_ALPHA_TRANSPARENT 0
48
49 /**
50 * \struct SDL_Rect
51 *
52 * \brief A rectangle, with the origin at the upper left.
53 */
54 typedef struct SDL_Rect
55 {
56 int x, y;
57 int w, h;
58 } SDL_Rect;
59 44
60 /** 45 /**
61 * \struct SDL_DisplayMode 46 * \struct SDL_DisplayMode
62 * 47 *
63 * \brief The structure that defines a display mode 48 * \brief The structure that defines a display mode
259 * 244 *
260 * \brief An opaque handle to an OpenGL context. 245 * \brief An opaque handle to an OpenGL context.
261 */ 246 */
262 typedef void *SDL_GLContext; 247 typedef void *SDL_GLContext;
263 248
264
265 /* These are the currently supported flags for the SDL_surface */
266 /* Used internally (read-only) */
267 #define SDL_PREALLOC 0x00000001 /* Surface uses preallocated memory */
268 #define SDL_RLEACCEL 0x00000002 /* Surface is RLE encoded */
269
270 /* Evaluates to true if the surface needs to be locked before access */
271 #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
272
273 /* This structure should be treated as read-only, except for 'pixels',
274 which, if not NULL, contains the raw pixel data for the surface.
275 */
276 typedef struct SDL_Surface
277 {
278 Uint32 flags; /* Read-only */
279 SDL_PixelFormat *format; /* Read-only */
280 int w, h; /* Read-only */
281 int pitch; /* Read-only */
282 void *pixels; /* Read-write */
283
284 /* Application data associated with the surfade */
285 void *userdata; /* Read-write */
286
287 /* information needed for surfaces requiring locks */
288 int locked; /* Read-only */
289 void *lock_data; /* Read-only */
290
291 /* clipping information */
292 SDL_Rect clip_rect; /* Read-only */
293
294 /* info for fast blit mapping to other surfaces */
295 struct SDL_BlitMap *map; /* Private */
296
297 /* format version, bumped at every change to invalidate blit maps */
298 unsigned int format_version; /* Private */
299
300 /* Reference count -- used when freeing surface */
301 int refcount; /* Read-mostly */
302 } SDL_Surface;
303
304 /* typedef for private surface blitting functions */
305 typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
306 struct SDL_Surface * dst, SDL_Rect * dstrect);
307
308
309 /** 249 /**
310 * \enum SDL_GLattr 250 * \enum SDL_GLattr
311 * 251 *
312 * \brief OpenGL configuration attributes 252 * \brief OpenGL configuration attributes
313 */ 253 */
1288 * 1228 *
1289 * \sa SDL_CreateRenderer() 1229 * \sa SDL_CreateRenderer()
1290 */ 1230 */
1291 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); 1231 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
1292 1232
1293 /*
1294 * Maps an RGB triple to an opaque pixel value for a given pixel format
1295 */
1296 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat *
1297 const format, const Uint8 r,
1298 const Uint8 g, const Uint8 b);
1299
1300 /*
1301 * Maps an RGBA quadruple to a pixel value for a given pixel format
1302 */
1303 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * const fmt,
1304 const Uint8 r, const Uint8 g,
1305 const Uint8 b, const Uint8 a);
1306
1307 /*
1308 * Maps a pixel value into the RGB components for a given pixel format
1309 */
1310 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt,
1311 Uint8 * r, Uint8 * g, Uint8 * b);
1312
1313 /*
1314 * Maps a pixel value into the RGBA components for a given pixel format
1315 */
1316 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
1317 Uint8 * r, Uint8 * g, Uint8 * b,
1318 Uint8 * a);
1319
1320 /*
1321 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
1322 * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
1323 * If the depth is greater than 8 bits, the pixel format is set using the
1324 * flags '[RGB]mask'.
1325 * If the function runs out of memory, it will return NULL.
1326 *
1327 * The 'flags' tell what kind of surface to create.
1328 * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
1329 * SDL_SRCALPHA means that the surface will be used for alpha blits.
1330 */
1331 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
1332 (Uint32 flags, int width, int height, int depth,
1333 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
1334 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
1335 int width,
1336 int height,
1337 int depth,
1338 int pitch,
1339 Uint32 Rmask,
1340 Uint32 Gmask,
1341 Uint32 Bmask,
1342 Uint32 Amask);
1343 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
1344
1345 /**
1346 * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
1347 *
1348 * \brief Set the palette used by a surface.
1349 *
1350 * \return 0, or -1 if the surface format doesn't use a palette.
1351 *
1352 * \note A single palette can be shared with many surfaces.
1353 */
1354 extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
1355 SDL_Palette * palette);
1356
1357 /*
1358 * SDL_LockSurface() sets up a surface for directly accessing the pixels.
1359 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
1360 * to and read from 'surface->pixels', using the pixel format stored in
1361 * 'surface->format'. Once you are done accessing the surface, you should
1362 * use SDL_UnlockSurface() to release it.
1363 *
1364 * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
1365 * to 0, then you can read and write to the surface at any time, and the
1366 * pixel format of the surface will not change.
1367 *
1368 * No operating system or library calls should be made between lock/unlock
1369 * pairs, as critical system locks may be held during this time.
1370 *
1371 * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
1372 */
1373 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
1374 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
1375
1376 /*
1377 * Load a surface from a seekable SDL data source (memory or file.)
1378 * If 'freesrc' is non-zero, the source will be closed after being read.
1379 * Returns the new surface, or NULL if there was an error.
1380 * The new surface should be freed with SDL_FreeSurface().
1381 */
1382 extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
1383 int freesrc);
1384
1385 /* Convenience macro -- load a surface from a file */
1386 #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
1387
1388 /*
1389 * Save a surface to a seekable SDL data source (memory or file.)
1390 * If 'freedst' is non-zero, the source will be closed after being written.
1391 * Returns 0 if successful or -1 if there was an error.
1392 */
1393 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
1394 (SDL_Surface * surface, SDL_RWops * dst, int freedst);
1395
1396 /* Convenience macro -- save a surface to a file */
1397 #define SDL_SaveBMP(surface, file) \
1398 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
1399
1400 /*
1401 * \fn int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
1402 *
1403 * \brief Sets the RLE acceleration hint for a surface.
1404 *
1405 * \return 0 on success, or -1 if the surface is not valid
1406 *
1407 * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
1408 * but the surface must be locked before directly accessing the pixels.
1409 */
1410 extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
1411 int flag);
1412
1413 /*
1414 * \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
1415 *
1416 * \brief Sets the color key (transparent pixel) in a blittable surface.
1417 *
1418 * \param surface The surface to update
1419 * \param flag Non-zero to enable colorkey and 0 to disable colorkey
1420 * \param key The transparent pixel in the native surface format
1421 *
1422 * \return 0 on success, or -1 if the surface is not valid
1423 */
1424 extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
1425 Uint32 flag, Uint32 key);
1426
1427 /**
1428 * \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
1429 *
1430 * \brief Set an additional color value used in blit operations
1431 *
1432 * \param surface The surface to update
1433 * \param r The red source color value multiplied into blit operations
1434 * \param g The green source color value multiplied into blit operations
1435 * \param b The blue source color value multiplied into blit operations
1436 *
1437 * \return 0 on success, or -1 if the surface is not valid
1438 *
1439 * \sa SDL_GetSurfaceColorMod()
1440 */
1441 extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
1442 Uint8 r, Uint8 g, Uint8 b);
1443
1444
1445 /**
1446 * \fn int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
1447 *
1448 * \brief Get the additional color value used in blit operations
1449 *
1450 * \param surface The surface to query
1451 * \param r A pointer filled in with the source red color value
1452 * \param g A pointer filled in with the source green color value
1453 * \param b A pointer filled in with the source blue color value
1454 *
1455 * \return 0 on success, or -1 if the surface is not valid
1456 *
1457 * \sa SDL_SetSurfaceColorMod()
1458 */
1459 extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
1460 Uint8 * r, Uint8 * g,
1461 Uint8 * b);
1462
1463 /**
1464 * \fn int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
1465 *
1466 * \brief Set an additional alpha value used in blit operations
1467 *
1468 * \param surface The surface to update
1469 * \param alpha The source alpha value multiplied into blit operations.
1470 *
1471 * \return 0 on success, or -1 if the surface is not valid
1472 *
1473 * \sa SDL_GetSurfaceAlphaMod()
1474 */
1475 extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
1476 Uint8 alpha);
1477
1478 /**
1479 * \fn int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
1480 *
1481 * \brief Get the additional alpha value used in blit operations
1482 *
1483 * \param surface The surface to query
1484 * \param alpha A pointer filled in with the source alpha value
1485 *
1486 * \return 0 on success, or -1 if the surface is not valid
1487 *
1488 * \sa SDL_SetSurfaceAlphaMod()
1489 */
1490 extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
1491 Uint8 * alpha);
1492
1493 /**
1494 * \fn int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
1495 *
1496 * \brief Set the blend mode used for blit operations
1497 *
1498 * \param surface The surface to update
1499 * \param blendMode SDL_TextureBlendMode to use for blit blending
1500 *
1501 * \return 0 on success, or -1 if the parameters are not valid
1502 *
1503 * \sa SDL_GetSurfaceBlendMode()
1504 */
1505 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
1506 int blendMode);
1507
1508 /**
1509 * \fn int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
1510 *
1511 * \brief Get the blend mode used for blit operations
1512 *
1513 * \param surface The surface to query
1514 * \param blendMode A pointer filled in with the current blend mode
1515 *
1516 * \return 0 on success, or -1 if the surface is not valid
1517 *
1518 * \sa SDL_SetSurfaceBlendMode()
1519 */
1520 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
1521 int *blendMode);
1522
1523 /**
1524 * \fn int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
1525 *
1526 * \brief Set the scale mode used for blit operations
1527 *
1528 * \param surface The surface to update
1529 * \param scaleMode SDL_TextureScaleMode to use for blit scaling
1530 *
1531 * \return 0 on success, or -1 if the surface is not valid or the scale mode is not supported
1532 *
1533 * \note If the scale mode is not supported, the closest supported mode is chosen. Currently only SDL_TEXTURESCALEMODE_FAST is supported on surfaces.
1534 *
1535 * \sa SDL_GetSurfaceScaleMode()
1536 */
1537 extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
1538 int scaleMode);
1539
1540 /**
1541 * \fn int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
1542 *
1543 * \brief Get the scale mode used for blit operations
1544 *
1545 * \param surface The surface to query
1546 * \param scaleMode A pointer filled in with the current scale mode
1547 *
1548 * \return 0 on success, or -1 if the surface is not valid
1549 *
1550 * \sa SDL_SetSurfaceScaleMode()
1551 */
1552 extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
1553 int *scaleMode);
1554
1555 /*
1556 * Sets the clipping rectangle for the destination surface in a blit.
1557 *
1558 * If the clip rectangle is NULL, clipping will be disabled.
1559 * If the clip rectangle doesn't intersect the surface, the function will
1560 * return SDL_FALSE and blits will be completely clipped. Otherwise the
1561 * function returns SDL_TRUE and blits to the surface will be clipped to
1562 * the intersection of the surface area and the clipping rectangle.
1563 *
1564 * Note that blits are automatically clipped to the edges of the source
1565 * and destination surfaces.
1566 */
1567 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
1568 const SDL_Rect * rect);
1569
1570 /*
1571 * Gets the clipping rectangle for the destination surface in a blit.
1572 * 'rect' must be a pointer to a valid rectangle which will be filled
1573 * with the correct values.
1574 */
1575 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
1576 SDL_Rect * rect);
1577
1578 /*
1579 * Creates a new surface of the specified format, and then copies and maps
1580 * the given surface to it so the blit of the converted surface will be as
1581 * fast as possible. If this function fails, it returns NULL.
1582 *
1583 * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
1584 * semantics. You can also pass SDL_RLEACCEL in the flags parameter and
1585 * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
1586 * surface.
1587 *
1588 * This function is used internally by SDL_DisplayFormat().
1589 */
1590 extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
1591 (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
1592
1593 /*
1594 * This function performs a fast fill of the given rectangle with 'color'
1595 * The given rectangle is clipped to the destination surface clip area
1596 * and the final fill rectangle is saved in the passed in pointer.
1597 * If 'dstrect' is NULL, the whole surface will be filled with 'color'
1598 * The color should be a pixel of the format used by the surface, and
1599 * can be generated by the SDL_MapRGB() function.
1600 * This function returns 0 on success, or -1 on error.
1601 */
1602 extern DECLSPEC int SDLCALL SDL_FillRect
1603 (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
1604
1605 /*
1606 * This performs a fast blit from the source surface to the destination
1607 * surface. It assumes that the source and destination rectangles are
1608 * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
1609 * surface (src or dst) is copied. The final blit rectangles are saved
1610 * in 'srcrect' and 'dstrect' after all clipping is performed.
1611 * If the blit is successful, it returns 0, otherwise it returns -1.
1612 *
1613 * The blit function should not be called on a locked surface.
1614 *
1615 * The blit semantics for surfaces with and without alpha and colorkey
1616 * are defined as follows:
1617 *
1618 * RGBA->RGB:
1619 * SDL_SRCALPHA set:
1620 * alpha-blend (using alpha-channel).
1621 * SDL_SRCCOLORKEY ignored.
1622 * SDL_SRCALPHA not set:
1623 * copy RGB.
1624 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
1625 * RGB values of the source colour key, ignoring alpha in the
1626 * comparison.
1627 *
1628 * RGB->RGBA:
1629 * SDL_SRCALPHA set:
1630 * alpha-blend (using the source per-surface alpha value);
1631 * set destination alpha to opaque.
1632 * SDL_SRCALPHA not set:
1633 * copy RGB, set destination alpha to source per-surface alpha value.
1634 * both:
1635 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
1636 * source colour key.
1637 *
1638 * RGBA->RGBA:
1639 * SDL_SRCALPHA set:
1640 * alpha-blend (using the source alpha channel) the RGB values;
1641 * leave destination alpha untouched. [Note: is this correct?]
1642 * SDL_SRCCOLORKEY ignored.
1643 * SDL_SRCALPHA not set:
1644 * copy all of RGBA to the destination.
1645 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
1646 * RGB values of the source colour key, ignoring alpha in the
1647 * comparison.
1648 *
1649 * RGB->RGB:
1650 * SDL_SRCALPHA set:
1651 * alpha-blend (using the source per-surface alpha value).
1652 * SDL_SRCALPHA not set:
1653 * copy RGB.
1654 * both:
1655 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
1656 * source colour key.
1657 *
1658 * If either of the surfaces were in video memory, and the blit returns -2,
1659 * the video memory was lost, so it should be reloaded with artwork and
1660 * re-blitted:
1661 while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
1662 while ( SDL_LockSurface(image) < 0 )
1663 Sleep(10);
1664 -- Write image pixels to image->pixels --
1665 SDL_UnlockSurface(image);
1666 }
1667 * This happens under DirectX 5.0 when the system switches away from your
1668 * fullscreen application. The lock will also fail until you have access
1669 * to the video memory again.
1670 */
1671 /* You should call SDL_BlitSurface() unless you know exactly how SDL
1672 blitting works internally and how to use the other blit functions.
1673 */
1674 #define SDL_BlitSurface SDL_UpperBlit
1675
1676 /* This is the public blit function, SDL_BlitSurface(), and it performs
1677 rectangle validation and clipping before passing it to SDL_LowerBlit()
1678 */
1679 extern DECLSPEC int SDLCALL SDL_UpperBlit
1680 (SDL_Surface * src, SDL_Rect * srcrect,
1681 SDL_Surface * dst, SDL_Rect * dstrect);
1682 /* This is a semi-private blit function and it performs low-level surface
1683 blitting only.
1684 */
1685 extern DECLSPEC int SDLCALL SDL_LowerBlit
1686 (SDL_Surface * src, SDL_Rect * srcrect,
1687 SDL_Surface * dst, SDL_Rect * dstrect);
1688
1689 /**
1690 * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
1691 *
1692 * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
1693 *
1694 * \note This function uses a static buffer, and is not thread-safe.
1695 */
1696 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
1697 SDL_Rect * srcrect,
1698 SDL_Surface * dst,
1699 SDL_Rect * dstrect);
1700 1233
1701 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 1234 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1702 /* OpenGL support functions. */ 1235 /* OpenGL support functions. */
1703 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 1236 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1704 1237
1809 * 1342 *
1810 * \sa SDL_GL_CreateContext() 1343 * \sa SDL_GL_CreateContext()
1811 */ 1344 */
1812 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); 1345 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
1813 1346
1814 /**
1815 * \def SDL_RectEmpty()
1816 *
1817 * \brief Returns true if the rectangle has no area.
1818 */
1819 #define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0))
1820
1821 /**
1822 * \def SDL_RectEquals()
1823 *
1824 * \brief Returns true if the two rectangles are equal.
1825 */
1826 #define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
1827 ((A)->w == (B)->w) && ((A)->h == (B)->h))
1828
1829 /**
1830 * \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B);
1831 *
1832 * \brief Determine whether two rectangles intersect.
1833 *
1834 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
1835 */
1836 extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
1837 const SDL_Rect * B);
1838
1839 /**
1840 * \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
1841 *
1842 * \brief Calculate the intersection of two rectangles.
1843 *
1844 * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
1845 */
1846 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
1847 const SDL_Rect * B,
1848 SDL_Rect * result);
1849
1850 /**
1851 * \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
1852 *
1853 * \brief Calculate the union of two rectangles
1854 */
1855 extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
1856 const SDL_Rect * B,
1857 SDL_Rect * result);
1858 1347
1859 /* Ends C function definitions when using C++ */ 1348 /* Ends C function definitions when using C++ */
1860 #ifdef __cplusplus 1349 #ifdef __cplusplus
1861 /* *INDENT-OFF* */ 1350 /* *INDENT-OFF* */
1862 } 1351 }