| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Bindgen.Pixels.FunPtr
Synopsis
- sDL_GetPixelFormatName :: FunPtr (SDL_PixelFormat -> IO (PtrConst CChar))
- sDL_GetMasksForPixelFormat :: FunPtr (SDL_PixelFormat -> Ptr CInt -> Ptr Uint32 -> Ptr Uint32 -> Ptr Uint32 -> Ptr Uint32 -> IO CBool)
- sDL_GetPixelFormatForMasks :: FunPtr (CInt -> Uint32 -> Uint32 -> Uint32 -> Uint32 -> IO SDL_PixelFormat)
- sDL_GetPixelFormatDetails :: FunPtr (SDL_PixelFormat -> IO (PtrConst SDL_PixelFormatDetails))
- sDL_CreatePalette :: FunPtr (CInt -> IO (Ptr SDL_Palette))
- sDL_SetPaletteColors :: FunPtr (Ptr SDL_Palette -> PtrConst SDL_Color -> CInt -> CInt -> IO CBool)
- sDL_DestroyPalette :: FunPtr (Ptr SDL_Palette -> IO ())
- sDL_MapRGB :: FunPtr (PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Uint8 -> Uint8 -> Uint8 -> IO Uint32)
- sDL_MapRGBA :: FunPtr (PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Uint8 -> Uint8 -> Uint8 -> Uint8 -> IO Uint32)
- sDL_GetRGB :: FunPtr (Uint32 -> PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> IO ())
- sDL_GetRGBA :: FunPtr (Uint32 -> PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> IO ())
Documentation
sDL_GetPixelFormatName :: FunPtr (SDL_PixelFormat -> IO (PtrConst CChar)) Source #
Get the human readable name of a pixel format.
format- the pixel format to query.
- 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 :: FunPtr (SDL_PixelFormat -> Ptr CInt -> Ptr Uint32 -> Ptr Uint32 -> Ptr Uint32 -> Ptr Uint32 -> IO CBool) Source #
Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
format- one of the
SDL_PixelFormatvalues. bpp- a bits per pixel value; usually 15, 16, or 32.
Rmask- a pointer filled in with the red mask for the format.
Gmask- a pointer filled in with the green mask for the format.
Bmask- a pointer filled in with the blue mask for the format.
Amask- a pointer filled in with the alpha mask for the format.
- 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 :: FunPtr (CInt -> Uint32 -> Uint32 -> Uint32 -> Uint32 -> IO SDL_PixelFormat) Source #
Convert a bpp value and RGBA masks to an enumerated pixel format.
This will return SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.
bpp- a bits per pixel value; usually 15, 16, or 32.
Rmask- the red mask for the format.
Gmask- the green mask for the format.
Bmask- the blue mask for the format.
Amask- the alpha mask for the format.
- 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 :: FunPtr (SDL_PixelFormat -> IO (PtrConst SDL_PixelFormatDetails)) Source #
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.
format- one of the
SDL_PixelFormatvalues. - 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
sDL_CreatePalette :: FunPtr (CInt -> IO (Ptr SDL_Palette)) Source #
Create a palette structure with the specified number of color entries.
The palette entries are initialized to white.
ncolors- represents the number of color entries in the color palette.
- 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
sDL_SetPaletteColors :: FunPtr (Ptr SDL_Palette -> PtrConst SDL_Color -> CInt -> CInt -> IO CBool) Source #
Set a range of colors in a palette.
palette- the
SDL_Palettestructure to modify. colors- an array of
SDL_Colorstructures to copy into the palette. firstcolor- the index of the first palette entry to modify.
ncolors- the number of entries to modify.
- 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
sDL_DestroyPalette :: FunPtr (Ptr SDL_Palette -> IO ()) Source #
Free a palette created with SDL_CreatePalette().
palette- the
SDL_Palettestructure to be freed. - 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
sDL_MapRGB :: FunPtr (PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Uint8 -> Uint8 -> Uint8 -> IO Uint32) Source #
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).
format- a pointer to
SDL_PixelFormatDetailsdescribing the pixel format. palette- an optional palette for indexed formats, may be NULL.
r- the red component of the pixel in the range 0-255.
g- the green component of the pixel in the range 0-255.
b- the blue component of the pixel in the range 0-255.
- 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
sDL_MapRGBA :: FunPtr (PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Uint8 -> Uint8 -> Uint8 -> Uint8 -> IO Uint32) Source #
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).
format- a pointer to
SDL_PixelFormatDetailsdescribing the pixel format. palette- an optional palette for indexed formats, may be NULL.
r- the red component of the pixel in the range 0-255.
g- the green component of the pixel in the range 0-255.
b- the blue component of the pixel in the range 0-255.
a- the alpha component of the pixel in the range 0-255.
- 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
sDL_GetRGB :: FunPtr (Uint32 -> PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> IO ()) Source #
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]).
pixelvalue- a pixel value.
format- a pointer to
SDL_PixelFormatDetailsdescribing the pixel format. palette- an optional palette for indexed formats, may be NULL.
r- a pointer filled in with the red component, may be NULL.
g- a pointer filled in with the green component, may be NULL.
b- a pointer filled in with the blue component, may be NULL.
- 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
sDL_GetRGBA :: FunPtr (Uint32 -> PtrConst SDL_PixelFormatDetails -> PtrConst SDL_Palette -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> Ptr Uint8 -> IO ()) Source #
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).
pixelvalue- a pixel value.
format- a pointer to
SDL_PixelFormatDetailsdescribing the pixel format. palette- an optional palette for indexed formats, may be NULL.
r- a pointer filled in with the red component, may be NULL.
g- a pointer filled in with the green component, may be NULL.
b- a pointer filled in with the blue component, may be NULL.
a- a pointer filled in with the alpha component, may be NULL.
- 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