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

Image import for the Graphics editor that keeps the image's own palette order and pixel indices. More...

#include <array>
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
#include "absl/status/statusor.h"
#include "util/indexed_png.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  yaze::editor::ImportedSheetImage
 

Namespaces

namespace  yaze
 
namespace  yaze::editor
 Editors are the view controllers for the application.
 

Enumerations

enum class  yaze::editor::ImportedImageSource { yaze::editor::kIndexedPng , yaze::editor::kPaletteStrip }
 

Functions

absl::StatusOr< ImportedSheetImage > yaze::editor::ImportSheetImage (const util::PngImage &png)
 Converts a decoded PNG without re-quantizing it.
 
absl::StatusOr< ImportedSheetImage > yaze::editor::ImportSheetImagePng (const std::vector< uint8_t > &png_bytes)
 Decodes PNG bytes (file or clipboard) and calls ImportSheetImage.
 
absl::StatusOr< std::vector< uint8_t > > yaze::editor::EncodeImportedSheetTiles (const ImportedSheetImage &image, int bpp)
 
absl::StatusOr< std::vector< uint8_t > > yaze::editor::EncodeImportedSheetPng (const ImportedSheetImage &image)
 Re-encodes the art (without the strip) as an indexed PNG in index order.
 
std::string yaze::editor::DescribeImportedSheetImage (const ImportedSheetImage &image)
 "128x32 indexed PNG, 8 colors (strip removed), highest index 7".
 
absl::StatusOr< std::vector< int > > yaze::editor::PreviewPaletteSlots (std::string_view group_name, size_t palette_size, int row, int count)
 

Detailed Description

Image import for the Graphics editor that keeps the image's own palette order and pixel indices.

Two inputs are accepted, from a PNG file or the clipboard:

  • Indexed (palette-mode) PNGs: the pixel indices and PLTE order are kept as they are.
  • RGB/RGBA PNGs with a palette strip: an 8-row strip under the art made of 8x8 swatches, swatch k holding color k (the strip may repeat, e.g. 8 colors twice across a 128-pixel sheet). Each art pixel maps to the strip index of its exact color; fully transparent pixels map to index 0. A color missing from the strip is an error, never a nearest match.

Indexed PNGs that carry the same strip (swatch k filled with index k) have it removed too. Nothing here touches the ROM or editor state.

Definition in file sheet_image_import.h.