yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
gfx_sheet_png.h File Reference

3bpp graphics sheets to and from indexed PNGs. More...

#include <array>
#include <cstdint>
#include <utility>
#include <vector>
#include "absl/status/statusor.h"
#include "rom/rom.h"
#include "util/indexed_png.h"
#include "zelda3/dungeon/room_default_entrance.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  yaze::zelda3::SheetImportResult
 
struct  yaze::zelda3::RoomBackgroundSet
 
struct  yaze::zelda3::RoomSheetPaletteContext
 
struct  yaze::zelda3::RoomSheetImport
 

Namespaces

namespace  yaze
 
namespace  yaze::zelda3
 Zelda 3 specific classes and functions.
 

Typedefs

using yaze::zelda3::SheetColor = std::array<uint8_t, 3>
 
using yaze::zelda3::SheetPalette = std::array<SheetColor, 8>
 Colors for 3bpp indices 0-7. Index 0 is exported as transparent.
 

Functions

SheetPalette yaze::zelda3::GrayscaleSheetPalette ()
 
absl::StatusOr< SheetPalette > yaze::zelda3::RoomBackgroundSheetPalette (Rom &rom, GameData &data, int room, int row)
 
absl::StatusOr< SheetPalette > yaze::zelda3::RoomSpriteSheetPalette (Rom &rom, GameData &data, int room, int row)
 Sprite palette row (OAM palette 0-7, CGRAM row 8 + row) of room room.
 
absl::StatusOr< std::vector< uint8_t > > yaze::zelda3::ExportSheetBlocksPng (const std::vector< uint8_t > &snes_3bpp, const SheetPalette &palette, int first_block, int block_count)
 
absl::StatusOr< SheetImportResult > yaze::zelda3::ImportSheetBlocksPng (const std::vector< uint8_t > &snes_3bpp, const util::PngImage &png, int first_block, const SheetPalette &palette)
 Places a PNG's 16x16 blocks over a sheet from first_block.
 
RoomBackgroundSet yaze::zelda3::ResolveRoomBackgroundSet (const GameData &data, int room, uint8_t header_blockset)
 
absl::StatusOr< RoomSheetPaletteContext > yaze::zelda3::ResolveRoomSheetPalette (Rom &rom, GameData &data, int room, int slot, int row)
 
std::vector< RoomBackgroundSet > yaze::zelda3::ResolveAllRoomBackgroundSets (const Rom &rom, const GameData &data)
 All 296 rooms' background sets (header bytes read from the ROM).
 
absl::StatusOr< std::vector< uint8_t > > yaze::zelda3::ExportRoomBackgroundPng (const Rom &rom, const RoomBackgroundSet &set, const SheetPalette &palette)
 
absl::StatusOr< std::vector< RoomSheetImport > > yaze::zelda3::ImportRoomBackgroundPng (const Rom &rom, const RoomBackgroundSet &set, const util::PngImage &png, const SheetPalette &palette)
 

Detailed Description

3bpp graphics sheets to and from indexed PNGs.

A sheet is 128x32 pixels: 16 blocks of 16x16 in an 8x2 grid, block b at pixel (b % 8 * 16, b / 8 * 16). A block holds 8x8 tiles n, n+1, n+16, n+17 (GfxSheetBlockTiles), so copying a 16x16 pixel region keeps SNES tile order. Exported PNGs lay out their blocks the same way, eight per row.

Definition in file gfx_sheet_png.h.