It is possible to use 'BackColor' with DrawVectorText ?
Thank you very much for the replies
DrawVectorText
Re: DrawVectorText
No. You have however two alternatives :
1) DrawRotatedText() (lib 2dDrawing)
2) AddPathBox() (lib VectorDrawing requires color adapting)
1) DrawRotatedText() (lib 2dDrawing)
2) AddPathBox() (lib VectorDrawing requires color adapting)
Re: DrawVectorText
Hello,
You mean like this ?
You mean like this ?
Code: Select all
; Vector text output, for image and canvas
EnableExplicit
Procedure VectorText(text$, output, output_x, output_y, font, color_text=#White, color_background=#Black, alpha_text=255, alpha_background=255)
If IsGadget(output)
Protected back_value = StartVectorDrawing(CanvasVectorOutput(output))
Else
back_value = StartVectorDrawing(ImageVectorOutput(output))
EndIf
If back_value
VectorFont(FontID (font))
VectorSourceColor(RGBA(Red(color_background), Green(color_background), Blue(color_background), alpha_background))
AddPathBox(output_x, output_y, VectorTextWidth(text$), VectorTextHeight(text$))
FillPath()
VectorSourceColor(RGBA(Red(color_text), Green(color_text), Blue(color_text), alpha_text))
MovePathCursor (output_x, output_y)
DrawVectorText(text$)
StopVectorDrawing()
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure
Define window = OpenWindow(#PB_Any, 0, 0, 800, 600, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Define canvas = CanvasGadget(#PB_Any, 0, 0, 800, 600)
Define font = LoadFont(#PB_Any, "", 36, #PB_Font_Bold)
Define font_1 = LoadFont(#PB_Any, "", 12, #PB_Font_Bold)
Define text$ = " Hello Lima, how are you ?"+#LF$+" Also multiline"
Define output_x = 80
Define output_y = 100
Define color_text = #Green
Define color_background = #Blue
Define alpha_text = 255
Define alpha_background = 255
VectorText(text$, canvas, output_x, output_y, font, color_text, color_background, alpha_text, alpha_background)
VectorText(text$, canvas, 280, 350, font_1)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Last edited by Saki on Sun May 10, 2020 3:35 pm, edited 1 time in total.
地球上の平和
Re: DrawVectorText
Hello my friends.
Your ideas are a big help.
Thank you so much for everything.
Your ideas are a big help.
Thank you so much for everything.