Added utilities
- Posted by Lucius L Hilley III <luciuslhilleyiii at JUNO.COM> Mar 25, 1997
- 998 views
Do this in a graphics program: x = palette(16, {64, 64, 64})--This will create a white border. That could be an unwanted side effect of using an images palette. SUCH AS: all_palette(image[1])--Sets palette To get around this I have added to PCX.e (My PCX_loader) function Color_Unused() AND function Color_Swap() --image is just the image not the palette function Color_Unused(sequence image) --unused will contain all palette values that were not --referenced by the image. return unused end function --here image is {palette, image} combo. --color1 & color2 are the colors to swap. function Color_Swap(image, color1, color2) --swaps palette entries color1 and color2 --swaps all references to color1 with color2 --and all references to color2 with color1. return {palette, image} end function When using Color_Swap if either palette color is 16 then you will swap the border color 16 with the other color. HENCE: image = Load_BMP("some.bmp") --image[1] is palette --image[2] is just the image. unused = Color_Unused(image[2]) if length(unused) then --unused[1] will be the first color that is unused. Color_Swap(image, 16, unused[1]) --Now border is the color of unused[1]. --use 16 + 1 because sequence starts with 1 and palette starts with 0. image[2][16 + 1] = {0, 0, 0}--set to black. --now border is black. else Puts(1, "Out of Luck padre !!!\n") end if image is now read for all_palette() and display_image() Notice these CAN be handy with BMPS also. NOTE: When I mentioned would someone be willing to pay I didn't name a price. HINT: Up for bid. ANYBODY got a dollar? --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I support transferring of files less than 60K. -- I can Decode both UU and Base64 format.