The DrawText
method is used to render text onto a Bitmap
object within a specified rectangular area. This method allows for customization of text rendering through the use of flags and a defined scope.
The DrawText
method is used to render text onto a Bitmap
object within a specified rectangular area. This method allows for customization of text rendering through the use of flags and a defined scope.
To use the DrawText
method, you need to provide a Scope
object that defines the text to be rendered, a Rect
that specifies the area on the bitmap where the text should be drawn, and a TextFlag
to control the rendering behavior.
Ensure that the Scope
object is properly initialized with the desired text content and formatting options before calling this method.
// Example of using DrawText method var bitmap = new Bitmap(); var textScope = new TextRendering.Scope("Hello, World!"); var drawArea = new Rect(10, 10, 200, 50); var textFlags = TextFlag.Center | TextFlag.Bold; bitmap.DrawText(textScope, drawArea, textFlags);