Mercurial > sdl-ios-xcode
comparison include/SDL_video.h @ 1733:0b1070f2f94d SDL-1.3
Implemented gamma correction on Windows.
Added general code to restore the video mode and gamma when windows lose focus.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 09 Jul 2006 09:02:26 +0000 |
parents | 0ef52d56e8bb |
children | f7c667ded87d |
comparison
equal
deleted
inserted
replaced
1732:fd65f12b6de6 | 1733:0b1070f2f94d |
---|---|
96 * \sa SDL_MaximizeWindow() | 96 * \sa SDL_MaximizeWindow() |
97 * \sa SDL_MinimizeWindow() | 97 * \sa SDL_MinimizeWindow() |
98 * \sa SDL_RaiseWindow() | 98 * \sa SDL_RaiseWindow() |
99 * \sa SDL_RestoreWindow() | 99 * \sa SDL_RestoreWindow() |
100 * \sa SDL_SetWindowData() | 100 * \sa SDL_SetWindowData() |
101 * \sa SDL_SetWindowFullscreen() | |
101 * \sa SDL_SetWindowGrab() | 102 * \sa SDL_SetWindowGrab() |
102 * \sa SDL_SetWindowIcon() | 103 * \sa SDL_SetWindowIcon() |
103 * \sa SDL_SetWindowPosition() | 104 * \sa SDL_SetWindowPosition() |
104 * \sa SDL_SetWindowSize() | 105 * \sa SDL_SetWindowSize() |
105 * \sa SDL_SetWindowTitle() | 106 * \sa SDL_SetWindowTitle() |
472 * mode, | 473 * mode, |
473 SDL_DisplayMode | 474 SDL_DisplayMode |
474 * closest); | 475 * closest); |
475 | 476 |
476 /** | 477 /** |
477 * \fn int SDL_SetDisplayMode(const SDL_DisplayMode *mode) | 478 * \fn int SDL_SetFullscreenDisplayMode(const SDL_DisplayMode *mode) |
478 * | 479 * |
479 * \brief Set up the closest available mode on the current display. | 480 * \brief Set the display mode used when a fullscreen window is visible |
480 * | 481 * on the currently selected display. |
481 * \param mode The desired display mode, or NULL to set the desktop mode. | 482 * |
483 * \param mode The mode to use, or NULL for the desktop mode. | |
482 * | 484 * |
483 * \return 0 on success, or -1 if setting the display mode failed. | 485 * \return 0 on success, or -1 if setting the display mode failed. |
484 */ | 486 * |
485 extern DECLSPEC int SDLCALL SDL_SetDisplayMode(const SDL_DisplayMode * mode); | 487 * \sa SDL_SetWindowFullscreen() |
488 */ | |
489 extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode | |
490 * mode); | |
491 | |
492 /** | |
493 * \fn const SDL_DisplayMode *SDL_GetFullscreenDisplayMode(void) | |
494 * | |
495 * \brief Query the display mode used when a fullscreen window is visible | |
496 * on the currently selected display. | |
497 */ | |
498 extern DECLSPEC const SDL_DisplayMode *SDLCALL | |
499 SDL_GetFullscreenDisplayMode(void); | |
486 | 500 |
487 /** | 501 /** |
488 * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors) | 502 * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors) |
489 * | 503 * |
490 * \brief Set the palette entries for indexed display modes. | 504 * \brief Set the palette entries for indexed display modes. |
505 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors, | 519 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors, |
506 int firstcolor, | 520 int firstcolor, |
507 int ncolors); | 521 int ncolors); |
508 | 522 |
509 /** | 523 /** |
510 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) | 524 * \fn int SDL_SetGamma(float red, float green, float blue) |
511 * | 525 * |
512 * \brief Create a window with the specified position, dimensions, and flags. | 526 * \brief Set the gamma correction for each of the color channels on the currently selected display. |
513 * | 527 * |
514 * \param title The title of the window | 528 * \return 0 on success, or -1 if setting the gamma isn't supported. |
515 * \param x The x position of the window | 529 * |
516 * \param y The y position of the window | 530 * \sa SDL_SetGammaRamp() |
517 * \param w The width of the window | |
518 * \param h The height of the window | |
519 * \param flags The flags for the window | |
520 * | |
521 * \return The id of the window created, or zero if window creation failed. | |
522 * | |
523 * \note Setting the position to -1, -1, indicates any position is fine. | |
524 * | |
525 * \sa SDL_DestroyWindow() | |
526 */ | |
527 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title, | |
528 int x, int y, int w, | |
529 int h, Uint32 flags); | |
530 | |
531 /** | |
532 * \fn SDL_WindowID SDL_CreateWindowFrom(void *data) | |
533 * | |
534 * \brief Create an SDL window struct from an existing native window. | |
535 * | |
536 * \param data A pointer to driver-dependent window creation data | |
537 * | |
538 * \return The id of the window created, or zero if window creation failed. | |
539 * | |
540 * \warning This function is NOT SUPPORTED, use at your own risk! | |
541 * | |
542 * \sa SDL_DestroyWindow() | |
543 */ | |
544 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data); | |
545 | |
546 /** | |
547 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID) | |
548 * | |
549 * \brief Get the window flags. | |
550 */ | |
551 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID); | |
552 | |
553 /** | |
554 * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title) | |
555 * | |
556 * \brief Set the title of the window, in UTF-8 format. | |
557 * | |
558 * \sa SDL_GetWindowTitle() | |
559 */ | |
560 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID, | |
561 const char *title); | |
562 | |
563 /** | |
564 * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID) | |
565 * | |
566 * \brief Get the title of the window, in UTF-8 format. | |
567 * | |
568 * \sa SDL_SetWindowTitle() | |
569 */ | |
570 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); | |
571 | |
572 /** | |
573 * \fn void SDL_SetWindowIcon(SDL_Surface *icon) | |
574 * | |
575 * \brief Set the icon of the window. | |
576 * | |
577 * \param icon The icon for the window | |
578 * | |
579 * FIXME: The icon needs to be set before the window is first shown. Should some icon representation be part of the window creation data? | |
580 */ | |
581 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon); | |
582 | |
583 /** | |
584 * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata) | |
585 * | |
586 * \brief Associate an arbitrary pointer with the window. | |
587 * | |
588 * \sa SDL_GetWindowData() | |
589 */ | |
590 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID, | |
591 void *userdata); | |
592 | |
593 /** | |
594 * \fn void *SDL_GetWindowData(SDL_WindowID windowID) | |
595 * | |
596 * \brief Retrieve the data pointer associated with the window. | |
597 * | |
598 * \sa SDL_SetWindowData() | |
599 */ | |
600 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID); | |
601 | |
602 /** | |
603 * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y) | |
604 * | |
605 * \brief Set the position of the window. | |
606 * | |
607 * \param windowID The window to reposition | |
608 * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED | |
609 * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED | |
610 * | |
611 * \note The window coordinate origin is the upper left of the display. | |
612 * | |
613 * \sa SDL_GetWindowPosition() | |
614 */ | |
615 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID, | |
616 int x, int y); | |
617 | |
618 /** | |
619 * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y) | |
620 * | |
621 * \brief Get the position of the window. | |
622 * | |
623 * \sa SDL_SetWindowPosition() | |
624 */ | |
625 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID, | |
626 int *x, int *y); | |
627 | |
628 /** | |
629 * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w) | |
630 * | |
631 * \brief Set the size of the window's client area. | |
632 * | |
633 * \note You can't change the size of a fullscreen window, it automatically | |
634 * matches the size of the display mode. | |
635 * | |
636 * \sa SDL_GetWindowSize() | |
637 */ | |
638 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w, | |
639 int h); | |
640 | |
641 /** | |
642 * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w) | |
643 * | |
644 * \brief Get the size of the window's client area. | |
645 * | |
646 * \sa SDL_SetWindowSize() | |
647 */ | |
648 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w, | |
649 int *h); | |
650 | |
651 /** | |
652 * \fn void SDL_ShowWindow(SDL_WindowID windowID) | |
653 * | |
654 * \brief Show the window | |
655 * | |
656 * \sa SDL_HideWindow() | |
657 */ | |
658 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID); | |
659 | |
660 /** | |
661 * \fn void SDL_HideWindow(SDL_WindowID windowID) | |
662 * | |
663 * \brief Hide the window | |
664 * | |
665 * \sa SDL_ShowWindow() | |
666 */ | |
667 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID); | |
668 | |
669 /** | |
670 * \fn void SDL_RaiseWindow(SDL_WindowID windowID) | |
671 * | |
672 * \brief Raise the window so it's above other windows. | |
673 */ | |
674 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID); | |
675 | |
676 /** | |
677 * \fn void SDL_MaximizeWindow(SDL_WindowID windowID) | |
678 * | |
679 * \brief Make the window as large as possible. | |
680 * | |
681 * \sa SDL_RestoreWindow() | |
682 */ | |
683 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID); | |
684 | |
685 /** | |
686 * \fn void SDL_MinimizeWindow(SDL_WindowID windowID) | |
687 * | |
688 * \brief Minimize the window to an iconic representation. | |
689 * | |
690 * \sa SDL_RestoreWindow() | |
691 */ | |
692 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID); | |
693 | |
694 /** | |
695 * \fn void SDL_RestoreWindow(SDL_WindowID windowID) | |
696 * | |
697 * \brief Restore the size and position of a minimized or maximized window. | |
698 * | |
699 * \sa SDL_MaximizeWindow() | |
700 * \sa SDL_MinimizeWindow() | |
701 */ | |
702 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID); | |
703 | |
704 /** | |
705 * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode) | |
706 * | |
707 * \brief Set the window's input grab mode. | |
708 * | |
709 * \param mode This is 1 to grab input, and 0 to release input. | |
710 * | |
711 * \sa SDL_GrabMode | |
712 * \sa SDL_GetWindowGrab() | |
713 */ | |
714 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID, | |
715 int mode); | |
716 | |
717 /** | |
718 * \fn int SDL_GetWindowGrab(SDL_WindowID windowID) | |
719 * | |
720 * \brief Get the window's input grab mode. | |
721 * | |
722 * \return This returns 1 if input is grabbed, and 0 otherwise. | |
723 * | |
724 * \sa SDL_GrabMode | |
725 * \sa SDL_SetWindowGrab() | |
726 */ | |
727 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID); | |
728 | |
729 /** | |
730 * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info) | |
731 * | |
732 * \brief Get driver specific information about a window. | |
733 * | |
734 * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo. | |
735 */ | |
736 struct SDL_SysWMinfo; | |
737 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, | |
738 struct SDL_SysWMinfo | |
739 *info); | |
740 | |
741 /** | |
742 * \fn void SDL_DestroyWindow(SDL_WindowID windowID) | |
743 * | |
744 * \brief Destroy a window. | |
745 */ | |
746 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID); | |
747 | |
748 /** | |
749 * \fn int SDL_GetNumRenderers(void) | |
750 * | |
751 * \brief Get the number of render managers on the current display. | |
752 * | |
753 * A render manager is a set of code that handles rendering and texture | |
754 * management on a particular display. Normally there is only one, but | |
755 * some drivers may have several available with different capabilities. | |
756 * | |
757 * \sa SDL_GetRendererInfo() | |
758 * \sa SDL_CreateRenderer() | |
759 */ | |
760 extern DECLSPEC int SDLCALL SDL_GetNumRenderers(void); | |
761 | |
762 /** | |
763 * \fn SDL_RendererInfo *SDL_GetRendererInfo(int index) | |
764 * | |
765 * \brief Get information about a specific render manager on the current | |
766 * display. | |
767 * | |
768 * \sa SDL_CreateRenderer() | |
769 */ | |
770 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(int index, | |
771 SDL_RendererInfo * info); | |
772 | |
773 /** | |
774 * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags) | |
775 * | |
776 * \brief Create and make active a 2D rendering context for a window. | |
777 * | |
778 * \param windowID The window used for rendering | |
779 * \param index The index of the render manager to initialize, or -1 to initialize the first one supporting the requested flags. | |
780 * \param flags SDL_RendererFlags | |
781 * | |
782 * \return 0 on success, -1 if the flags were not supported, or -2 if | |
783 * there isn't enough memory to support the requested flags | |
784 * | |
785 * \sa SDL_SelectRenderer() | |
786 * \sa SDL_DestroyRenderer() | |
787 */ | |
788 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID, | |
789 int index, Uint32 flags); | |
790 | |
791 /** | |
792 * \fn int SDL_SelectRenderer(SDL_WindowID windowID) | |
793 * | |
794 * \brief Select the rendering context for a particular window. | |
795 * | |
796 * \return 0 on success, -1 if the selected window doesn't have a | |
797 * rendering context. | |
798 */ | |
799 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID); | |
800 | |
801 /** | |
802 * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h) | |
803 * | |
804 * \brief Create a texture for the current rendering context. | |
805 * | |
806 * \param format The format of the texture | |
807 * \param access One of the enumerated values in SDL_TextureAccess | |
808 * \param w The width of the texture in pixels | |
809 * \param h The height of the texture in pixels | |
810 * | |
811 * \return The created texture is returned, or 0 if no render manager was active, the format was unsupported, or the width or height were out of range. | |
812 * | |
813 * \sa SDL_QueryTexture() | |
814 * \sa SDL_DestroyTexture() | |
815 */ | |
816 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format, | |
817 int access, int w, | |
818 int h); | |
819 | |
820 /** | |
821 * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface *surface) | |
822 * | |
823 * \brief Create a texture from an existing surface. | |
824 * | |
825 * \param format The format of the texture, or 0 to pick an appropriate format | |
826 * \param access One of the enumerated values in SDL_TextureAccess | |
827 * \param surface The surface containing pixel data used to fill the texture | |
828 * | |
829 * \return The created texture is returned, or 0 if no render manager was active, the format was unsupported, or the surface width or height were out of range. | |
830 * | |
831 * \note The surface is not modified or freed by this function. | |
832 * | |
833 * \sa SDL_QueryTexture() | |
834 * \sa SDL_DestroyTexture() | |
835 */ | |
836 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32 | |
837 format, | |
838 int access, | |
839 SDL_Surface | |
840 * surface); | |
841 | |
842 /** | |
843 * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h) | |
844 * | |
845 * \brief Query the attributes of a texture | |
846 * | |
847 * \param texture A texture to be queried | |
848 * \param format A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format. | |
849 * \param access A pointer filled in with the actual access to the texture. | |
850 * \param w A pointer filled in with the width of the texture in pixels | |
851 * \param h A pointer filled in with the height of the texture in pixels | |
852 * | |
853 * \return 0 on success, or -1 if the texture is not valid | |
854 */ | |
855 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID, | |
856 Uint32 * format, int *access, | |
857 int *w, int *h); | |
858 | |
859 /** | |
860 * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch) | |
861 * | |
862 * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access. | |
863 * | |
864 * \param texture A texture to be queried, which was created with SDL_TextureAccess_Local | |
865 * \param pixels A pointer filled with a pointer to the pixels for the texture | |
866 * \param pitch A pointer filled in with the pitch of the pixel data | |
867 * | |
868 * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access. | |
869 */ | |
870 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, | |
871 void **pixels, int *pitch); | |
872 | |
873 /** | |
874 * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors) | |
875 * | |
876 * \brief Update an indexed texture with a color palette | |
877 * | |
878 * \param texture The texture to update | |
879 * \param colors The array of RGB color data | |
880 * \param firstcolor The first index to update | |
881 * \param ncolors The number of palette entries to fill with the color data | |
882 * | |
883 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture | |
884 */ | |
885 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, | |
886 const SDL_Color * colors, | |
887 int firstcolor, | |
888 int ncolors); | |
889 | |
890 /** | |
891 * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors) | |
892 * | |
893 * \brief Update an indexed texture with a color palette | |
894 * | |
895 * \param texture The texture to update | |
896 * \param colors The array to fill with RGB color data | |
897 * \param firstcolor The first index to retrieve | |
898 * \param ncolors The number of palette entries to retrieve | |
899 * | |
900 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture | |
901 */ | |
902 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID, | |
903 SDL_Color * colors, | |
904 int firstcolor, | |
905 int ncolors); | |
906 | |
907 /** | |
908 * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch) | |
909 * | |
910 * \brief Update the given texture rectangle with new pixel data. | |
911 * | |
912 * \param texture The texture to update | |
913 * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. | |
914 * \param pixels The raw pixel data | |
915 * \param pitch The number of bytes between rows of pixel data | |
916 * | |
917 * \return 0 on success, or -1 if the texture is not valid | |
918 * | |
919 * \note This is a very slow function for textures not created with SDL_TextureAccess_Local. | |
920 */ | |
921 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, | |
922 const SDL_Rect * rect, | |
923 const void *pixels, int pitch); | |
924 | |
925 /** | |
926 * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch) | |
927 * | |
928 * \brief Lock a portion of the texture for pixel access. | |
929 * | |
930 * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local. | |
931 * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. | |
932 * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked. | |
933 * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area. | |
934 * \param pitch This is filled in with the pitch of the locked pixels. | |
935 * | |
936 * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TextureAccess_Remote | |
937 * | |
938 * \sa SDL_DirtyTexture() | |
939 * \sa SDL_UnlockTexture() | |
940 */ | |
941 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, | |
942 const SDL_Rect * rect, | |
943 int markDirty, void **pixels, | |
944 int *pitch); | |
945 | |
946 /** | |
947 * \fn void SDL_UnlockTexture(SDL_TextureID textureID) | |
948 * | |
949 * \brief Unlock a texture, uploading the changes to video memory, if needed. | |
950 * | |
951 * \sa SDL_LockTexture() | |
952 * \sa SDL_DirtyTexture() | |
953 */ | |
954 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); | |
955 | |
956 /** | |
957 * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects) | |
958 * | |
959 * \brief Mark the specified rectangles of the texture as dirty. | |
960 * | |
961 * \note The texture must have been created with SDL_TextureAccess_Local. | |
962 * | |
963 * \sa SDL_LockTexture() | |
964 * \sa SDL_UnlockTexture() | |
965 */ | |
966 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, | |
967 int numrects, | |
968 const SDL_Rect * rects); | |
969 | |
970 /** | |
971 * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID) | |
972 * | |
973 * \brief Select a texture as the rendering target, or 0 to reselect the current window. | |
974 * | |
975 * \note The texture must have been created with SDL_TextureAccess_Render. | |
976 */ | |
977 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID); | |
978 | |
979 /** | |
980 * \fn void SDL_RenderFill(const SDL_Rect *rect, Uint32 color) | |
981 * | |
982 * \brief Fill the current rendering target with the specified color. | |
983 * | |
984 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target. | |
985 * \param color An ARGB color value. | |
986 * | |
987 * \return 0 on success, or -1 if there is no renderer current | |
988 */ | |
989 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect, | |
990 Uint32 color); | |
991 | |
992 /** | |
993 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode) | |
994 * | |
995 * \brief Copy a portion of the texture to the current rendering target. | |
996 * | |
997 * \param texture The source texture. | |
998 * \param srcrect A pointer to the source rectangle, or NULL for the entire texture. | |
999 * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target. | |
1000 * \param blendMode SDL_TextureBlendMode to be used if the source texture has an alpha channel. | |
1001 * \param scaleMode SDL_TextureScaleMode to be used if the source and destination rectangles don't have the same width and height. | |
1002 * | |
1003 * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation. | |
1004 * | |
1005 * \note You can check the video driver info to see what operations are supported. | |
1006 */ | |
1007 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, | |
1008 const SDL_Rect * srcrect, | |
1009 const SDL_Rect * dstrect, | |
1010 int blendMode, int scaleMode); | |
1011 | |
1012 /** | |
1013 * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch) | |
1014 * | |
1015 * \brief Read pixels from the current rendering target. | |
1016 * | |
1017 * \param rect A pointer to the rectangle to read, or NULL for the entire render target | |
1018 * \param pixels A pointer to be filled in with the pixel data | |
1019 * \param pitch The pitch of the pixels parameter | |
1020 * | |
1021 * \return 0 on success, or -1 if pixel reading is not supported. | |
1022 * | |
1023 * \warning This is a very slow operation, and should not be used frequently. | |
1024 */ | |
1025 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect, | |
1026 void *pixels, int pitch); | |
1027 | |
1028 /** | |
1029 * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch) | |
1030 * | |
1031 * \brief Write pixels to the current rendering target. | |
1032 * | |
1033 * \param rect A pointer to the rectangle to write, or NULL for the entire render target | |
1034 * \param pixels A pointer to the pixel data to write | |
1035 * \param pitch The pitch of the pixels parameter | |
1036 * | |
1037 * \return 0 on success, or -1 if pixel writing is not supported. | |
1038 * | |
1039 * \warning This is a very slow operation, and should not be used frequently. | |
1040 */ | |
1041 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect, | |
1042 const void *pixels, | |
1043 int pitch); | |
1044 | |
1045 /** | |
1046 * \fn void SDL_RenderPresent(void) | |
1047 * | |
1048 * \brief Update the screen with rendering performed. | |
1049 */ | |
1050 extern DECLSPEC void SDLCALL SDL_RenderPresent(void); | |
1051 | |
1052 /** | |
1053 * \fn void SDL_DestroyTexture(SDL_TextureID textureID); | |
1054 * | |
1055 * \brief Destroy the specified texture. | |
1056 * | |
1057 * \sa SDL_CreateTexture() | |
1058 * \sa SDL_CreateTextureFromSurface() | |
1059 */ | |
1060 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID); | |
1061 | |
1062 /** | |
1063 * \fn void SDL_DestroyRenderer(SDL_WindowID windowID); | |
1064 * | |
1065 * \brief Destroy the rendering context for a window and free associated | |
1066 * textures. | |
1067 * | |
1068 * \sa SDL_CreateRenderer() | |
1069 */ | |
1070 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); | |
1071 | |
1072 /* | |
1073 * Set the gamma correction for each of the color channels. | |
1074 * The gamma values range (approximately) between 0.1 and 10.0 | |
1075 * | |
1076 * If this function isn't supported directly by the hardware, it will | |
1077 * be emulated using gamma ramps, if available. If successful, this | |
1078 * function returns 0, otherwise it returns -1. | |
1079 */ | 531 */ |
1080 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); | 532 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); |
1081 | 533 |
1082 /* | 534 /** |
535 * \fn int SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue) | |
536 * | |
537 * \brief Set the gamma ramp for the currently selected display. | |
538 * | |
539 * \param red The translation table for the red channel, or NULL | |
540 * \param green The translation table for the green channel, or NULL | |
541 * \param blue The translation table for the blue channel, or NULL | |
542 * | |
543 * \return 0 on success, or -1 if gamma ramps are unsupported. | |
544 * | |
1083 * Set the gamma translation table for the red, green, and blue channels | 545 * Set the gamma translation table for the red, green, and blue channels |
1084 * of the video hardware. Each table is an array of 256 16-bit quantities, | 546 * of the video hardware. Each table is an array of 256 16-bit quantities, |
1085 * representing a mapping between the input and output for that channel. | 547 * representing a mapping between the input and output for that channel. |
1086 * The input is the index into the array, and the output is the 16-bit | 548 * The input is the index into the array, and the output is the 16-bit |
1087 * gamma value at that index, scaled to the output color precision. | 549 * gamma value at that index, scaled to the output color precision. |
1088 * | 550 * |
1089 * You may pass NULL for any of the channels to leave it unchanged. | 551 * \sa SDL_GetGammaRamp() |
1090 * If the call succeeds, it will return 0. If the display driver or | |
1091 * hardware does not support gamma translation, or otherwise fails, | |
1092 * this function will return -1. | |
1093 */ | 552 */ |
1094 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red, | 553 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red, |
1095 const Uint16 * green, | 554 const Uint16 * green, |
1096 const Uint16 * blue); | 555 const Uint16 * blue); |
1097 | 556 |
1098 /* | 557 /** |
1099 * Retrieve the current values of the gamma translation tables. | 558 * \fn int SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue) |
559 * | |
560 * \brief Get the gamma ramp for the currently selected display. | |
561 * | |
562 * \param red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL. | |
563 * \param green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL. | |
564 * \param blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL. | |
1100 * | 565 * |
1101 * You must pass in valid pointers to arrays of 256 16-bit quantities. | 566 * \return 0 on success, or -1 if gamma ramps are unsupported. |
1102 * Any of the pointers may be NULL to ignore that channel. | 567 * |
1103 * If the call succeeds, it will return 0. If the display driver or | 568 * \sa SDL_SetGammaRamp() |
1104 * hardware does not support gamma translation, or otherwise fails, | |
1105 * this function will return -1. | |
1106 */ | 569 */ |
1107 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green, | 570 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green, |
1108 Uint16 * blue); | 571 Uint16 * blue); |
572 | |
573 | |
574 /** | |
575 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) | |
576 * | |
577 * \brief Create a window with the specified position, dimensions, and flags. | |
578 * | |
579 * \param title The title of the window | |
580 * \param x The x position of the window | |
581 * \param y The y position of the window | |
582 * \param w The width of the window | |
583 * \param h The height of the window | |
584 * \param flags The flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_SHOWN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED | |
585 * | |
586 * \return The id of the window created, or zero if window creation failed. | |
587 * | |
588 * \note Setting the position to -1, -1, indicates any position is fine. | |
589 * | |
590 * \sa SDL_DestroyWindow() | |
591 */ | |
592 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title, | |
593 int x, int y, int w, | |
594 int h, Uint32 flags); | |
595 | |
596 /** | |
597 * \fn SDL_WindowID SDL_CreateWindowFrom(void *data) | |
598 * | |
599 * \brief Create an SDL window struct from an existing native window. | |
600 * | |
601 * \param data A pointer to driver-dependent window creation data | |
602 * | |
603 * \return The id of the window created, or zero if window creation failed. | |
604 * | |
605 * \warning This function is NOT SUPPORTED, use at your own risk! | |
606 * | |
607 * \sa SDL_DestroyWindow() | |
608 */ | |
609 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data); | |
610 | |
611 /** | |
612 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID) | |
613 * | |
614 * \brief Get the window flags. | |
615 */ | |
616 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID); | |
617 | |
618 /** | |
619 * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title) | |
620 * | |
621 * \brief Set the title of the window, in UTF-8 format. | |
622 * | |
623 * \sa SDL_GetWindowTitle() | |
624 */ | |
625 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID, | |
626 const char *title); | |
627 | |
628 /** | |
629 * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID) | |
630 * | |
631 * \brief Get the title of the window, in UTF-8 format. | |
632 * | |
633 * \sa SDL_SetWindowTitle() | |
634 */ | |
635 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID); | |
636 | |
637 /** | |
638 * \fn void SDL_SetWindowIcon(SDL_Surface *icon) | |
639 * | |
640 * \brief Set the icon of the window. | |
641 * | |
642 * \param icon The icon for the window | |
643 * | |
644 * FIXME: The icon needs to be set before the window is first shown. Should some icon representation be part of the window creation data? | |
645 */ | |
646 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon); | |
647 | |
648 /** | |
649 * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata) | |
650 * | |
651 * \brief Associate an arbitrary pointer with the window. | |
652 * | |
653 * \sa SDL_GetWindowData() | |
654 */ | |
655 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID, | |
656 void *userdata); | |
657 | |
658 /** | |
659 * \fn void *SDL_GetWindowData(SDL_WindowID windowID) | |
660 * | |
661 * \brief Retrieve the data pointer associated with the window. | |
662 * | |
663 * \sa SDL_SetWindowData() | |
664 */ | |
665 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID); | |
666 | |
667 /** | |
668 * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y) | |
669 * | |
670 * \brief Set the position of the window. | |
671 * | |
672 * \param windowID The window to reposition | |
673 * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED | |
674 * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED | |
675 * | |
676 * \note The window coordinate origin is the upper left of the display. | |
677 * | |
678 * \sa SDL_GetWindowPosition() | |
679 */ | |
680 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID, | |
681 int x, int y); | |
682 | |
683 /** | |
684 * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y) | |
685 * | |
686 * \brief Get the position of the window. | |
687 * | |
688 * \sa SDL_SetWindowPosition() | |
689 */ | |
690 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID, | |
691 int *x, int *y); | |
692 | |
693 /** | |
694 * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w) | |
695 * | |
696 * \brief Set the size of the window's client area. | |
697 * | |
698 * \note You can't change the size of a fullscreen window, it automatically | |
699 * matches the size of the display mode. | |
700 * | |
701 * \sa SDL_GetWindowSize() | |
702 */ | |
703 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w, | |
704 int h); | |
705 | |
706 /** | |
707 * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w) | |
708 * | |
709 * \brief Get the size of the window's client area. | |
710 * | |
711 * \sa SDL_SetWindowSize() | |
712 */ | |
713 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w, | |
714 int *h); | |
715 | |
716 /** | |
717 * \fn void SDL_ShowWindow(SDL_WindowID windowID) | |
718 * | |
719 * \brief Show the window | |
720 * | |
721 * \sa SDL_HideWindow() | |
722 */ | |
723 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID); | |
724 | |
725 /** | |
726 * \fn void SDL_HideWindow(SDL_WindowID windowID) | |
727 * | |
728 * \brief Hide the window | |
729 * | |
730 * \sa SDL_ShowWindow() | |
731 */ | |
732 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID); | |
733 | |
734 /** | |
735 * \fn void SDL_RaiseWindow(SDL_WindowID windowID) | |
736 * | |
737 * \brief Raise the window so it's above other windows. | |
738 */ | |
739 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID); | |
740 | |
741 /** | |
742 * \fn void SDL_MaximizeWindow(SDL_WindowID windowID) | |
743 * | |
744 * \brief Make the window as large as possible. | |
745 * | |
746 * \sa SDL_RestoreWindow() | |
747 */ | |
748 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID); | |
749 | |
750 /** | |
751 * \fn void SDL_MinimizeWindow(SDL_WindowID windowID) | |
752 * | |
753 * \brief Minimize the window to an iconic representation. | |
754 * | |
755 * \sa SDL_RestoreWindow() | |
756 */ | |
757 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID); | |
758 | |
759 /** | |
760 * \fn void SDL_RestoreWindow(SDL_WindowID windowID) | |
761 * | |
762 * \brief Restore the size and position of a minimized or maximized window. | |
763 * | |
764 * \sa SDL_MaximizeWindow() | |
765 * \sa SDL_MinimizeWindow() | |
766 */ | |
767 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID); | |
768 | |
769 /** | |
770 * \fn int SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen) | |
771 * | |
772 * \brief Set the window's fullscreen state. | |
773 * | |
774 * \return 0 on success, or -1 if setting the display mode failed. | |
775 * | |
776 * \sa SDL_SetFullscreenDisplayMode() | |
777 */ | |
778 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID, | |
779 int fullscreen); | |
780 | |
781 /** | |
782 * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode) | |
783 * | |
784 * \brief Set the window's input grab mode. | |
785 * | |
786 * \param mode This is 1 to grab input, and 0 to release input. | |
787 * | |
788 * \sa SDL_GetWindowGrab() | |
789 */ | |
790 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID, | |
791 int mode); | |
792 | |
793 /** | |
794 * \fn int SDL_GetWindowGrab(SDL_WindowID windowID) | |
795 * | |
796 * \brief Get the window's input grab mode. | |
797 * | |
798 * \return This returns 1 if input is grabbed, and 0 otherwise. | |
799 * | |
800 * \sa SDL_SetWindowGrab() | |
801 */ | |
802 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID); | |
803 | |
804 /** | |
805 * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info) | |
806 * | |
807 * \brief Get driver specific information about a window. | |
808 * | |
809 * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo. | |
810 */ | |
811 struct SDL_SysWMinfo; | |
812 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID, | |
813 struct SDL_SysWMinfo | |
814 *info); | |
815 | |
816 /** | |
817 * \fn void SDL_DestroyWindow(SDL_WindowID windowID) | |
818 * | |
819 * \brief Destroy a window. | |
820 */ | |
821 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID); | |
822 | |
823 /** | |
824 * \fn int SDL_GetNumRenderers(void) | |
825 * | |
826 * \brief Get the number of render managers on the current display. | |
827 * | |
828 * A render manager is a set of code that handles rendering and texture | |
829 * management on a particular display. Normally there is only one, but | |
830 * some drivers may have several available with different capabilities. | |
831 * | |
832 * \sa SDL_GetRendererInfo() | |
833 * \sa SDL_CreateRenderer() | |
834 */ | |
835 extern DECLSPEC int SDLCALL SDL_GetNumRenderers(void); | |
836 | |
837 /** | |
838 * \fn SDL_RendererInfo *SDL_GetRendererInfo(int index) | |
839 * | |
840 * \brief Get information about a specific render manager on the current | |
841 * display. | |
842 * | |
843 * \sa SDL_CreateRenderer() | |
844 */ | |
845 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(int index, | |
846 SDL_RendererInfo * info); | |
847 | |
848 /** | |
849 * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags) | |
850 * | |
851 * \brief Create and make active a 2D rendering context for a window. | |
852 * | |
853 * \param windowID The window used for rendering | |
854 * \param index The index of the render manager to initialize, or -1 to initialize the first one supporting the requested flags. | |
855 * \param flags SDL_RendererFlags | |
856 * | |
857 * \return 0 on success, -1 if the flags were not supported, or -2 if | |
858 * there isn't enough memory to support the requested flags | |
859 * | |
860 * \sa SDL_SelectRenderer() | |
861 * \sa SDL_DestroyRenderer() | |
862 */ | |
863 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID, | |
864 int index, Uint32 flags); | |
865 | |
866 /** | |
867 * \fn int SDL_SelectRenderer(SDL_WindowID windowID) | |
868 * | |
869 * \brief Select the rendering context for a particular window. | |
870 * | |
871 * \return 0 on success, -1 if the selected window doesn't have a | |
872 * rendering context. | |
873 */ | |
874 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID); | |
875 | |
876 /** | |
877 * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h) | |
878 * | |
879 * \brief Create a texture for the current rendering context. | |
880 * | |
881 * \param format The format of the texture | |
882 * \param access One of the enumerated values in SDL_TextureAccess | |
883 * \param w The width of the texture in pixels | |
884 * \param h The height of the texture in pixels | |
885 * | |
886 * \return The created texture is returned, or 0 if no render manager was active, the format was unsupported, or the width or height were out of range. | |
887 * | |
888 * \sa SDL_QueryTexture() | |
889 * \sa SDL_DestroyTexture() | |
890 */ | |
891 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format, | |
892 int access, int w, | |
893 int h); | |
894 | |
895 /** | |
896 * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface *surface) | |
897 * | |
898 * \brief Create a texture from an existing surface. | |
899 * | |
900 * \param format The format of the texture, or 0 to pick an appropriate format | |
901 * \param access One of the enumerated values in SDL_TextureAccess | |
902 * \param surface The surface containing pixel data used to fill the texture | |
903 * | |
904 * \return The created texture is returned, or 0 if no render manager was active, the format was unsupported, or the surface width or height were out of range. | |
905 * | |
906 * \note The surface is not modified or freed by this function. | |
907 * | |
908 * \sa SDL_QueryTexture() | |
909 * \sa SDL_DestroyTexture() | |
910 */ | |
911 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32 | |
912 format, | |
913 int access, | |
914 SDL_Surface | |
915 * surface); | |
916 | |
917 /** | |
918 * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h) | |
919 * | |
920 * \brief Query the attributes of a texture | |
921 * | |
922 * \param texture A texture to be queried | |
923 * \param format A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format. | |
924 * \param access A pointer filled in with the actual access to the texture. | |
925 * \param w A pointer filled in with the width of the texture in pixels | |
926 * \param h A pointer filled in with the height of the texture in pixels | |
927 * | |
928 * \return 0 on success, or -1 if the texture is not valid | |
929 */ | |
930 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID, | |
931 Uint32 * format, int *access, | |
932 int *w, int *h); | |
933 | |
934 /** | |
935 * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch) | |
936 * | |
937 * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access. | |
938 * | |
939 * \param texture A texture to be queried, which was created with SDL_TextureAccess_Local | |
940 * \param pixels A pointer filled with a pointer to the pixels for the texture | |
941 * \param pitch A pointer filled in with the pitch of the pixel data | |
942 * | |
943 * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access. | |
944 */ | |
945 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID, | |
946 void **pixels, int *pitch); | |
947 | |
948 /** | |
949 * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors) | |
950 * | |
951 * \brief Update an indexed texture with a color palette | |
952 * | |
953 * \param texture The texture to update | |
954 * \param colors The array of RGB color data | |
955 * \param firstcolor The first index to update | |
956 * \param ncolors The number of palette entries to fill with the color data | |
957 * | |
958 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture | |
959 */ | |
960 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID, | |
961 const SDL_Color * colors, | |
962 int firstcolor, | |
963 int ncolors); | |
964 | |
965 /** | |
966 * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors) | |
967 * | |
968 * \brief Update an indexed texture with a color palette | |
969 * | |
970 * \param texture The texture to update | |
971 * \param colors The array to fill with RGB color data | |
972 * \param firstcolor The first index to retrieve | |
973 * \param ncolors The number of palette entries to retrieve | |
974 * | |
975 * \return 0 on success, or -1 if the texture is not valid or not an indexed texture | |
976 */ | |
977 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID, | |
978 SDL_Color * colors, | |
979 int firstcolor, | |
980 int ncolors); | |
981 | |
982 /** | |
983 * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch) | |
984 * | |
985 * \brief Update the given texture rectangle with new pixel data. | |
986 * | |
987 * \param texture The texture to update | |
988 * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. | |
989 * \param pixels The raw pixel data | |
990 * \param pitch The number of bytes between rows of pixel data | |
991 * | |
992 * \return 0 on success, or -1 if the texture is not valid | |
993 * | |
994 * \note This is a very slow function for textures not created with SDL_TextureAccess_Local. | |
995 */ | |
996 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID, | |
997 const SDL_Rect * rect, | |
998 const void *pixels, int pitch); | |
999 | |
1000 /** | |
1001 * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch) | |
1002 * | |
1003 * \brief Lock a portion of the texture for pixel access. | |
1004 * | |
1005 * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local. | |
1006 * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. | |
1007 * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked. | |
1008 * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area. | |
1009 * \param pitch This is filled in with the pitch of the locked pixels. | |
1010 * | |
1011 * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TextureAccess_Remote | |
1012 * | |
1013 * \sa SDL_DirtyTexture() | |
1014 * \sa SDL_UnlockTexture() | |
1015 */ | |
1016 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID, | |
1017 const SDL_Rect * rect, | |
1018 int markDirty, void **pixels, | |
1019 int *pitch); | |
1020 | |
1021 /** | |
1022 * \fn void SDL_UnlockTexture(SDL_TextureID textureID) | |
1023 * | |
1024 * \brief Unlock a texture, uploading the changes to video memory, if needed. | |
1025 * | |
1026 * \sa SDL_LockTexture() | |
1027 * \sa SDL_DirtyTexture() | |
1028 */ | |
1029 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID); | |
1030 | |
1031 /** | |
1032 * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects) | |
1033 * | |
1034 * \brief Mark the specified rectangles of the texture as dirty. | |
1035 * | |
1036 * \note The texture must have been created with SDL_TextureAccess_Local. | |
1037 * | |
1038 * \sa SDL_LockTexture() | |
1039 * \sa SDL_UnlockTexture() | |
1040 */ | |
1041 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID, | |
1042 int numrects, | |
1043 const SDL_Rect * rects); | |
1044 | |
1045 /** | |
1046 * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID) | |
1047 * | |
1048 * \brief Select a texture as the rendering target, or 0 to reselect the current window. | |
1049 * | |
1050 * \note The texture must have been created with SDL_TextureAccess_Render. | |
1051 */ | |
1052 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID); | |
1053 | |
1054 /** | |
1055 * \fn void SDL_RenderFill(const SDL_Rect *rect, Uint32 color) | |
1056 * | |
1057 * \brief Fill the current rendering target with the specified color. | |
1058 * | |
1059 * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target. | |
1060 * \param color An ARGB color value. | |
1061 * | |
1062 * \return 0 on success, or -1 if there is no renderer current | |
1063 */ | |
1064 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect, | |
1065 Uint32 color); | |
1066 | |
1067 /** | |
1068 * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode) | |
1069 * | |
1070 * \brief Copy a portion of the texture to the current rendering target. | |
1071 * | |
1072 * \param texture The source texture. | |
1073 * \param srcrect A pointer to the source rectangle, or NULL for the entire texture. | |
1074 * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target. | |
1075 * \param blendMode SDL_TextureBlendMode to be used if the source texture has an alpha channel. | |
1076 * \param scaleMode SDL_TextureScaleMode to be used if the source and destination rectangles don't have the same width and height. | |
1077 * | |
1078 * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation. | |
1079 * | |
1080 * \note You can check the video driver info to see what operations are supported. | |
1081 */ | |
1082 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID, | |
1083 const SDL_Rect * srcrect, | |
1084 const SDL_Rect * dstrect, | |
1085 int blendMode, int scaleMode); | |
1086 | |
1087 /** | |
1088 * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch) | |
1089 * | |
1090 * \brief Read pixels from the current rendering target. | |
1091 * | |
1092 * \param rect A pointer to the rectangle to read, or NULL for the entire render target | |
1093 * \param pixels A pointer to be filled in with the pixel data | |
1094 * \param pitch The pitch of the pixels parameter | |
1095 * | |
1096 * \return 0 on success, or -1 if pixel reading is not supported. | |
1097 * | |
1098 * \warning This is a very slow operation, and should not be used frequently. | |
1099 */ | |
1100 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect, | |
1101 void *pixels, int pitch); | |
1102 | |
1103 /** | |
1104 * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch) | |
1105 * | |
1106 * \brief Write pixels to the current rendering target. | |
1107 * | |
1108 * \param rect A pointer to the rectangle to write, or NULL for the entire render target | |
1109 * \param pixels A pointer to the pixel data to write | |
1110 * \param pitch The pitch of the pixels parameter | |
1111 * | |
1112 * \return 0 on success, or -1 if pixel writing is not supported. | |
1113 * | |
1114 * \warning This is a very slow operation, and should not be used frequently. | |
1115 */ | |
1116 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect, | |
1117 const void *pixels, | |
1118 int pitch); | |
1119 | |
1120 /** | |
1121 * \fn void SDL_RenderPresent(void) | |
1122 * | |
1123 * \brief Update the screen with rendering performed. | |
1124 */ | |
1125 extern DECLSPEC void SDLCALL SDL_RenderPresent(void); | |
1126 | |
1127 /** | |
1128 * \fn void SDL_DestroyTexture(SDL_TextureID textureID); | |
1129 * | |
1130 * \brief Destroy the specified texture. | |
1131 * | |
1132 * \sa SDL_CreateTexture() | |
1133 * \sa SDL_CreateTextureFromSurface() | |
1134 */ | |
1135 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID); | |
1136 | |
1137 /** | |
1138 * \fn void SDL_DestroyRenderer(SDL_WindowID windowID); | |
1139 * | |
1140 * \brief Destroy the rendering context for a window and free associated | |
1141 * textures. | |
1142 * | |
1143 * \sa SDL_CreateRenderer() | |
1144 */ | |
1145 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); | |
1109 | 1146 |
1110 /* | 1147 /* |
1111 * Maps an RGB triple to an opaque pixel value for a given pixel format | 1148 * Maps an RGB triple to an opaque pixel value for a given pixel format |
1112 */ | 1149 */ |
1113 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB | 1150 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB |