mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-15 14:11:31 -04:00
01a6dea813
* git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "e02e151c" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e02e151c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "86b1975e" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "86b1975e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "eb25be94" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "eb25be94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull (merge) tools/z64compress --force subrepo: subdir: "tools/z64compress" merged: "98ef0ac2" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "98ef0ac2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "45cb0d6b" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "45cb0d6b" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "48e675ff" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "48e675ff" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "3c00dcb3" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "3c00dcb3" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "47c94c99" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "47c94c99" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Declare required textures * Name texture, add decomp.me permuter settings * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "913810fc" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "913810fc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "97197f2a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "97197f2a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "623d779f" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "623d779f" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "55bba23a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "55bba23a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "a20bac94" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "a20bac94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
72 lines
1.8 KiB
C++
72 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
#include "Utils/Directory.h"
|
|
|
|
class RGBAPixel
|
|
{
|
|
public:
|
|
RGBAPixel() = default;
|
|
|
|
void SetRGBA(uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA);
|
|
void SetGrayscale(uint8_t grayscale, uint8_t alpha = 0);
|
|
|
|
uint8_t r = 0;
|
|
uint8_t g = 0;
|
|
uint8_t b = 0;
|
|
uint8_t a = 0;
|
|
};
|
|
|
|
class ImageBackend
|
|
{
|
|
public:
|
|
ImageBackend() = default;
|
|
~ImageBackend();
|
|
|
|
void ReadPng(const char* filename);
|
|
void ReadPng(const fs::path& filename);
|
|
void WritePng(const char* filename);
|
|
void WritePng(const fs::path& filename);
|
|
|
|
void SetTextureData(const std::vector<std::vector<RGBAPixel>>& texData, uint32_t nWidth,
|
|
uint32_t nHeight, uint8_t nColorType, uint8_t nBitDepth);
|
|
void InitEmptyRGBImage(uint32_t nWidth, uint32_t nHeight, bool alpha);
|
|
void InitEmptyPaletteImage(uint32_t nWidth, uint32_t nHeight);
|
|
|
|
RGBAPixel GetPixel(size_t y, size_t x) const;
|
|
uint8_t GetIndexedPixel(size_t y, size_t x) const;
|
|
|
|
void SetRGBPixel(size_t y, size_t x, uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA = 0);
|
|
void SetGrayscalePixel(size_t y, size_t x, uint8_t grayscale, uint8_t alpha = 0);
|
|
|
|
void SetIndexedPixel(size_t y, size_t x, uint8_t index, uint8_t grayscale);
|
|
void SetPaletteIndex(size_t index, uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA);
|
|
void SetPalette(const ImageBackend& pal);
|
|
|
|
uint32_t GetWidth() const;
|
|
uint32_t GetHeight() const;
|
|
uint8_t GetColorType() const;
|
|
uint8_t GetBitDepth() const;
|
|
|
|
protected:
|
|
uint8_t** pixelMatrix = nullptr; // height * [width * bytePerPixel]
|
|
|
|
void* colorPalette = nullptr;
|
|
uint8_t* alphaPalette = nullptr;
|
|
size_t paletteSize = 16 * 16;
|
|
|
|
uint32_t width = 0;
|
|
uint32_t height = 0;
|
|
uint8_t colorType = 0;
|
|
uint8_t bitDepth = 0;
|
|
|
|
bool hasImageData = false;
|
|
bool isColorIndexed = false;
|
|
|
|
double GetBytesPerPixel() const;
|
|
|
|
void FreeImageData();
|
|
};
|