add comments for gfx classes and editors
This commit is contained in:
@@ -37,24 +37,50 @@ enum BitmapFormat {
|
||||
|
||||
|
||||
/**
|
||||
* @brief Represents a bitmap image.
|
||||
* @brief Represents a bitmap image optimized for SNES ROM hacking.
|
||||
*
|
||||
* The `Bitmap` class provides functionality to create, manipulate, and display
|
||||
* bitmap images. It supports various operations such as creating a bitmap
|
||||
* object, creating and updating textures, applying palettes, and accessing
|
||||
* pixel data.
|
||||
* bitmap images specifically designed for Link to the Past ROM editing. It supports:
|
||||
*
|
||||
* Key Features:
|
||||
* - SNES-specific pixel formats (4BPP, 8BPP, indexed)
|
||||
* - Palette management with transparent color support
|
||||
* - Tile extraction (8x8, 16x16) for ROM tile editing
|
||||
* - Memory-efficient surface/texture management via Arena
|
||||
* - Real-time editing with immediate visual feedback
|
||||
*
|
||||
* Performance Optimizations:
|
||||
* - Lazy texture creation (textures only created when needed)
|
||||
* - Modified flag tracking to avoid unnecessary updates
|
||||
* - Arena-based resource pooling to reduce allocation overhead
|
||||
* - Direct pixel data manipulation for fast editing operations
|
||||
*
|
||||
* ROM Hacking Specific:
|
||||
* - SNES color format conversion (15-bit RGB to 8-bit indexed)
|
||||
* - Tile-based editing for 8x8 and 16x16 SNES tiles
|
||||
* - Palette index management for ROM palette editing
|
||||
* - Support for multiple graphics sheets (223 total in YAZE)
|
||||
*/
|
||||
class Bitmap {
|
||||
public:
|
||||
Bitmap() = default;
|
||||
|
||||
/**
|
||||
* @brief Create a bitmap with the given dimensions and data
|
||||
* @brief Create a bitmap with the given dimensions and raw pixel data
|
||||
* @param width Width in pixels (typically 128, 256, or 512 for SNES tilesheets)
|
||||
* @param height Height in pixels (typically 32, 64, or 128 for SNES tilesheets)
|
||||
* @param depth Color depth in bits per pixel (4, 8, or 16 for SNES)
|
||||
* @param data Raw pixel data (indexed color values for SNES graphics)
|
||||
*/
|
||||
Bitmap(int width, int height, int depth, const std::vector<uint8_t> &data);
|
||||
|
||||
/**
|
||||
* @brief Create a bitmap with the given dimensions, data, and palette
|
||||
* @brief Create a bitmap with the given dimensions, data, and SNES palette
|
||||
* @param width Width in pixels
|
||||
* @param height Height in pixels
|
||||
* @param depth Color depth in bits per pixel
|
||||
* @param data Raw pixel data (indexed color values)
|
||||
* @param palette SNES palette for color mapping (15-bit RGB format)
|
||||
*/
|
||||
Bitmap(int width, int height, int depth, const std::vector<uint8_t> &data,
|
||||
const SnesPalette &palette);
|
||||
@@ -148,23 +174,41 @@ class Bitmap {
|
||||
void WriteColor(int position, const ImVec4 &color);
|
||||
|
||||
/**
|
||||
* @brief Set a pixel at the given x,y coordinates
|
||||
* @brief Set a pixel at the given x,y coordinates with SNES color
|
||||
* @param x X coordinate (0 to width-1)
|
||||
* @param y Y coordinate (0 to height-1)
|
||||
* @param color SNES color (15-bit RGB format)
|
||||
* @note Automatically finds closest palette index and marks bitmap as modified
|
||||
*/
|
||||
void SetPixel(int x, int y, const SnesColor& color);
|
||||
|
||||
/**
|
||||
* @brief Resize the bitmap to new dimensions
|
||||
* @brief Resize the bitmap to new dimensions (preserves existing data)
|
||||
* @param new_width New width in pixels
|
||||
* @param new_height New height in pixels
|
||||
* @note Expands with black pixels, crops excess data
|
||||
*/
|
||||
void Resize(int new_width, int new_height);
|
||||
|
||||
/**
|
||||
* @brief Extract an 8x8 tile from the bitmap
|
||||
* @brief Extract an 8x8 tile from the bitmap (SNES standard tile size)
|
||||
* @param tile_index Index of the tile in the tilesheet
|
||||
* @param x X offset within the tile (0-7)
|
||||
* @param y Y offset within the tile (0-7)
|
||||
* @param tile_data Output buffer for tile pixel data (64 bytes for 8x8)
|
||||
* @param tile_data_offset Current offset in tile_data buffer
|
||||
* @note Used for ROM tile editing and tile extraction
|
||||
*/
|
||||
void Get8x8Tile(int tile_index, int x, int y, std::vector<uint8_t> &tile_data,
|
||||
int &tile_data_offset);
|
||||
|
||||
/**
|
||||
* @brief Extract a 16x16 tile from the bitmap
|
||||
* @brief Extract a 16x16 tile from the bitmap (SNES metatile size)
|
||||
* @param tile_x X coordinate of tile in tilesheet
|
||||
* @param tile_y Y coordinate of tile in tilesheet
|
||||
* @param tile_data Output buffer for tile pixel data (256 bytes for 16x16)
|
||||
* @param tile_data_offset Current offset in tile_data buffer
|
||||
* @note Used for ROM metatile editing and large tile extraction
|
||||
*/
|
||||
void Get16x16Tile(int tile_x, int tile_y, std::vector<uint8_t> &tile_data,
|
||||
int &tile_data_offset);
|
||||
|
||||
Reference in New Issue
Block a user