1. Possible smaller bitmaps
- Posted by Euman <euman at bellsouth.net> Feb 22, 2001
- 385 views
- Last edited Feb 23, 2001
Graeme has an excellent utility to include bitmaps in your program similar to includeing a .e code file I have experimented to come up with a method of the smallest possible include as possible this also makes the program somewhat faster also. If you use Win32Lib you have createDIB as a procedure that can be used to load bitmaps. If you take Graeme's utility and substitute the code contained in image.e with the below code you can create bitmaps that are only the length of the actual used palette colors in the image. Granted this will only eliminate upto 2k or so per image but if you have lots of bmp's that are used for buttons or bmp(icons) you *could* save a considerable amount of space if the image is < 255 actual colors. This works by eliminating {255,255,255} palette sequences Heres the image.e substitute code: \"I dont recommend useing these until you make a backup of image.e or simply rename the functions below.\ function get_rgb(integer set_size) -- get red, green, blue palette values integer red, green, blue blue = getc(fn) green = getc(fn) red = getc(fn) if set_size = 4 then if getc(fn) then end if end if if blue = 255 and green = 255 and red = 255 then return {} end if return {red, green, blue} end function function get_rgb_block(integer num_dwords, integer set_size) -- reads palette sequence s s = {} for i = 1 to num_dwords do s = append(s, get_rgb(set_size)) end for for i = 1 to length(s) do if length(s[i]) = 0 then if i = 255 then return s else s[i] = {255,255,255} return s[1..i] exit end if end if end for end function BTW: We miss you #3 Euman