EarlyMorning - Progress & Discussion
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
kv, I assume you're using the Bitmap class to hold your image?
If you are, do not use the .Width and .Height properties, for example in a loop. They are extremely slow. Cache them in a Point class (or similar) instead.
Even better, write a class that inherits from Bitmap and override the Width/Height with getters that caches the base.Width/base.Height and use that instead.
If you are, do not use the .Width and .Height properties, for example in a loop. They are extremely slow. Cache them in a Point class (or similar) instead.
Even better, write a class that inherits from Bitmap and override the Width/Height with getters that caches the base.Width/base.Height and use that instead.
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
I assume you're using Bitmap.SetPixel then... Which is, quite understandably, extremely slow (locking a surface, doing bounds checking, calculating where in the bitmap to write, performing the bitdepth conversion, writing, unlocking - for each pixel).
As far as I am aware, VB.NET will not allow unsafe/unmanaged code blocks, though. (As a rough figure, I dropped an image decoder from ~10 seconds for a single image to ~500 images in < 1 second just by switching to unmanaged code).
As far as I am aware, VB.NET will not allow unsafe/unmanaged code blocks, though. (As a rough figure, I dropped an image decoder from ~10 seconds for a single image to ~500 images in < 1 second just by switching to unmanaged code).
- kv83
- Maxcoderz Staff
- Posts: 2735
- Joined: Wed 15 Dec, 2004 7:26 pm
- Location: The Hague, Netherlands
- Contact:
No quite. The most slowdown is in the map drawing. I draw the "tile-bitmap" to the "map-bitmap" (buffer), then reload the bitmap in the picturebox.I assume you're using Bitmap.SetPixel then... Which is, quite understandably, extremely slow (locking a surface, doing bounds checking, calculating where in the bitmap to write, performing the bitdepth conversion, writing, unlocking - for each pixel).
- kv83
- Maxcoderz Staff
- Posts: 2735
- Joined: Wed 15 Dec, 2004 7:26 pm
- Location: The Hague, Netherlands
- Contact:
Hey guys. Don't know if anyone is still intrested in this, but i'm working on the next release (0.3.0.0).
This will fix some bugs (for example a very nasty bug when trying to use 8x8 b/w sprites)...
Some of the new features will be:
- Property panel for all resources to change their properties (for now it's only the name you can change)
- Import .bmp's as sprites
- Buildscript wizard
- Build resources through command prompt (handy for external tools like LateNite)
- Masked sprite support for both 1bit and 2bit
- MAU support
This will fix some bugs (for example a very nasty bug when trying to use 8x8 b/w sprites)...
Some of the new features will be:
- Property panel for all resources to change their properties (for now it's only the name you can change)
- Import .bmp's as sprites
- Buildscript wizard
- Build resources through command prompt (handy for external tools like LateNite)
- Masked sprite support for both 1bit and 2bit
- MAU support
- kv83
- Maxcoderz Staff
- Posts: 2735
- Joined: Wed 15 Dec, 2004 7:26 pm
- Location: The Hague, Netherlands
- Contact:
Guys, i'm writing the mask feature atm, and it works fine for 1bit. For 1bit there are two options atm,
The 1st vies you the "normal" spritedata and maskdata:
sprite_data
mask_data
(so two different sprites)
The 2nd gives your interlanced spritedata and maskdata:
sprite_byte, mask_byte, sprite_byte, mask_byte
Now, i'm no prof at grayscale. So i don't know which dataformat is used with grayscale masking. The 1st one of 1bit is the only one I could think of and that one is already implemented (that was easy). However, does someone know of a different grayscale masking format?
Note: I won't test grayscale masking, since I don't have any program which uses it. But it should work alright
Edit: Here is a screenshot of how the masking is done:
The "pink color" indicates which pixels are masked. If I'm right, only "white" pixels can be transparent, right? I mean. It doesn't make sense to have another color transparent... but maybe I'm confused after working so long it Please say "yes, you are right. only white can be transparent"
Edit2: Thanks for the support btw. I really appriciate that. It keeps me motivated
The 1st vies you the "normal" spritedata and maskdata:
sprite_data
mask_data
(so two different sprites)
The 2nd gives your interlanced spritedata and maskdata:
sprite_byte, mask_byte, sprite_byte, mask_byte
Now, i'm no prof at grayscale. So i don't know which dataformat is used with grayscale masking. The 1st one of 1bit is the only one I could think of and that one is already implemented (that was easy). However, does someone know of a different grayscale masking format?
Note: I won't test grayscale masking, since I don't have any program which uses it. But it should work alright
Edit: Here is a screenshot of how the masking is done:
The "pink color" indicates which pixels are masked. If I'm right, only "white" pixels can be transparent, right? I mean. It doesn't make sense to have another color transparent... but maybe I'm confused after working so long it Please say "yes, you are right. only white can be transparent"
Edit2: Thanks for the support btw. I really appriciate that. It keeps me motivated
-
- Calc King
- Posts: 2195
- Joined: Sun 27 Mar, 2005 4:06 am
- Location: sleeping
- Contact:
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
I actually like the mask to come before, since they need to be appilied first anyway. So the my order is MASK, DARK, LIGHT.
Would it be concievable to have the order of the layers optional?
There is submaps that I always wanted that would be nice. If you look at ducks source for Zelda you can see a good example. He used calc gs to make the tiles and a whole bunch of small maps, then made new black and white large tiles and made the full sized map.
Would it be concievable to have the order of the layers optional?
There is submaps that I always wanted that would be nice. If you look at ducks source for Zelda you can see a good example. He used calc gs to make the tiles and a whole bunch of small maps, then made new black and white large tiles and made the full sized map.