Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change picture color
Message
De
19/07/2004 11:26:05
 
 
À
19/07/2004 07:20:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Divers
Thread ID:
00925117
Message ID:
00925777
Vues:
13
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform