Reading pixels array after reader #1310
-
I'm trying to write a pattern file for a BMP I have to process somewhere else and to learn the pattern language in general. So I wrote the following:
When it runs it returns the following:
According to my calculations, this file has 44944 pixels which means that there will be an array of 44944 Pixel objects stored. Doesn't seem to be THAT MUCH. I'm aware of the following answer: #334. I got the trick of reading a pattern until the end of the array from there. In my case, it is possible to calculate upfront how many pixels will be read, but I couldn't get it working either. I also know that there is already a BMP pattern to be loaded with the default install of the program but it loads an array of raw bytes not grouped pixels. I also tried the following alternative:
But it returns the following:
Could you please help me understand what I'm doing wrong? I'm using imhex-1.30.1-Windows-Portable-NoGPU-x86_64. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
In this case, using the [[static]] attribute on |
Beta Was this translation helpful? Give feedback.
-
Yes but that isn't the fault of the pattern size array, what you need to do is divide by |
Beta Was this translation helpful? Give feedback.
-
The final pattern file is this one:
|
Beta Was this translation helpful? Give feedback.
-
You might want to look at the Official BMP Pattern if you want to, if you want to see how we did it. But good job 👍 |
Beta Was this translation helpful? Give feedback.
Yes but that isn't the fault of the pattern size array, what you need to do is divide by
sizeof(Pixel)
as you are reading 3 bytes per entry, and you are just giving it the size in bytes from now to the end of the file