Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::TextureImporter Class Reference

#include <TextureImporter.h>

Inherits DekiEditor::IAssetImporter.

Public Member Functions

std::vector< std::string > GetSupportedExtensions () const override
std::string GetImporterName () const override
ImportResult Import (const std::string &sourcePath, const std::string &cachePath) override
ImportResult ImportWithFormat (const std::string &sourcePath, const std::string &cachePath, TextureFormat format)
Public Member Functions inherited from DekiEditor::IAssetImporter
virtual ~IAssetImporter ()=default
virtual bool NeedsReimport (const std::string &sourcePath, const std::string &cachePath) const

Static Public Member Functions

static bool WriteTexFile (const std::string &path, const uint8_t *rgbaData, uint32_t width, uint32_t height, TextureFormat format=TextureFormat::RGB565A8, const SpriteSettings *spriteSettings=nullptr, const std::vector< SubAssetInfo > *frameSubAssets=nullptr, const ChromaKeySettings *chromaKey=nullptr)
static bool ReadTexFile (const std::string &path, TexData &outData)
static std::vector< uint8_t > ConvertToRGBA (const TexData &data)
static bool HasAlphaChannel (const uint8_t *rgbaData, size_t pixelCount)
static std::vector< AtlasFrameAutoDetectFrames (const uint8_t *rgbaData, uint32_t width, uint32_t height, uint8_t alphaThreshold=10, int minWidth=1, int minHeight=1)
 Automatically detect sprite frames from texture by analyzing transparent regions.
static std::vector< SubAssetInfoGenerateFrameSubAssets (const std::string &parentGuid, int texWidth, int texHeight, const SpriteSettings &settings)
 Generate sprite frame sub-assets from sprite settings.
static const SpriteFrameDataGetFrameData (const std::string &frameGuid)
 Get sprite frame data by frame GUID.
static void RegisterFrameData (const std::string &frameGuid, const SpriteFrameData &data)
 Register sprite frame data for a frame GUID.
static void ClearFrameData ()
 Clear all registered frame data (called when rebuilding asset cache).
static bool HasFrameListChunk (const std::string &texPath)
 Check if a .tex file contains a FrameList metadata chunk.

Member Function Documentation

◆ GetSupportedExtensions()

std::vector< std::string > DekiEditor::TextureImporter::GetSupportedExtensions ( ) const
inlineoverridevirtual

◆ GetImporterName()

std::string DekiEditor::TextureImporter::GetImporterName ( ) const
inlineoverridevirtual

◆ Import()

ImportResult DekiEditor::TextureImporter::Import ( const std::string & sourcePath,
const std::string & cachePath )
overridevirtual

◆ ImportWithFormat()

ImportResult DekiEditor::TextureImporter::ImportWithFormat ( const std::string & sourcePath,
const std::string & cachePath,
TextureFormat format )

◆ WriteTexFile()

bool DekiEditor::TextureImporter::WriteTexFile ( const std::string & path,
const uint8_t * rgbaData,
uint32_t width,
uint32_t height,
TextureFormat format = TextureFormat::RGB565A8,
const SpriteSettings * spriteSettings = nullptr,
const std::vector< SubAssetInfo > * frameSubAssets = nullptr,
const ChromaKeySettings * chromaKey = nullptr )
static

◆ ReadTexFile()

bool DekiEditor::TextureImporter::ReadTexFile ( const std::string & path,
TexData & outData )
static

◆ ConvertToRGBA()

std::vector< uint8_t > DekiEditor::TextureImporter::ConvertToRGBA ( const TexData & data)
static

◆ HasAlphaChannel()

bool DekiEditor::TextureImporter::HasAlphaChannel ( const uint8_t * rgbaData,
size_t pixelCount )
static

◆ AutoDetectFrames()

std::vector< AtlasFrame > DekiEditor::TextureImporter::AutoDetectFrames ( const uint8_t * rgbaData,
uint32_t width,
uint32_t height,
uint8_t alphaThreshold = 10,
int minWidth = 1,
int minHeight = 1 )
static

Automatically detect sprite frames from texture by analyzing transparent regions.

Parameters
rgbaDataRGBA pixel data (4 bytes per pixel)
widthTexture width
heightTexture height
alphaThresholdAlpha value below which pixels are considered transparent (0-255)
minWidthMinimum frame width to detect (ignore smaller regions)
minHeightMinimum frame height to detect (ignore smaller regions)
Returns
Vector of detected atlas frames

◆ GenerateFrameSubAssets()

std::vector< SubAssetInfo > DekiEditor::TextureImporter::GenerateFrameSubAssets ( const std::string & parentGuid,
int texWidth,
int texHeight,
const SpriteSettings & settings )
static

Generate sprite frame sub-assets from sprite settings.

Parameters
parentGuidParent texture asset GUID
texWidthTexture width in pixels
texHeightTexture height in pixels
settingsSprite slicing settings
Returns
Vector of SubAssetInfo for each frame (empty if no frames)

◆ GetFrameData()

const SpriteFrameData * DekiEditor::TextureImporter::GetFrameData ( const std::string & frameGuid)
static

Get sprite frame data by frame GUID.

Parameters
frameGuidFrame GUID
Returns
Pointer to frame data or nullptr if not found

◆ RegisterFrameData()

void DekiEditor::TextureImporter::RegisterFrameData ( const std::string & frameGuid,
const SpriteFrameData & data )
static

Register sprite frame data for a frame GUID.

Parameters
frameGuidFrame GUID
dataFrame coordinate data

◆ ClearFrameData()

void DekiEditor::TextureImporter::ClearFrameData ( )
static

Clear all registered frame data (called when rebuilding asset cache).

◆ HasFrameListChunk()

bool DekiEditor::TextureImporter::HasFrameListChunk ( const std::string & texPath)
static

Check if a .tex file contains a FrameList metadata chunk.

Parameters
texPathPath to the .tex file
Returns
true if FrameList chunk exists, false otherwise

The documentation for this class was generated from the following file: