|
NSUNI/NSLAR Library a250670
|
Functions | |
| Texture | nnl::texture::Convert (STexture &&image, const ConvertParam &tex_param={}) |
| Converts a texture from a simplified representation to the in-game format. | |
| STexture | nnl::texture::Convert (const Texture &texture, unsigned int level=0) |
| Converts a texture from the in-game format to a simplified representation. | |
| Buffer | nnl::texture::ConvertRGB565ToRGBA8888 (BufferView bitmap565) |
| Converts an image buffer from RGB565 format to RGBA8888 format. | |
| Buffer | nnl::texture::ConvertRGBA5551ToRGBA8888 (BufferView bitmap5551) |
| Converts an image buffer from RGBA5551 format to RGBA8888 format. | |
| Buffer | nnl::texture::ConvertRGBA4444ToRGBA8888 (BufferView bitmap4444) |
| Converts an image buffer from RGBA4444 format to RGBA8888 format. | |
| Buffer | nnl::texture::ConvertRGBA8888ToRGBA4444 (BufferView bitmap8888) |
| Converts an image buffer from RGBA8888 format to RGBA4444 format. | |
| Buffer | nnl::texture::ConvertRGBA8888ToRGBA5551 (BufferView bitmap8888) |
| Converts an image buffer from RGBA8888 format to RGBA5551 format. | |
| Buffer | nnl::texture::ConvertRGBA8888ToRGB565 (BufferView bitmap8888) |
| Converts an image buffer from RGBA8888 format to RGB565 format. | |
| Buffer | nnl::texture::UnswizzleFromMem (BufferView texptr, u32 bufw, u32 height, u32 bytes_per_pixel) |
| Unswizzles texture data. | |
| Buffer | nnl::texture::SwizzleFromMem (Buffer &texptr, u32 bufw, u32 height, u32 bytes_per_pixel) |
| Swizzles texture data. | |
| u32 | nnl::texture::QuickTexHash (BufferView data) |
| Computes a quick hash for a texture. | |
| Buffer | nnl::texture::ConvertIndexed4To8 (BufferView clut4, u32 width) |
| Converts a 4-bit indexed texture to an 8-bit indexed texture. | |
| Buffer | nnl::texture::ConvertIndexed8To4 (BufferView clut8, u32 width) |
| Converts an 8-bit indexed texture to a 4-bit indexed texture. | |
| std::vector< SPixel > | nnl::texture::GeneratePaletteMedian (const STexture &source_image, std::size_t num_colors=256) |
| Creates a color palette using the median cut algorithm. | |
| std::vector< SPixel > | nnl::texture::GeneratePaletteNaive (const STexture &source_image, std::size_t num_colors=256) |
| Creates a color palette by extracting the first N unique colors from the image. | |
| std::vector< u8 > | nnl::texture::ApplyPalette (const STexture &image, const std::vector< SPixel > &palette, bool dither=true) |
| Applies a color palette to the image. | |
| Buffer | nnl::texture::AlignBufferWidth (BufferView image_buffer, unsigned int width, unsigned int height, unsigned int bpp, unsigned int buffer_width) |
| Aligns the buffer width to a desired buffer width. | |
| Buffer | nnl::texture::DealignBufferWidth (BufferView image_buffer, unsigned int width, unsigned int height, unsigned int bpp, unsigned int buffer_width) |
| Removes padding from an aligned image buffer. | |
| Buffer | nnl::texture::DeindexClut8ToRGBA8888 (BufferView indexed_image, BufferView palette) |
| Converts an 8-bit indexed image buffer to an RGBA8888 buffer. | |
| ConvertParam | nnl::texture::GenerateConvertParam (const Texture &texture) |
| Generates conversion parameters from a given texture. | |
| std::vector< ConvertParam > | nnl::texture::GenerateConvertParam (const TextureContainer &texture_container) |
| Generates conversion parameters from a given texture container. | |
| Buffer nnl::texture::AlignBufferWidth | ( | BufferView | image_buffer, |
| unsigned int | width, | ||
| unsigned int | height, | ||
| unsigned int | bpp, | ||
| unsigned int | buffer_width ) |
Aligns the buffer width to a desired buffer width.
This function takes an image buffer and adjusts its width to ensure it's aligned to a minimum of 16 bytes, which is a requirement for the GE.
| image_buffer | A vector containing the original image data. |
| width | The width of the image in pixels. |
| height | The height of the image in pixels. |
| bpp | The number of bytes per pixel. 0 for less than a byte. |
| buffer_width | The desired width of the buffer in pixels. |
| std::vector< u8 > nnl::texture::ApplyPalette | ( | const STexture & | image, |
| const std::vector< SPixel > & | palette, | ||
| bool | dither = true ) |
Applies a color palette to the image.
This function converts the image to an indexed color format using the specified palette. Replaces each pixel's color with the closest matching color from the palette.
| image | The source texture to which the palette will be applied. |
| palette | A vector of SPixel representing the color palette to be applied to the texture. |
| dither | A flag indicating whether dithering should be used during the palette application. It can help reduce color banding artifacts. |
Converts a texture from the in-game format to a simplified representation.
This function takes an in-game texture in various formats and converts it into a simplified representation.
| texture | The input texture to be converted. |
| level | The texture level to convert. The default value is 0, which corresponds to the base level. Higher values correspond to mipmaps. |
| Texture nnl::texture::Convert | ( | STexture && | image, |
| const ConvertParam & | tex_param = {} ) |
Converts a texture from a simplified representation to the in-game format.
This function takes a simple texture and converts it to the in-game format using the provided settings.
| image | The input texture to be converted. |
| tex_param | A ConvertParam structure containing the conversion settings. |
| Buffer nnl::texture::ConvertIndexed4To8 | ( | BufferView | clut4, |
| u32 | width ) |
Converts a 4-bit indexed texture to an 8-bit indexed texture.
| clut4 | A vector containing the texture data in 4-bit indexed format. |
| width | Texture width |
| Buffer nnl::texture::ConvertIndexed8To4 | ( | BufferView | clut8, |
| u32 | width ) |
Converts an 8-bit indexed texture to a 4-bit indexed texture.
| clut8 | A vector containing the texture data in 8-bit indexed format. |
| width | Texture width |
| Buffer nnl::texture::ConvertRGB565ToRGBA8888 | ( | BufferView | bitmap565 | ) |
Converts an image buffer from RGB565 format to RGBA8888 format.
| bitmap565 | A vector containing the image data in RGB565 format. |
| Buffer nnl::texture::ConvertRGBA4444ToRGBA8888 | ( | BufferView | bitmap4444 | ) |
Converts an image buffer from RGBA4444 format to RGBA8888 format.
| bitmap4444 | A vector containing the image data in RGBA4444 format. |
| Buffer nnl::texture::ConvertRGBA5551ToRGBA8888 | ( | BufferView | bitmap5551 | ) |
Converts an image buffer from RGBA5551 format to RGBA8888 format.
| bitmap5551 | A vector containing the image data in RGBA5551 format. |
| Buffer nnl::texture::ConvertRGBA8888ToRGB565 | ( | BufferView | bitmap8888 | ) |
Converts an image buffer from RGBA8888 format to RGB565 format.
| bitmap8888 | A vector containing the image data in RGBA8888 format. |
| Buffer nnl::texture::ConvertRGBA8888ToRGBA4444 | ( | BufferView | bitmap8888 | ) |
Converts an image buffer from RGBA8888 format to RGBA4444 format.
| bitmap8888 | A vector containing the image data in RGBA8888 format. |
| Buffer nnl::texture::ConvertRGBA8888ToRGBA5551 | ( | BufferView | bitmap8888 | ) |
Converts an image buffer from RGBA8888 format to RGBA5551 format.
| bitmap8888 | A vector containing the image data in RGBA8888 format. |
| Buffer nnl::texture::DealignBufferWidth | ( | BufferView | image_buffer, |
| unsigned int | width, | ||
| unsigned int | height, | ||
| unsigned int | bpp, | ||
| unsigned int | buffer_width ) |
Removes padding from an aligned image buffer.
This function takes an image buffer that has been aligned to a certain buffer width and removes the extra padding.
| image_buffer | A vector containing the aligned image buffer. |
| width | The actual width of the image in pixels. |
| height | The height of the image in pixels. |
| bpp | The number of bytes per pixel. 0 for less than a byte. |
| buffer_width | The width of the buffer in pixels. |
| Buffer nnl::texture::DeindexClut8ToRGBA8888 | ( | BufferView | indexed_image, |
| BufferView | palette ) |
Converts an 8-bit indexed image buffer to an RGBA8888 buffer.
This function takes an 8-bit indexed image and applies the provided RGBA8888 color palette to convert it into a standard RGBA8888 format. Each byte in the indexed image is replaced with its corresponding color from the palette, resulting in a simple RGBA8888 image.
| indexed_image | A vector containing the 8-bit indexed image data. |
| palette | A vector containing the RGBA8888 color palette. |
| ConvertParam nnl::texture::GenerateConvertParam | ( | const Texture & | texture | ) |
Generates conversion parameters from a given texture.
This function attempts to create a ConvertParam object that would result in a similar in-game texture when converting from a simplified representation back to the in-game format.
| texture | The source texture from which to generate conversion parameters. |
| std::vector< ConvertParam > nnl::texture::GenerateConvertParam | ( | const TextureContainer & | texture_container | ) |
Generates conversion parameters from a given texture container.
This function attempts to create a vector of ConvertParam objects that would result in similar in-game textures when converting from a simplified texture representation back to the in-game format.
| texture_container | The source container holding the textures from which to generate conversion parameters. |
| std::vector< SPixel > nnl::texture::GeneratePaletteMedian | ( | const STexture & | source_image, |
| std::size_t | num_colors = 256 ) |
Creates a color palette using the median cut algorithm.
| source_image | The source texture from which to generate the color palette. |
| num_colors | The maximum number of colors in the generated palette. |
| std::vector< SPixel > nnl::texture::GeneratePaletteNaive | ( | const STexture & | source_image, |
| std::size_t | num_colors = 256 ) |
Creates a color palette by extracting the first N unique colors from the image.
| source_image | The source texture from which to generate the color palette. |
| num_colors | The maximum number of colors in the generated palette. |
| u32 nnl::texture::QuickTexHash | ( | BufferView | data | ) |
Computes a quick hash for a texture.
It can generate a part of a hash that is used by PPSSPP for texture caching and replacement.
| data | The data to be hashed. |
Swizzles texture data.
This function takes linear texture data and reorders it to make it more adapted to the way the GE reads it. This is only applicable to textures with buffer width bigger than 16 bytes.
| texptr | A vector containing texture data. |
| bufw | The buffer width of the texture in pixels |
| height | The height of the texture in pixels |
| bytes_per_pixel | The number of bytes used to represent each pixel. 0 for less than a byte. |
| Buffer nnl::texture::UnswizzleFromMem | ( | BufferView | texptr, |
| u32 | bufw, | ||
| u32 | height, | ||
| u32 | bytes_per_pixel ) |
Unswizzles texture data.
This function takes texture data that was reordered for more efficient use by the GE and converts it back to a linear format.
| texptr | A vector containing the swizzled texture data. |
| bufw | The buffer width of the texture in pixels |
| height | The height of the texture in pixels |
| bytes_per_pixel | The number of bytes used to represent each pixel. 0 for less than a byte. |