7#include "imgui/imgui.h"
34 uint16_t red = color.
red / 8;
35 uint16_t green = color.
green / 8;
36 uint16_t blue = color.
blue / 8;
49 short color = (uint16_t)((rom[offset + 1]) << 8) | rom[offset];
51 new_color.
red = (color & 0x1F) * 8;
52 new_color.
green = ((color >> 5) & 0x1F) * 8;
53 new_color.
blue = ((color >> 10) & 0x1F) * 8;
58std::vector<snes_color>
Extract(
const char* data,
unsigned int offset,
59 unsigned int palette_size) {
60 std::vector<snes_color> palette(palette_size);
61 for (
unsigned int i = 0; i < palette_size * 2; i += 2) {
62 uint16_t
snes_color = (
static_cast<uint8_t
>(data[offset + i + 1]) << 8) |
63 static_cast<uint8_t
>(data[offset + i]);
69std::vector<char>
Convert(
const std::vector<snes_color>& palette) {
70 std::vector<char> data(palette.size() * 2);
71 for (
unsigned int i = 0; i < palette.size(); i++) {
73 data[i * 2] = snes_data & 0xFF;
74 data[i * 2 + 1] = snes_data >> 8;
81 rgb.x = (color & 0x1F) * 8;
82 rgb.y = ((color & 0x3E0) >> 5) * 8;
83 rgb.z = ((color & 0x7C00) >> 10) * 8;
90 std::vector<SnesColor> colors;
94 for (
int i = 0; i < 512; i += 2) {
95 colors[i / 2] =
GetCgxColor((uint16_t)((data[i + 1] << 8) + data[i]));
void set_rgb(const ImVec4 val)
struct snes_color snes_color
Primitive of 16-bit RGB SNES color.
Contains classes for handling graphical data.
std::vector< snes_color > Extract(const char *data, unsigned int offset, unsigned int palette_size)
constexpr uint16_t SNES_GREEN_MASK
uint16_t ConvertRgbToSnes(const snes_color &color)
std::vector< char > Convert(const std::vector< snes_color > &palette)
SnesColor ReadColorFromRom(int offset, const uint8_t *rom)
constexpr uint16_t SNES_BLUE_SHIFT
constexpr uint16_t SNES_GREEN_SHIFT
snes_color ConvertSnesToRgb(uint16_t color_snes)
constexpr uint16_t SNES_RED_MASK
constexpr uint16_t SNES_BLUE_MASK
constexpr uint8_t kColorByteMax
SnesColor GetCgxColor(uint16_t color)
std::vector< SnesColor > GetColFileData(uint8_t *data)
Main namespace for the application.
Primitive of 16-bit RGB SNES color.