Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Write text on a JPG and save it for printing purposes
Message
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01250668
Message ID:
01251185
Views:
31
In the original sample I used the "clear" method to make all the background of the new picture in white color.

So you need to change just here, the color
loBackColor = .Color.FromRGB(GETCOLOR())
loGfx.CLEAR(loBackColor)
>Hi Cesar
>
>I took your advise and changed my class to have 2 more methods OpenImage() and CloseImage() and I am successful when I am adding multiple text to the image.
>
>When I try to make the image lager by adding the pixel as per your suggestion I end up with a completely black jpg. My method to add pixels is as follows. The method in itself was successful when I had previously used as separate saving of jpg
>
>
>	FUNCTION AddPixelsToJPG(tnPixelRows AS INTEGER, tnPixelCols AS INTEGER)
>		WITH THIS.SYSTEM.Drawing
>			LOCAL loNewBMP, loGfx
>
>			loGfx = .Graphics.FromImage(THIS.oBMP)
>
>			loNewBMP = .BITMAP.New(THIS.nWidth + tnPixelCols, ;
>				THIS.nHeight + tnPixelRows) && added in height / width
>
>			loGfx.CLEAR(THIS.GetColorObject(THIS.cPixelColor))
>
>			* Draw the image to the new Bitmap
>			loGfx.DrawImage(THIS.oBMP,0,0)
>
>			THIS.oBMP = loNewBMP
>
>			loGfx = .NULL.
>		ENDWITH
>	ENDFUNC
>
>
>
>The calls I am doing is as follows:
>
lo = NEWOBJECT("idsGDI")
>lo.OpenImage("C:\Trashcan\JPG\Samples\Image\desert.jpg")
>
>
>*** text using the class defaults
>lo.AddTextToJPG("GDI+X Powered")
>
>
>*** text using the specified properties
>*** note you can't use the same input and output file
>lo.cFontStyle = "BoldItalics"
>lo.nFontSize  = 22
>lo.nXCoOrd    = 100
>lo.nYCoOrd    = 200
>lo.nOpaque    = 80
>lo.cFontColor = "Chartreuse"
>
>lo.AddTextToJPG("GDI+X Powered")
>
>
>lo.AddPixelRowsToJPG(30)
>
>
>lo.cFontStyle = "Bold"
>lo.nFontSize  = 22
>lo.nXCoOrd    = 0
>lo.nYCoOrd    = 380
>lo.nOpaque    = 100
>lo.cFontColor = "Black"
>lo.cFont      = "Tahoma"
>
>lo.AddTextToJPG("GDI+X is Cool")
>
>lo.CloseImage("C:\Trashcan\JPG\logo9.jpg")
>lo = .NULL.
>
>
>RUN /N explorer.EXE "C:\Trashcan\JPG\logo9.jpg"
>
>Please advise on what am I doing wrong?
>
>
>UPDATE: loGfx.DrawImage(THIS.oBMP,0,0) I have also tried it as loGfx.DrawImage(loNewBMP,0,0) but no joy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform