mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
patterns: Added visualizers to image patterns (#117)
* Added image visualizers to image patterns that were supported * missing include files * Small style fixes --------- Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma MIME image/bmp
|
||||
#pragma endian little
|
||||
#include <std/mem.pat>
|
||||
|
||||
struct BitmapFileHeader {
|
||||
u8 bfType[2];
|
||||
@@ -31,6 +32,7 @@ struct Colors {
|
||||
};
|
||||
|
||||
struct Bitmap {
|
||||
u8 data[std::mem::size()] [[no_unique_address, hidden]];
|
||||
BitmapFileHeader bmfh;
|
||||
BitmapInfoHeader bmih;
|
||||
|
||||
@@ -46,6 +48,6 @@ struct Bitmap {
|
||||
u8 lineData[bmih.biSizeImage];
|
||||
else
|
||||
u8 lineData[bmfh.bfSize - $];
|
||||
};
|
||||
} [[hex::visualize("image", this.data)]];
|
||||
|
||||
Bitmap bitmap @ 0x00;
|
||||
|
||||
@@ -173,10 +173,11 @@ namespace format {
|
||||
}
|
||||
|
||||
struct Gif {
|
||||
u8 data[std::mem::size()] [[no_unique_address, hidden]];
|
||||
Header header;
|
||||
std::assert_warn(header.version == "89a" || header.version == "87a", "Unsupported format version");
|
||||
LogicalScreenDescriptor logicalScreenDescriptor;
|
||||
Block blocks[while(!std::mem::eof())];
|
||||
};
|
||||
} [[hex::visualize("image", this.data)]];
|
||||
|
||||
Gif gif @ 0x00;
|
||||
@@ -119,4 +119,4 @@ struct Segment {
|
||||
}
|
||||
};
|
||||
|
||||
Segment segments[while(!std::mem::eof())] @ 0x00;
|
||||
Segment segments[while(!std::mem::eof())] @ 0x00 [[hex::visualize("image", this)]];
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma MIME image/png
|
||||
#pragma endian big
|
||||
|
||||
#include <std/mem.pat>
|
||||
|
||||
struct header_t {
|
||||
u8 highBitByte;
|
||||
char signature[3];
|
||||
@@ -178,6 +180,7 @@ struct chunk_set {
|
||||
chunk_t chunks[while(builtin::std::mem::read_string($ + 4, 4) != "IEND")] [[inline]];
|
||||
} [[inline]];
|
||||
|
||||
u8 visualizer[std::mem::size()] @ 0x00 [[sealed, hex::visualize("image", this)]];
|
||||
header_t header @ 0x00 [[comment("PNG file signature"), name("Signature")]];
|
||||
chunk_t ihdr_chunk @ 0x08 [[comment("PNG Header chunk"), name("IHDR")]];
|
||||
chunk_set set @ $ [[comment("PNG Chunks"), name("Chunks"), inline]];
|
||||
|
||||
@@ -75,5 +75,6 @@ struct Footer {
|
||||
char zero;
|
||||
};
|
||||
|
||||
u8 visualizer[std::mem::size()] @ 0x00 [[sealed, hex::visualize("image", this)]];
|
||||
Header header @ 0x0;
|
||||
Footer footer @ std::mem::size() - 0x1A;
|
||||
|
||||
Reference in New Issue
Block a user