24-bit Picture class w/ resize, crop, transregion and exposed bits
This is something I came up with to help make writing skinnable applications a little bit simpler. I've been playing with this stuff quite a bit lately and I thought this was worth submitting. However, it only supports 24-bit bitmaps. Anyway, here is some documentation: PROPERTIES: Picture [StdPicture] Returns/sets the object's picture Width [Long] Returns the image's width Height [Long] Returns the image's height Bits [Byte()] Returns/sets the image's DIB bits Pixel(X, Y) [Long] Returns/sets color value of image's pixel METHODS: Resize(NewWidth, NewHeight) Resizes the image Crop(X, Y, Width, Height) Crops the image, keeping specified area CreateRegion(TransColor) Creates a region minus pixels of particular color ApplyRegion(hWnd) Sets the region to a window ClearRegion(hWnd) Sets a window's region to default (i.e, no region) DeleteRegion Deletes the created region Internal information: As you'll see in the code, I've documented pretty much every line ;) The image is stored in the object as a byte array, which makes working with the pixels a whole lot faster. The Pixel() property is simply a more logical mapping of that array, so it should be pretty darned fast as well... alot faster than GetPixel()/SetPixel() or, even worse, Point() and PSet()! Anyway, have fun with it! And if you find some way to improve performance without sacrificing simplicity of use, please send me the code ;)
Instructions: Copy the declarations and code below and paste directly into your VB project.