Page 4 of 4
Posted: Wed 01 Nov, 2006 5:51 pm
by benryves
GIF or PNG are more usual indexed formats.
Are those the exact BMP files you're loading from?
Posted: Wed 01 Nov, 2006 5:56 pm
by King Harold
yes the exact ones, I tried turning them into PNG, the results didn't change a bit, I can try GIF I guess
Posted: Wed 01 Nov, 2006 6:29 pm
by King Harold
You're not going to believe how I "solved" it.
Code: Select all
if (SourceMaskArray[i] >= index) SourceImageArray[i-(int)(i/Width)] = 0;
Apparently you have to substact the row number, the images are the exact same size, maybe they marshal.copy is uhm.. bad?
But it only solves the problem for the problem-pictures, the good ones are messed up in same way now (so I'll have to figure out a way to determine whether a picture is good or not)
And there are those that need 2 or 3 times the row-number substracted.
But I guess this narrows down the problem to uhm.. well to what? It defenitly has something to do with not-matching widths.. Even if the pictures have the same size..
Posted: Wed 01 Nov, 2006 6:38 pm
by King Harold
it seems that the closer the width and hight are the better the result (the squarer the better)..
edit: no that was just coincidence, maybe its random..?
Posted: Thu 02 Nov, 2006 10:26 am
by benryves
This is really very strange.
Could you possibly zip up a few "good" and "bad" images and email them (or similar) to me? I'll have a look at this more closely, but you'll have to wait until tomorrow I'm afraid. :\
Posted: Thu 02 Nov, 2006 3:41 pm
by King Harold
Ok, many thanks
![Very Happy :D](./images/smilies/grayscale_happy.gif)
sometimes the outside builds a bit strangely, but when the wooden frame is added under it it looks almost normal, the wood should be build first - then the stone is build over it
Posted: Fri 03 Nov, 2006 10:30 am
by benryves
Oh dear.
Take a look at the width of the images that do work, then the width of those that don't.
The ones that do are multiples of 8 pixels wide, so are multiples of 8 bytes wide. The stride (width in bytes) of these images are always multiples of 8 bytes.
I've not thought of this as the images I usually deal with are 32bpp and even widths (and as each pixel is 4 bytes, I just have to make them even widths to let the stride "fit").
I've uploaded
a fixed project that works, taking the stride of the image into consideration.
The palette order is still rather weird... I'm hoping there's some reference somewhere as to which order the palette should really be.
Posted: Fri 03 Nov, 2006 4:17 pm
by King Harold
Wow!
It really works
![Very Happy :D](./images/smilies/grayscale_happy.gif)
I can not thank you enough
If I may ask, how did you find out?
Posted: Fri 03 Nov, 2006 4:23 pm
by benryves
Lucky guess again, really. I just noticed that the ones that worked were multiples of eight wide, then remembered about the stride. A bit of debugging showed that no, the stride was different to the width for a few of the images.
Do you have any sort of image that lists the colours in the "correct" order? I can't really see any obvious pattern to which is the first and which is the last colour to fill.
Posted: Fri 03 Nov, 2006 4:33 pm
by King Harold
The order appears to be.. strange.. I'll ask the artist, who surely knows why he made the pictures like this..
I'll be glad to let you know
Edit: changing the order shouldn't be the hardest thing to do (unless there's a pitfall like this again)
Posted: Thu 09 Nov, 2006 7:52 pm
by King Harold
The artist said it was supposed to be this way, well, allright, we'll see how it will look..
He could have told us about the stride thing though..
![Razz :P](./images/smilies/grayscale_grin.gif)