i do some steps in using Linux specific functions. I wanna draw outlined Text to the Windows Canvas and found this small piece of code and try to translate them into Xojo. But I does not result outlined drawn text. Am I right with my declares? Python
[code]#If TargetLinux Then
’ not sure of the declare are right and complete
’ https://cairographics.org/manual/cairo-cairo-t.html#cairo-stroke
Declare Sub cairo_stroke Lib “cairo.so” (context As Integer)
’ Declare Sub cairo_stroke Lib “libcairo.so” (context As Integer)
cairo_stroke(g.Handle(g.HandleTypeCairoContext)) #Endif
[code]declare Sub cairo_text_path Lib “libcairo” (ctx As ptr, t As CString)
Declare Sub cairo_set_line_width Lib “libcairo” (ctx As ptr, w As Double)
Declare Sub cairo_set_font_size Lib “libcairo” (ctx As ptr, w As Double)
Declare Sub cairo_set_source_rgb Lib “libcairo” (ctx As ptr,r As Double, g As Double, b As Double)
Declare Sub cairo_move_to Lib “libcairo” (ctx As ptr, x As double, y As double)
Declare Sub cairo_stroke Lib “libcairo” (ctx As ptr)
Dim ctx As ptr = ptr(g.Handle(Graphics.HandleTypeCairoContext))
cairo_move_to(ctx,50,50)
cairo_set_source_rgb(ctx,1,0,0)
cairo_set_font_size(ctx,32)
cairo_text_path(ctx,“Outline”)
cairo_set_line_width(ctx,1)
cairo_stroke(ctx)[/code]
Just remember, drawing coordinates will be relative to the window, not the canvas.
Declare Sub cairo-select-font-face Lib "libcairo" (ctx As ptr, family as cstring, slant as int32, weight as int32)
slant is 0,1,2 =normal, italic objlique
weight is 0,1 = normal, bold