[Managed C#] masking using a paletted mask-map
Moderator: MaxCoderz Staff
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
Wrong order - so Im just blaming the artist.
Which seems the right thing to do since I checken them with the GIMP and I clicked the colours with teh colour picker and they were quite messed up, sometimes its ok for 20 levels and then it suddenly builds something.. odd..
http://www.freewebs.com/lawcompany/BadPalette.PNG
Which seems the right thing to do since I checken them with the GIMP and I clicked the colours with teh colour picker and they were quite messed up, sometimes its ok for 20 levels and then it suddenly builds something.. odd..
http://www.freewebs.com/lawcompany/BadPalette.PNG
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
So much for random, this is quite insane:
http://www.freewebs.com/lawcompany/from ... arbled.PNG
a quick check with the GIMP however proved that this picture was completely normal, and then got.. messed up..
http://www.freewebs.com/lawcompany/from ... arbled.PNG
a quick check with the GIMP however proved that this picture was completely normal, and then got.. messed up..
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
I can't see those images.
I'm not sure if there's an easy way to reorder the palette. I had a similar issue - I wrote a script that generated an image in shades of grey, imported into Photoshop then saved as a GIF so I could use it's nice dithering (I was dropping to 16 colours). Strangely enough, the order of the palette was completely random, not the nice brightest->darkest (or the other way around) as I had been expecting - especially given that Photoshop was displaying the palette in a nice order before exporting.
I'm not sure if there's an easy way to reorder the palette. I had a similar issue - I wrote a script that generated an image in shades of grey, imported into Photoshop then saved as a GIF so I could use it's nice dithering (I was dropping to 16 colours). Strangely enough, the order of the palette was completely random, not the nice brightest->darkest (or the other way around) as I had been expecting - especially given that Photoshop was displaying the palette in a nice order before exporting.
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Ah, the last picture is a good one to show me.
Add this line as the first piece of code:
Add this line as the first piece of code:
Code: Select all
if (sourceImage.Width != sourceMask.Width || sourceImage.Height != sourceMask.Height) throw new Exception("Mask and image must both be the same size.");
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
It's still doing it (they are the same size afterall)
Even that mangled and random thing, you know whats funny though? exactly that picture is doing it again, in exactly the same way, and an other one did it in an other way, also sometimes it show something that will disapear in the next frame (so with the build level increased by 1)
Even that mangled and random thing, you know whats funny though? exactly that picture is doing it again, in exactly the same way, and an other one did it in an other way, also sometimes it show something that will disapear in the next frame (so with the build level increased by 1)
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
If you want to try it out, here are the picture that caused the most trouble:
whats wrong with the [img] tag?
whats wrong with the [img] tag?
Last edited by King Harold on Tue 31 Oct, 2006 6:48 pm, edited 3 times in total.
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Yes, as it narrows down what's going wrong. The problem now lies somewhere with the masking bit - either it's the wrong width (which would give you that characteristic "diagonal" pattern) which doesn't seem to be the case (you'd get an exception thrown), there's a bug in the for loop (which, given the simplicity of it, seems unlikely) or there's a bug in the way the pixel data is being read. I don't know which it is.King Harold wrote:Its the same as the imput, is that good?
I'm still going on the assumption that a width is wrong somewhere - set a breakpoint on the "sourceMask.LockBits(...)" line and see if the FrameRectangle is still the same size (or recreate it in the line above, to make sure it's the same size).
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
I can't see the images any more in any case (use tinypic.com instead?) The problem with the image tags is that you're linking to evil upwards-loading Windows Bitmap files (that is, people have a habit of linking to 1024x768 24-bit BMPs, which doesn't please people on slow connections that much).
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
= http://www.freewebs.com/lawcompany/Image00906.bmp
= http://www.freewebs.com/lawcompany/Image00908.bmp
links to stupid BMP's because jpg wouldn't be indexed
(if you're wondering what the 2 leading zero's are for.. there are 10884 images)
this should be the palette:
and this is evil:
= http://www.freewebs.com/lawcompany/Image00908.bmp
links to stupid BMP's because jpg wouldn't be indexed
(if you're wondering what the 2 leading zero's are for.. there are 10884 images)
this should be the palette:
and this is evil: