Hello,
I tested drawing text with GDIPLUS with
Methods
oGraphics:DrawText( nTop, nLeft, cText, cFont, nFont, oBrush )
oGraphics:DrawTextLFont( nTop, nLeft, cText, oFont, nH, oBrush, hDC, lB, lIt, lUnd, lStr, nOri, nEsc )
NO text displayed
There aren't any tests or informations about it.
I can show text a different way but would like to
include it inside my GDIPLUS-paintings
does it work ?
regards
Uwe
Any tests drawing text with GDIPLUS ?
Any tests drawing text with GDIPLUS ?
Last edited by ukoenig on Thu Sep 26, 2019 8:24 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Any tests drawing text with GDIPLUS ?
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: Any tests drawing text with GDIPLUS ?
Christobal,
thank You very much I remember
I tested using a brushed font but that doesn't work ( just a idea )
aPalBmp := oWnd:ReadImage( c_Path1 + "Blustone.bmp", nil, .t. )
pBrush := GDIP_IMAGEBRUSH( aPalBmp[ 1 ] )
oGraphics:DrawText( nTop + ( nWidth / 2 ) - 15, nLeft + ( nWidth / 2 ) - 50, nPercent, uFont, nFont, pBrush )
with normal text
regards
Uwe
thank You very much I remember
I tested using a brushed font but that doesn't work ( just a idea )
aPalBmp := oWnd:ReadImage( c_Path1 + "Blustone.bmp", nil, .t. )
pBrush := GDIP_IMAGEBRUSH( aPalBmp[ 1 ] )
oGraphics:DrawText( nTop + ( nWidth / 2 ) - 15, nLeft + ( nWidth / 2 ) - 50, nPercent, uFont, nFont, pBrush )
with normal text
regards
Uwe
Last edited by ukoenig on Thu Sep 26, 2019 8:34 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Any tests drawing text with GDIPLUS ?
Please try this code
Code: Select all
local aImage, pBrush, oFont, oWnd
DEFINE FONT oFont NAME "IMPACT" SIZE 0,-80 BOLD
DEFINE WINDOW oWnd
aImage := oWnd:ReadImage( "c:\fwh\bitmaps\backgrnd\pebbles.bmp",, .t. )
pBrush := GDIP_ImageBrush( aImage[ 1 ] )
oWnd:bPainted := <||
oWnd:SayText( "SEABMP", { 20,20,200,500}, nil, oFont, pBrush )
return nil
>
ACTIVATE WINDOW oWnd CENTERED
RELEASE FONT oFont
GDIP_DeleteBrush()
PalBmpFree( aImage )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Any tests drawing text with GDIPLUS ?
What I'm trying to do is different
I want to add the text to a oGraphics-form
not as a window-title
There are 2 methods in GdiPlus I don't know how to use them
maybe it is possible to use them for a solution.
METHOD DrawText( nTop, nLeft, cText, cFont, nFont, oBrush )
METHOD DrawTextLFont( nTop, nLeft, cText, oFont, nH, oBrush, hDC, lB, lIt, lUnd, lStr, nOri, nEsc )
FUNCTION DRAWROUNDRECT(oWnd, oFont1)
LOCAL hdc := oWnd:getdc(), aImage
LOCAL oPen := Pen():New( 255, 0, 0, 255 , 10, .T.)
LOCAL oBrush := Brush():NewSolidBrush( 255, 255, 128, 0 ) // Orange
LOCAL oPath := Path():new()
LOCAL oGraphics := Graphics():New( oWnd:hDC )
// oPen, [oBrush], nLeft, nTop, nWidth, nHight, nRound
oGraphics:DrawRoundRect( oPen, , 250, 50, 200, 200, 50 )
oGraphics:Destroy()
oGraphics := Graphics():New( oWnd:hDC )
oPath:AddRoundRect( 250, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush, oPath)
oGraphics:DrawRoundRect( oPen, , 250, 300, 200, 200, 50 )
oGraphics:Destroy()
oGraphics := Graphics():New( oWnd:hDC )
oPath := Path():new()
// , oBrush, nLeft, nTop, nWidth, nHight
oPath:AddRoundRect( 550, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush, oPath)
oGraphics:Destroy()
oPen:Destroy()
oWnd:releasedc()
RETURN NIL
regards
Uwe
I want to add the text to a oGraphics-form
not as a window-title
There are 2 methods in GdiPlus I don't know how to use them
maybe it is possible to use them for a solution.
METHOD DrawText( nTop, nLeft, cText, cFont, nFont, oBrush )
METHOD DrawTextLFont( nTop, nLeft, cText, oFont, nH, oBrush, hDC, lB, lIt, lUnd, lStr, nOri, nEsc )
FUNCTION DRAWROUNDRECT(oWnd, oFont1)
LOCAL hdc := oWnd:getdc(), aImage
LOCAL oPen := Pen():New( 255, 0, 0, 255 , 10, .T.)
LOCAL oBrush := Brush():NewSolidBrush( 255, 255, 128, 0 ) // Orange
LOCAL oPath := Path():new()
LOCAL oGraphics := Graphics():New( oWnd:hDC )
// oPen, [oBrush], nLeft, nTop, nWidth, nHight, nRound
oGraphics:DrawRoundRect( oPen, , 250, 50, 200, 200, 50 )
oGraphics:Destroy()
oGraphics := Graphics():New( oWnd:hDC )
oPath:AddRoundRect( 250, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush, oPath)
oGraphics:DrawRoundRect( oPen, , 250, 300, 200, 200, 50 )
oGraphics:Destroy()
oGraphics := Graphics():New( oWnd:hDC )
oPath := Path():new()
// , oBrush, nLeft, nTop, nWidth, nHight
oPath:AddRoundRect( 550, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush, oPath)
oGraphics:Destroy()
oPen:Destroy()
oWnd:releasedc()
RETURN NIL
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Any tests drawing text with GDIPLUS ?
why do you continuously destroy and re-create the graphics?
Re: Any tests drawing text with GDIPLUS ?
Antonino,
Yes I agree not needed to be defined for each sample
FUNCTION DRAWROUNDRECT(oWnd, oFont1)
LOCAL hdc := oWnd:getdc(), aImage
LOCAL oPen := Pen():New( 255, 0, 0, 255 , 10, .T.)
LOCAL oBrush1 := Brush():NewSolidBrush( 255, 255, 128, 0 ) // Orange
LOCAL oBrush2 := Brush():NewGradientBrush( 300, 200, 200, 200, 1,;
255, 255, 128, 0,;
255, 255, 255, 255 )
LOCAL oPath := Path():new()
LOCAL oGraphics := Graphics():New( oWnd:hDC )
// sample 1
// oPen, [oBrush], nLeft, nTop, nWidth, nHight, nRound
oGraphics:DrawRoundRect( oPen, , 250, 50, 200, 200, 50 )
// sample 2
oPath:AddRoundRect( 250, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush1, oPath)
oGraphics:DrawRoundRect( oPen, , 250, 300, 200, 200, 50 )
// sample 3
oPath := Path():new()
// , oBrush, nLeft, nTop, nWidth, nHight
oPath:AddRoundRect( 550, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush2, oPath)
oGraphics:Destroy()
oPen:Destroy()
oWnd:releasedc()
RETURN NIL
regards
Uwe
Yes I agree not needed to be defined for each sample
FUNCTION DRAWROUNDRECT(oWnd, oFont1)
LOCAL hdc := oWnd:getdc(), aImage
LOCAL oPen := Pen():New( 255, 0, 0, 255 , 10, .T.)
LOCAL oBrush1 := Brush():NewSolidBrush( 255, 255, 128, 0 ) // Orange
LOCAL oBrush2 := Brush():NewGradientBrush( 300, 200, 200, 200, 1,;
255, 255, 128, 0,;
255, 255, 255, 255 )
LOCAL oPath := Path():new()
LOCAL oGraphics := Graphics():New( oWnd:hDC )
// sample 1
// oPen, [oBrush], nLeft, nTop, nWidth, nHight, nRound
oGraphics:DrawRoundRect( oPen, , 250, 50, 200, 200, 50 )
// sample 2
oPath:AddRoundRect( 250, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush1, oPath)
oGraphics:DrawRoundRect( oPen, , 250, 300, 200, 200, 50 )
// sample 3
oPath := Path():new()
// , oBrush, nLeft, nTop, nWidth, nHight
oPath:AddRoundRect( 550, 300, 200, 200, 50 )
oGraphics:FillPath( oBrush2, oPath)
oGraphics:Destroy()
oPen:Destroy()
oWnd:releasedc()
RETURN NIL
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Any tests drawing text with GDIPLUS ?
It is working now
LOCAL oBrush1 := Brush():NewSolidBrush( 255, 255, 128, 0 ) // Orange
DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -30 BOLD ITALIC
// font and size
oGraphics:DrawTextLFont( 50, 125, "mod harbour", oFontLarge, 30, oBrush1, hDC )
oGraphics:DrawTextLFont( 80, 125, "install", oFontLarge, 20, oBrush1, hDC )
The 1. and 3. one works fine
METHOD NewSolidBrush( nTrans, nRed, nGreen, nBlue )
METHOD NewTextureBrush( oGdiBmp )
( wanted to be used for text )
METHOD NewGradientBrush( nTop, nLeft, nWidth, nHeight, nType,;
nTrans1, nRed1, nGreen1, nBlue1,;
nTrans2, nRed2, nGreen2, nBlue2 )
regards
Uwe
LOCAL oBrush1 := Brush():NewSolidBrush( 255, 255, 128, 0 ) // Orange
DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -30 BOLD ITALIC
// font and size
oGraphics:DrawTextLFont( 50, 125, "mod harbour", oFontLarge, 30, oBrush1, hDC )
oGraphics:DrawTextLFont( 80, 125, "install", oFontLarge, 20, oBrush1, hDC )
The 1. and 3. one works fine
METHOD NewSolidBrush( nTrans, nRed, nGreen, nBlue )
METHOD NewTextureBrush( oGdiBmp )
( wanted to be used for text )
METHOD NewGradientBrush( nTop, nLeft, nWidth, nHeight, nType,;
nTrans1, nRed1, nGreen1, nBlue1,;
nTrans2, nRed2, nGreen2, nBlue2 )
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.