Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change picture color
Message
From
19/07/2004 11:26:05
 
 
To
19/07/2004 07:20:47
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00925117
Message ID:
00925777
Views:
14
WoW! ;) It works great for Black&White pictures! I have wrote some code using win32api and it works too, but your solution realy original and have just 4 lines of code!
Thanks Anton! You are the best! ;)



>I am about to give you simple solution.
>
>At first bitmaps must be external files (excluded from project and distributed with executable). It's better to use temporary files. (Editing files in program dir is not allowed for normal user accounts on NT and higher systems). Thus you need to dynamicaly assign Picture properties. :(((
>But you can code this once only in parent class.
>
>At second you may not edit all pixels of picture while you can only change palette color from black to what you need.
>
>This example code replaces "black" palette color in source file with nColor and saves modified picture to target bmp file.
>
>
>LPARAMETERS cSource, cTarget, nColor
>
>#define StartPosition 55
>
>LOCAL lcBMP, lcColor
>lcBmp = FILETOSTR(cSource)
>
>lcColor = ;
>    CHR(BITRSHIFT(BITAND(0xFF0000, nColor), 16)) ;
>  + CHR(BITRSHIFT(BITAND(0xFF00, nColor), 8)) ;
>  + CHR(BITAND(0xFF, nColor))
>
>lcBMP = STUFF(lcBMP, StartPosition, 3, lcColor)
>
>STRTOFILE(lcBMP, cTarget)
>
>
>Hope this helps
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform