comparison include/SDL_video.h @ 1681:80a5e6a4e1e2 SDL-1.3

Working on paletted display and texture support (two different issues)
author Sam Lantinga <slouken@libsdl.org>
date Thu, 15 Jun 2006 07:07:07 +0000
parents 90bf530ced8e
children 7ae8018b2e5d
comparison
equal deleted inserted replaced
1680:9488fca10677 1681:80a5e6a4e1e2
460 * \return 0 on success, or -1 if setting the display mode failed. 460 * \return 0 on success, or -1 if setting the display mode failed.
461 */ 461 */
462 extern DECLSPEC int SDLCALL SDL_SetDisplayMode(const SDL_DisplayMode * mode); 462 extern DECLSPEC int SDLCALL SDL_SetDisplayMode(const SDL_DisplayMode * mode);
463 463
464 /** 464 /**
465 * \fn int SDL_SetDisplayColormap(SDL_Color *colors, int firstcolor, int ncolors) 465 * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
466 * 466 *
467 * \brief Set the colormap for indexed display modes. 467 * \brief Set the palette entries for indexed display modes.
468 * 468 *
469 * \return 0 on success, or -1 if not all the colors could be set. 469 * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.
470 */ 470 */
471 extern DECLSPEC int SDLCALL SDL_SetDisplayColors(SDL_Color * colors, 471 extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
472 int firstcolor, int ncolors); 472 int firstcolor,
473 int ncolors);
474
475 /**
476 * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors)
477 *
478 * \brief Gets the palette entries for indexed display modes.
479 *
480 * \return 0 on success, or -1 if the display mode isn't palettized
481 */
482 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
483 int firstcolor,
484 int ncolors);
473 485
474 /** 486 /**
475 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) 487 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
476 * 488 *
477 * \brief Create a window with the specified position, dimensions, and flags. 489 * \brief Create a window with the specified position, dimensions, and flags.
504 * 516 *
505 * \warning This function is NOT SUPPORTED, use at your own risk! 517 * \warning This function is NOT SUPPORTED, use at your own risk!
506 * 518 *
507 * \sa SDL_DestroyWindow() 519 * \sa SDL_DestroyWindow()
508 */ 520 */
509 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(void *data); 521 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
510 522
511 /** 523 /**
512 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID) 524 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
513 * 525 *
514 * \brief Get the window flags. 526 * \brief Get the window flags.
816 */ 828 */
817 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, 829 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
818 void **pixels, int *pitch); 830 void **pixels, int *pitch);
819 831
820 /** 832 /**
821 * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors) 833 * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors)
822 * 834 *
823 * \brief Update an indexed texture with a color palette 835 * \brief Update an indexed texture with a color palette
824 * 836 *
825 * \param texture The texture to update 837 * \param texture The texture to update
826 * \param colors The array of RGB color data 838 * \param colors The array of RGB color data
828 * \param ncolors The number of palette entries to fill with the color data 840 * \param ncolors The number of palette entries to fill with the color data
829 * 841 *
830 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture 842 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
831 */ 843 */
832 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, 844 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
845 const SDL_Color * colors,
846 int firstcolor,
847 int ncolors);
848
849 /**
850 * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors)
851 *
852 * \brief Update an indexed texture with a color palette
853 *
854 * \param texture The texture to update
855 * \param colors The array to fill with RGB color data
856 * \param firstcolor The first index to retrieve
857 * \param ncolors The number of palette entries to retrieve
858 *
859 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
860 */
861 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
833 SDL_Color * colors, 862 SDL_Color * colors,
834 int firstcolor, 863 int firstcolor,
835 int ncolors); 864 int ncolors);
836 865
837 /** 866 /**
838 * \fn int SDL_UpdateTexture(SDL_TextureID textureID, SDL_Rect *rect, const void *pixels, int pitch) 867 * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
839 * 868 *
840 * \brief Update the given texture rectangle with new pixel data. 869 * \brief Update the given texture rectangle with new pixel data.
841 * 870 *
842 * \param texture The texture to update 871 * \param texture The texture to update
843 * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. 872 * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
847 * \return 0 on success, or -1 if the texture is not valid 876 * \return 0 on success, or -1 if the texture is not valid
848 * 877 *
849 * \note This is a very slow function for textures not created with SDL_TextureAccess_Local. 878 * \note This is a very slow function for textures not created with SDL_TextureAccess_Local.
850 */ 879 */
851 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, 880 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
852 SDL_Rect * rect, 881 const SDL_Rect * rect,
853 const void *pixels, int pitch); 882 const void *pixels, int pitch);
854 883
855 /** 884 /**
856 * \fn void SDL_LockTexture(SDL_TextureID textureID, SDL_Rect *rect, int markDirty, void **pixels, int *pitch) 885 * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
857 * 886 *
858 * \brief Lock a portion of the texture for pixel access. 887 * \brief Lock a portion of the texture for pixel access.
859 * 888 *
860 * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local. 889 * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local.
861 * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. 890 * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
867 * 896 *
868 * \sa SDL_DirtyTexture() 897 * \sa SDL_DirtyTexture()
869 * \sa SDL_UnlockTexture() 898 * \sa SDL_UnlockTexture()
870 */ 899 */
871 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, 900 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
872 SDL_Rect * rect, int markDirty, 901 const SDL_Rect * rect,
873 void **pixels, int *pitch); 902 int markDirty, void **pixels,
903 int *pitch);
874 904
875 /** 905 /**
876 * \fn void SDL_UnlockTexture(SDL_TextureID textureID) 906 * \fn void SDL_UnlockTexture(SDL_TextureID textureID)
877 * 907 *
878 * \brief Unlock a texture, uploading the changes to video memory, if needed. 908 * \brief Unlock a texture, uploading the changes to video memory, if needed.
881 * \sa SDL_DirtyTexture() 911 * \sa SDL_DirtyTexture()
882 */ 912 */
883 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); 913 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
884 914
885 /** 915 /**
886 * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, SDL_Rect * rects) 916 * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects)
887 * 917 *
888 * \brief Mark the specified rectangles of the texture as dirty. 918 * \brief Mark the specified rectangles of the texture as dirty.
889 * 919 *
890 * \note The texture must have been created with SDL_TextureAccess_Local. 920 * \note The texture must have been created with SDL_TextureAccess_Local.
891 * 921 *
892 * \sa SDL_LockTexture() 922 * \sa SDL_LockTexture()
893 * \sa SDL_UnlockTexture() 923 * \sa SDL_UnlockTexture()
894 */ 924 */
895 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, 925 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
896 int numrects, SDL_Rect * rects); 926 int numrects,
927 const SDL_Rect * rects);
897 928
898 /** 929 /**
899 * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID) 930 * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID)
900 * 931 *
901 * \brief Select a texture as the rendering target, or 0 to reselect the current window. 932 * \brief Select a texture as the rendering target, or 0 to reselect the current window.
903 * \note The texture must have been created with SDL_TextureAccess_Render. 934 * \note The texture must have been created with SDL_TextureAccess_Render.
904 */ 935 */
905 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID); 936 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID);
906 937
907 /** 938 /**
908 * \fn void SDL_RenderFill(SDL_Rect *rect, Uint32 color) 939 * \fn void SDL_RenderFill(const SDL_Rect *rect, Uint32 color)
909 * 940 *
910 * \brief Fill the current rendering target with the specified color. 941 * \brief Fill the current rendering target with the specified color.
911 * 942 *
912 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target. 943 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
913 * \param color An ARGB color value. 944 * \param color An ARGB color value.
914 * 945 *
915 * \return 0 on success, or -1 if there is no renderer current 946 * \return 0 on success, or -1 if there is no renderer current
916 */ 947 */
917 extern DECLSPEC int SDLCALL SDL_RenderFill(SDL_Rect * rect, Uint32 color); 948 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect,
918 949 Uint32 color);
919 /** 950
920 * \fn int SDL_RenderCopy(SDL_TextureID textureID, SDL_Rect *srcrect, SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode) 951 /**
952 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode)
921 * 953 *
922 * \brief Copy a portion of the texture to the current rendering target. 954 * \brief Copy a portion of the texture to the current rendering target.
923 * 955 *
924 * \param texture The source texture. 956 * \param texture The source texture.
925 * \param srcrect A pointer to the source rectangle, or NULL for the entire texture. 957 * \param srcrect A pointer to the source rectangle, or NULL for the entire texture.
930 * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation. 962 * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation.
931 * 963 *
932 * \note You can check the video driver info to see what operations are supported. 964 * \note You can check the video driver info to see what operations are supported.
933 */ 965 */
934 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, 966 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
935 SDL_Rect * srcrect, 967 const SDL_Rect * srcrect,
936 SDL_Rect * dstrect, int blendMode, 968 const SDL_Rect * dstrect,
937 int scaleMode); 969 int blendMode, int scaleMode);
938 970
939 /** 971 /**
940 * \fn int SDL_RenderReadPixels(SDL_Rect *rect, void *pixels, int pitch) 972 * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch)
941 * 973 *
942 * \brief Read pixels from the current rendering target. 974 * \brief Read pixels from the current rendering target.
943 * 975 *
944 * \param rect A pointer to the rectangle to read, or NULL for the entire render target 976 * \param rect A pointer to the rectangle to read, or NULL for the entire render target
945 * \param pixels A pointer to be filled in with the pixel data 977 * \param pixels A pointer to be filled in with the pixel data
947 * 979 *
948 * \return 0 on success, or -1 if pixel reading is not supported. 980 * \return 0 on success, or -1 if pixel reading is not supported.
949 * 981 *
950 * \warning This is a very slow operation, and should not be used frequently. 982 * \warning This is a very slow operation, and should not be used frequently.
951 */ 983 */
952 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Rect * rect, 984 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
953 void *pixels, int pitch); 985 void *pixels, int pitch);
954 986
955 /** 987 /**
956 * \fn int SDL_RenderWritePixels(SDL_Rect *rect, const void *pixels, int pitch) 988 * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch)
957 * 989 *
958 * \brief Write pixels to the current rendering target. 990 * \brief Write pixels to the current rendering target.
959 * 991 *
960 * \param rect A pointer to the rectangle to write, or NULL for the entire render target 992 * \param rect A pointer to the rectangle to write, or NULL for the entire render target
961 * \param pixels A pointer to the pixel data to write 993 * \param pixels A pointer to the pixel data to write
963 * 995 *
964 * \return 0 on success, or -1 if pixel writing is not supported. 996 * \return 0 on success, or -1 if pixel writing is not supported.
965 * 997 *
966 * \warning This is a very slow operation, and should not be used frequently. 998 * \warning This is a very slow operation, and should not be used frequently.
967 */ 999 */
968 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(SDL_Rect * rect, 1000 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
969 const void *pixels, 1001 const void *pixels,
970 int pitch); 1002 int pitch);
971 1003
972 /** 1004 /**
973 * \fn void SDL_RenderPresent(void) 1005 * \fn void SDL_RenderPresent(void)