add more comments to gfx classes and canvas

This commit is contained in:
scawful
2024-04-14 00:11:50 -05:00
parent 96defd6e5e
commit 012eee1525
4 changed files with 64 additions and 11 deletions

View File

@@ -28,6 +28,14 @@ bool ConvertSurfaceToPNG(SDL_Surface *surface, std::vector<uint8_t> &buffer);
void ConvertPngToSurface(const std::vector<uint8_t> &png_data,
SDL_Surface **outSurface);
/**
* @brief Represents a bitmap image.
*
* 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.
*/
class Bitmap {
public:
Bitmap() = default;

View File

@@ -35,8 +35,17 @@ uint32_t GetPaletteAddress(const std::string& group_name, size_t palette_index,
size_t color_index);
/**
* @brief SNES Palette container
*/
* @brief Represents a palette of colors for the Super Nintendo Entertainment
* System (SNES).
*
* The `SnesPalette` class provides functionality to create, modify, and access
* colors in an SNES palette. It supports various constructors to initialize the
* palette with different types of data. The palette can be modified by adding
* or changing colors, and it can be cleared to remove all colors. Colors in the
* palette can be accessed using index-based access or through the `GetColor`
* method. The class also provides a method to create a sub-palette by selecting
* a range of colors from the original palette.
*/
class SnesPalette {
public:
template <typename T>
@@ -202,8 +211,27 @@ absl::StatusOr<PaletteGroup> CreatePaletteGroupFromColFile(
absl::StatusOr<PaletteGroup> CreatePaletteGroupFromLargePalette(
SnesPalette& palette);
/**
* @brief Represents a set of palettes used in a SNES graphics system.
*/
struct Paletteset {
/**
* @brief Default constructor for Paletteset.
*/
Paletteset() = default;
/**
* @brief Constructor for Paletteset.
* @param main The main palette.
* @param animated The animated palette.
* @param aux1 The first auxiliary palette.
* @param aux2 The second auxiliary palette.
* @param background The background color.
* @param hud The HUD palette.
* @param spr The sprite palette.
* @param spr2 The second sprite palette.
* @param comp The composite palette.
*/
Paletteset(gfx::SnesPalette main, gfx::SnesPalette animated,
gfx::SnesPalette aux1, gfx::SnesPalette aux2,
gfx::SnesColor background, gfx::SnesPalette hud,
@@ -217,15 +245,16 @@ struct Paletteset {
spr(spr),
spr2(spr2),
composite(comp) {}
gfx::SnesPalette main;
gfx::SnesPalette animated;
gfx::SnesPalette aux1;
gfx::SnesPalette aux2;
gfx::SnesColor background;
gfx::SnesPalette hud;
gfx::SnesPalette spr;
gfx::SnesPalette spr2;
gfx::SnesPalette composite;
gfx::SnesPalette main; /**< The main palette. */
gfx::SnesPalette animated; /**< The animated palette. */
gfx::SnesPalette aux1; /**< The first auxiliary palette. */
gfx::SnesPalette aux2; /**< The second auxiliary palette. */
gfx::SnesColor background; /**< The background color. */
gfx::SnesPalette hud; /**< The HUD palette. */
gfx::SnesPalette spr; /**< The sprite palette. */
gfx::SnesPalette spr2; /**< The second sprite palette. */
gfx::SnesPalette composite; /**< The composite palette. */
};
} // namespace gfx

View File

@@ -15,6 +15,14 @@ namespace gfx {
enum class TileType { Tile8, Tile16 };
/**
* @class Tilesheet
* @brief Represents a tilesheet, which is a collection of tiles stored in a
* bitmap.
*
* The Tilesheet class provides methods to manipulate and extract tiles from the
* tilesheet. It also supports copying and mirroring tiles within the tilesheet.
*/
class Tilesheet {
public:
Tilesheet() = default;

View File

@@ -20,6 +20,14 @@ enum class CanvasType { kTile, kBlock, kMap };
enum class CanvasMode { kPaint, kSelect };
enum class CanvasGridSize { k8x8, k16x16, k32x32, k64x64 };
/**
* @class Canvas
* @brief Represents a canvas for drawing and manipulating graphics.
*
* The Canvas class provides various functions for updating and drawing graphics
* on a canvas. It supports features such as bitmap drawing, context menu
* handling, tile painting, custom grid, and more.
*/
class Canvas {
public:
Canvas() = default;