| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Bindgen.Pixels.Safe
Synopsis
- sDL_GetPixelFormatName :: SDL_PixelFormat -> IO (PtrConst CChar)
- sDL_GetMasksForPixelFormat :: SDL_PixelFormat -> Ptr CInt -> Ptr Uint32 -> Ptr Uint32 -> Ptr Uint32 -> Ptr Uint32 -> IO CBool
- sDL_GetPixelFormatForMasks :: CInt -> Uint32 -> Uint32 -> Uint32 -> Uint32 -> IO SDL_PixelFormat
- sDL_GetPixelFormatDetails :: SDL_PixelFormat -> IO (PtrConst SDL_PixelFormatDetails)
- sDL_CreatePalette :: CInt -> IO (Ptr SDL_Palette)
- sDL_SetPaletteColors :: Ptr SDL_Palette -> PtrConst SDL_Color -> CInt -> CInt -> IO CBool
- sDL_DestroyPalette :: Ptr SDL_Palette -> IO ()
- sDL_MapRGB :: PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Uint8 -> Uint8 -> Uint8 -> IO Uint32
- sDL_MapRGBA :: PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Uint8 -> Uint8 -> Uint8 -> Uint8 -> IO Uint32
- sDL_GetRGB :: Uint32 -> PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> IO ()
- sDL_GetRGBA :: Uint32 -> PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> IO ()
Documentation
sDL_GetPixelFormatName Source #
Arguments
| :: SDL_PixelFormat |
|
| -> IO (PtrConst CChar) |
Get the human readable name of a pixel format.
- Returns
- the human readable name of the specified pixel format or "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetPixelFormatName, defined atSDL3/SDL_pixels.h 1185:42
Since: 3.2.0
sDL_GetMasksForPixelFormat Source #
Arguments
| :: SDL_PixelFormat |
|
| -> Ptr CInt |
|
| -> Ptr Uint32 |
|
| -> Ptr Uint32 |
|
| -> Ptr Uint32 |
|
| -> Ptr Uint32 |
|
| -> IO CBool |
Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetPixelFormatForMasks- C declaration
SDL_GetMasksForPixelFormat, defined atSDL3/SDL_pixels.h 1205:34
Since: 3.2.0
sDL_GetPixelFormatForMasks Source #
Arguments
| :: CInt |
|
| -> Uint32 |
|
| -> Uint32 |
|
| -> Uint32 |
|
| -> Uint32 |
|
| -> IO SDL_PixelFormat |
Convert a bpp value and RGBA masks to an enumerated pixel format.
This will return SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.
- Returns
- the
SDL_PixelFormatvalue corresponding to the format masks, or SDL_PIXELFORMAT_UNKNOWN if there isn't a match. - Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetMasksForPixelFormat- C declaration
SDL_GetPixelFormatForMasks, defined atSDL3/SDL_pixels.h 1227:45
Since: 3.2.0
sDL_GetPixelFormatDetails Source #
Arguments
| :: SDL_PixelFormat |
|
| -> IO (PtrConst SDL_PixelFormatDetails) |
Create an SDL_PixelFormatDetails structure corresponding to a pixel format.
Returned structure may come from a shared global cache (i.e. not newly allocated), and hence should not be modified, especially the palette. Weird errors such as Blit combination not supported may occur.
- Returns
- a pointer to a
SDL_PixelFormatDetailsstructure or NULL on failure; call SDL_GetError() for more information. - Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetPixelFormatDetails, defined atSDL3/SDL_pixels.h 1244:60
Since: 3.2.0
Arguments
| :: CInt |
|
| -> IO (Ptr SDL_Palette) |
Create a palette structure with the specified number of color entries.
The palette entries are initialized to white.
- Returns
- a new
SDL_Palettestructure on success or NULL on failure (e.g. if there wasn't enough memory); call SDL_GetError() for more information. - Thread safety
- It is safe to call this function from any thread.
- See also
sDL_DestroyPalette,sDL_SetPaletteColors, SDL_SetSurfacePalette- C declaration
SDL_CreatePalette, defined atSDL3/SDL_pixels.h 1264:43
Since: 3.2.0
Arguments
| :: Ptr SDL_Palette |
|
| -> PtrConst SDL_Color |
|
| -> CInt |
|
| -> CInt |
|
| -> IO CBool |
Set a range of colors in a palette.
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.
- C declaration
SDL_SetPaletteColors, defined atSDL3/SDL_pixels.h 1281:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Palette |
|
| -> IO () |
Free a palette created with SDL_CreatePalette().
- Thread safety
- It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.
- See also
sDL_CreatePalette- C declaration
SDL_DestroyPalette, defined atSDL3/SDL_pixels.h 1295:34
Since: 3.2.0
Arguments
| :: PtrConst SDL_PixelFormatDetails |
|
| -> PtrConst SDL_Palette |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> IO Uint32 |
Map an RGB triple to an opaque pixel value for a given pixel format.
This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque).
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
- Returns
- a pixel value.
- Thread safety
- It is safe to call this function from any thread, as long as the palette is not modified.
- See also
sDL_GetPixelFormatDetails,sDL_GetRGB,sDL_MapRGBA, SDL_MapSurfaceRGB- C declaration
SDL_MapRGB, defined atSDL3/SDL_pixels.h 1333:36
Since: 3.2.0
Arguments
| :: PtrConst SDL_PixelFormatDetails |
|
| -> PtrConst SDL_Palette |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> Uint8 |
|
| -> IO Uint32 |
Map an RGBA quadruple to a pixel value for a given pixel format.
This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.
If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
- Returns
- a pixel value.
- Thread safety
- It is safe to call this function from any thread, as long as the palette is not modified.
- See also
sDL_GetPixelFormatDetails,sDL_GetRGBA,sDL_MapRGB, SDL_MapSurfaceRGBA- C declaration
SDL_MapRGBA, defined atSDL3/SDL_pixels.h 1372:36
Since: 3.2.0
Arguments
| :: Uint32 |
|
| -> PtrConst SDL_PixelFormatDetails |
|
| -> PtrConst SDL_Palette |
|
| -> Ptr Uint8 |
|
| -> Ptr Uint8 |
|
| -> Ptr Uint8 |
|
| -> IO () |
Get RGB values from a pixel in the specified format.
This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
- Thread safety
- It is safe to call this function from any thread, as long as the palette is not modified.
- See also
sDL_GetPixelFormatDetails,sDL_GetRGBA,sDL_MapRGB,sDL_MapRGBA- C declaration
SDL_GetRGB, defined atSDL3/SDL_pixels.h 1400:34
Since: 3.2.0
Arguments
| :: Uint32 |
|
| -> PtrConst SDL_PixelFormatDetails |
|
| -> PtrConst SDL_Palette |
|
| -> Ptr Uint8 |
|
| -> Ptr Uint8 |
|
| -> Ptr Uint8 |
|
| -> Ptr Uint8 |
|
| -> IO () |
Get RGBA values from a pixel in the specified format.
This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque).
- Thread safety
- It is safe to call this function from any thread, as long as the palette is not modified.
- See also
sDL_GetPixelFormatDetails,sDL_GetRGB,sDL_MapRGB,sDL_MapRGBA- C declaration
SDL_GetRGBA, defined atSDL3/SDL_pixels.h 1432:34
Since: 3.2.0