DrawText()
Syntax
Result = DrawText(x, y, Text$ [, FrontColor [, BackColor]])Description
Display the given string on the current output at the given x,y position. The current output is set with StartDrawing().
DrawingMode() can be used to set the transparent background mode. DrawingFont() can be used to set the font. This function uses the default colors set with FrontColor() and BackColor(). If DrawingMode() is set to non-transparent background and the current drawing mode uses the alpha channel then the text is first blended onto the background and then applied to the drawing output. RGB() or RGBA() can be used to get a valid color value.
The new x position of the text cursor (ie: just after the last printed character) is returned in 'Result' to allow easy text concatenation, if required.
The 'FrontColor' and 'BackColor' are optional parameters and can be used to override the colors set with FrontColor() and BackColor(). The current back and front colors aren't changed.Example:
If OpenWindow(0, 0, 0, 200, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0)) DrawingMode(#PB_2DDrawing_Transparent) Box(0, 0, 200, 200, RGB(255, 255, 255)) For i = 1 To 30 DrawText(Random(200), Random(200), "Hello World!", RGB(Random(255), Random(255), Random(255))) Next i StopDrawing() ImageGadget(0, 0, 0, 200, 200, ImageID(0)) EndIf Repeat Event = WaitWindowEvent() Until Event = #PB_Event_CloseWindow EndIf
Supported OS
All