Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need samples of GDI +
Message
De
07/10/2009 12:10:44
 
 
À
07/10/2009 08:19:11
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01427815
Message ID:
01428057
Vues:
78
>
>Just wondering how selective can a GDI+ matrix operation be? I have a pet project in mind, something like this, where anything that isn't too different from gray is replaced with gray, and the rest left as is. IOW, is there a way to have a matrix operate on a selection of pixels, not the whole image at once?

You don't need a Matrix for that. You can give it any colour and ask it to change it to another colour.

Here is some sample code:

Add an imgCanvas object to a form and set its picture prop to your image
imgCanvas.BeforeDraw

logfx = This.oGfx
With _Screen.System.Drawing
	loColorMap = .Imaging.ColorMap.New()
	loAttr = .Imaging.ImageAttributes.New()

	loBmp = .Bitmap.FromFile(This.Picture)

	loRect = loBmp.GetBounds()
	
	* the old colour - RGB colour
	loColorMap.OldColor = .Color.FromRGB(255,198,173)
	
	* the colour to change to
	loColorMap.NewColor = .Color.FromRGB(255,255,0)
	* change the colours
	loAttr.SetRemapTable(loColorMap)
	
	* Draw on the canvas with the new image
	logfx.DrawImage(loBmp, loRect, loRect, .GraphicsUnit.Pixel, loAttr)
	* save the changed image as BMP for later use
	loBmp.Save("converted.bmp", .Imaging.ImageFormat.Bmp)

Endwith
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform