comparison include/SDL_video.h @ 2266:e61ad15a205f

More work in progress integrating SDL_Surface and the new SDL_Texture API
author Sam Lantinga <slouken@libsdl.org>
date Sat, 18 Aug 2007 01:44:21 +0000
parents 926294b2bb4e
children c785543d1843
comparison
equal deleted inserted replaced
2265:265bb136af92 2266:e61ad15a205f
263 263
264 264
265 /* These are the currently supported flags for the SDL_surface */ 265 /* These are the currently supported flags for the SDL_surface */
266 /* Used internally (read-only) */ 266 /* Used internally (read-only) */
267 #define SDL_PREALLOC 0x00000001 /* Surface uses preallocated memory */ 267 #define SDL_PREALLOC 0x00000001 /* Surface uses preallocated memory */
268 #define SDL_SRCALPHA 0x00000004 /* Blit uses source alpha blending */ 268 #define SDL_RLEACCEL 0x00000001 /* Surface is RLE encoded */
269 #define SDL_SRCCOLORKEY 0x00000008 /* Blit uses a source color key */
270 #define SDL_RLEACCELOK 0x00000010 /* Private flag */
271 #define SDL_RLEACCEL 0x00000020 /* Surface is RLE encoded */
272 269
273 /* Evaluates to true if the surface needs to be locked before access */ 270 /* Evaluates to true if the surface needs to be locked before access */
274 #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) 271 #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
275 272
276 /* This structure should be treated as read-only, except for 'pixels', 273 /* This structure should be treated as read-only, except for 'pixels',
1399 /* Convenience macro -- save a surface to a file */ 1396 /* Convenience macro -- save a surface to a file */
1400 #define SDL_SaveBMP(surface, file) \ 1397 #define SDL_SaveBMP(surface, file) \
1401 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) 1398 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
1402 1399
1403 /* 1400 /*
1404 * Sets the color key (transparent pixel) in a blittable surface. 1401 * \fn int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
1405 * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), 1402 *
1406 * 'key' will be the transparent pixel in the source image of a blit. 1403 * \brief Sets the RLE acceleration hint for a surface.
1407 * SDL_RLEACCEL requests RLE acceleration for the surface if present, 1404 *
1408 * and removes RLE acceleration if absent. 1405 * \return 0 on success, or -1 if the surface is not valid
1409 * If 'flag' is 0, this function clears any current color key. 1406 *
1410 * This function returns 0, or -1 if there was an error. 1407 * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
1411 */ 1408 * but the surface must be locked before directly accessing the pixels.
1412 extern DECLSPEC int SDLCALL SDL_SetColorKey 1409 */
1413 (SDL_Surface * surface, Uint32 flag, Uint32 key); 1410 extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
1414 1411
1415 /* 1412 /*
1416 * This function sets the alpha value for the entire surface, as opposed to 1413 * \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
1417 * using the alpha component of each pixel. This value measures the range 1414 *
1418 * of transparency of the surface, 0 being completely transparent to 255 1415 * \brief Sets the color key (transparent pixel) in a blittable surface.
1419 * being completely opaque. An 'alpha' value of 255 causes blits to be 1416 *
1420 * opaque, the source pixels copied to the destination (the default). Note 1417 * \param surface The surface to update
1421 * that per-surface alpha can be combined with colorkey transparency. 1418 * \param flag Non-zero to enable colorkey and 0 to disable colorkey
1422 * 1419 * \param key The transparent pixel in the native surface format
1423 * If 'flag' is 0, alpha blending is disabled for the surface. 1420 *
1424 * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. 1421 * \return 0 on success, or -1 if the surface is not valid
1425 * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the 1422 */
1426 * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. 1423 extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
1427 * 1424
1428 * The 'alpha' parameter is ignored for surfaces that have an alpha channel. 1425 /**
1429 */ 1426 * \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
1430 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, 1427 *
1431 Uint8 alpha); 1428 * \brief Set an additional color value used in blit operations
1429 *
1430 * \param surface The surface to update
1431 * \param r The red source color value multiplied into blit operations
1432 * \param g The green source color value multiplied into blit operations
1433 * \param b The blue source color value multiplied into blit operations
1434 *
1435 * \return 0 on success, or -1 if the surface is not valid
1436 *
1437 * \sa SDL_GetSurfaceColorMod()
1438 */
1439 extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface,
1440 Uint8 r, Uint8 g, Uint8 b);
1441
1442
1443 /**
1444 * \fn int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
1445 *
1446 * \brief Get the additional color value used in blit operations
1447 *
1448 * \param surface The surface to query
1449 * \param r A pointer filled in with the source red color value
1450 * \param g A pointer filled in with the source green color value
1451 * \param b A pointer filled in with the source blue color value
1452 *
1453 * \return 0 on success, or -1 if the surface is not valid
1454 *
1455 * \sa SDL_SetSurfaceColorMod()
1456 */
1457 extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface,
1458 Uint8 * r, Uint8 * g,
1459 Uint8 * b);
1460
1461 /**
1462 * \fn int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
1463 *
1464 * \brief Set an additional alpha value used in blit operations
1465 *
1466 * \param surface The surface to update
1467 * \param alpha The source alpha value multiplied into blit operations.
1468 *
1469 * \return 0 on success, or -1 if the surface is not valid
1470 *
1471 * \sa SDL_GetSurfaceAlphaMod()
1472 */
1473 extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface,
1474 Uint8 alpha);
1475
1476 /**
1477 * \fn int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
1478 *
1479 * \brief Get the additional alpha value used in blit operations
1480 *
1481 * \param surface The surface to query
1482 * \param alpha A pointer filled in with the source alpha value
1483 *
1484 * \return 0 on success, or -1 if the surface is not valid
1485 *
1486 * \sa SDL_SetSurfaceAlphaMod()
1487 */
1488 extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface,
1489 Uint8 * alpha);
1490
1491 /**
1492 * \fn int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
1493 *
1494 * \brief Set the blend mode used for blit operations
1495 *
1496 * \param surface The surface to update
1497 * \param blendMode SDL_TextureBlendMode to use for blit blending
1498 *
1499 * \return 0 on success, or -1 if the parameters are not valid
1500 *
1501 * \sa SDL_GetSurfaceBlendMode()
1502 */
1503 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface,
1504 int blendMode);
1505
1506 /**
1507 * \fn int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
1508 *
1509 * \brief Get the blend mode used for blit operations
1510 *
1511 * \param surface The surface to query
1512 * \param blendMode A pointer filled in with the current blend mode
1513 *
1514 * \return 0 on success, or -1 if the surface is not valid
1515 *
1516 * \sa SDL_SetSurfaceBlendMode()
1517 */
1518 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface,
1519 int *blendMode);
1520
1521 /**
1522 * \fn int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
1523 *
1524 * \brief Set the scale mode used for blit operations
1525 *
1526 * \param surface The surface to update
1527 * \param scaleMode SDL_TextureScaleMode to use for blit scaling
1528 *
1529 * \return 0 on success, or -1 if the surface is not valid or the scale mode is not supported
1530 *
1531 * \note If the scale mode is not supported, the closest supported mode is chosen. Currently only SDL_TEXTURESCALEMODE_FAST is supported on surfaces.
1532 *
1533 * \sa SDL_GetSurfaceScaleMode()
1534 */
1535 extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface *surface,
1536 int scaleMode);
1537
1538 /**
1539 * \fn int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
1540 *
1541 * \brief Get the scale mode used for blit operations
1542 *
1543 * \param surface The surface to query
1544 * \param scaleMode A pointer filled in with the current scale mode
1545 *
1546 * \return 0 on success, or -1 if the surface is not valid
1547 *
1548 * \sa SDL_SetSurfaceScaleMode()
1549 */
1550 extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface *surface,
1551 int *scaleMode);
1432 1552
1433 /* 1553 /*
1434 * Sets the clipping rectangle for the destination surface in a blit. 1554 * Sets the clipping rectangle for the destination surface in a blit.
1435 * 1555 *
1436 * If the clip rectangle is NULL, clipping will be disabled. 1556 * If the clip rectangle is NULL, clipping will be disabled.