1
0
mirror of synced 2024-11-28 09:30:51 +01:00

feat: Added RGB565 color row to data inspector

This commit is contained in:
WerWolv 2022-08-01 13:58:23 +02:00
parent 3859336f0c
commit bed9f324ce
8 changed files with 24 additions and 3 deletions

View File

@ -539,6 +539,20 @@ namespace hex::plugin::builtin {
return copyValue; return copyValue;
}; };
}); });
ContentRegistry::DataInspector::add("hex.builtin.inspector.rgb565", sizeof(u16), [](auto buffer, auto endian, auto style) {
hex::unused(style);
auto value = hex::changeEndianess(*reinterpret_cast<u16 *>(buffer.data()), endian);
ImColor color((value & 0x1F) << 3, ((value >> 5) & 0x3F) << 2, ((value >> 11) & 0x1F) << 3, 0xFF);
auto copyValue = hex::format("#{:02X}{:02X}{:02X}", u8(0xFF * (color.Value.x)), u8(0xFF * (color.Value.y)), u8(0xFF * (color.Value.z)), 0xFF);
return [color, copyValue] {
ImGui::ColorButton("##inspectorColor", color, ImGuiColorEditFlags_None, ImVec2(ImGui::GetContentRegionAvail().x, ImGui::GetTextLineHeight()));
return copyValue;
};
});
} }
// clang-format on // clang-format on

View File

@ -440,6 +440,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.inspector.dos_time", "DOS Time" }, { "hex.builtin.inspector.dos_time", "DOS Time" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "RGBA8 Farbe" }, { "hex.builtin.inspector.rgba8", "RGBA8 Farbe" },
{ "hex.builtin.inspector.rgb565", "RGB565 Farbe" },
{ "hex.builtin.nodes.common.input", "Input" }, { "hex.builtin.nodes.common.input", "Input" },
{ "hex.builtin.nodes.common.input.a", "Input A" }, { "hex.builtin.nodes.common.input.a", "Input A" },

View File

@ -444,7 +444,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.inspector.dos_date", "DOS Date" }, { "hex.builtin.inspector.dos_date", "DOS Date" },
{ "hex.builtin.inspector.dos_time", "DOS Time" }, { "hex.builtin.inspector.dos_time", "DOS Time" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "RGBA8 color" }, { "hex.builtin.inspector.rgba8", "RGBA8 Color" },
{ "hex.builtin.inspector.rgb565", "RGB565 Color" },
{ "hex.builtin.nodes.common.input", "Input" }, { "hex.builtin.nodes.common.input", "Input" },
{ "hex.builtin.nodes.common.input.a", "Input A" }, { "hex.builtin.nodes.common.input.a", "Input A" },

View File

@ -443,6 +443,7 @@ namespace hex::plugin::builtin {
//{ "hex.builtin.inspector.dos_time", "DOS Time" }, //{ "hex.builtin.inspector.dos_time", "DOS Time" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "Colori RGBA8" }, { "hex.builtin.inspector.rgba8", "Colori RGBA8" },
{ "hex.builtin.inspector.rgb565", "Colori RGB565" },
{ "hex.builtin.nodes.constants", "Costanti" }, { "hex.builtin.nodes.constants", "Costanti" },
{ "hex.builtin.nodes.constants.int", "Intero" }, { "hex.builtin.nodes.constants.int", "Intero" },

View File

@ -443,7 +443,8 @@ namespace hex::plugin::builtin {
//{ "hex.builtin.inspector.dos_date", "DOS Date" }, //{ "hex.builtin.inspector.dos_date", "DOS Date" },
//{ "hex.builtin.inspector.dos_time", "DOS Time" }, //{ "hex.builtin.inspector.dos_time", "DOS Time" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "RGBA8 color" }, { "hex.builtin.inspector.rgba8", "RGBA8 Color" },
{ "hex.builtin.inspector.rgb565", "RGB565 Color" },
{ "hex.builtin.nodes.common.input", "入力" }, { "hex.builtin.nodes.common.input", "入力" },
{ "hex.builtin.nodes.common.input.a", "入力 A" }, { "hex.builtin.nodes.common.input.a", "入力 A" },

View File

@ -440,7 +440,8 @@ namespace hex::plugin::builtin {
{ "hex.builtin.inspector.dos_date", "DOS Date" }, { "hex.builtin.inspector.dos_date", "DOS Date" },
{ "hex.builtin.inspector.dos_time", "DOS Time" }, { "hex.builtin.inspector.dos_time", "DOS Time" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "RGBA8 color" }, { "hex.builtin.inspector.rgba8", "RGBA8 Color" },
{ "hex.builtin.inspector.rgb565", "RGB565 Color" },
{ "hex.builtin.nodes.common.input", "Input" }, { "hex.builtin.nodes.common.input", "Input" },
{ "hex.builtin.nodes.common.input.a", "Input A" }, { "hex.builtin.nodes.common.input.a", "Input A" },

View File

@ -445,6 +445,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.inspector.dos_time", "DOS 时间" }, { "hex.builtin.inspector.dos_time", "DOS 时间" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "RGBA8 颜色" }, { "hex.builtin.inspector.rgba8", "RGBA8 颜色" },
{ "hex.builtin.inspector.rgb565", "RGB565 颜色" },
{ "hex.builtin.nodes.common.input", "输入" }, { "hex.builtin.nodes.common.input", "输入" },
{ "hex.builtin.nodes.common.input.a", "输入 A" }, { "hex.builtin.nodes.common.input.a", "输入 A" },

View File

@ -442,6 +442,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.inspector.dos_time", "DOS 時間" }, { "hex.builtin.inspector.dos_time", "DOS 時間" },
{ "hex.builtin.inspector.guid", "GUID" }, { "hex.builtin.inspector.guid", "GUID" },
{ "hex.builtin.inspector.rgba8", "RGBA8 顏色" }, { "hex.builtin.inspector.rgba8", "RGBA8 顏色" },
{ "hex.builtin.inspector.rgb565", "RGB565 顏色" },
{ "hex.builtin.nodes.common.input", "輸入" }, { "hex.builtin.nodes.common.input", "輸入" },
{ "hex.builtin.nodes.common.input.a", "輸入 A" }, { "hex.builtin.nodes.common.input.a", "輸入 A" },