DrawingMode()

Syntax

DrawingMode(Mode)
Description
Change the drawing mode for text and graphics output.

Parameters

Mode The behavior for further drawing operations. It can be a combination of the following flags:

#PB_2DDrawing_Default
This is the default drawing mode when the drawing starts. Text is displayed with a solid background and graphic shapes are filled. If the current output has an alpha channel, the drawing operations will only modify the color components and leave the alpha channel unchanged.

#PB_2DDrawing_Transparent
If this flag is set then the background will be transparent with the DrawText() command.

#PB_2DDrawing_XOr
Enables the XOR mode. All graphics will be XOR'ed with the current background. This mode cannot be combined with the below alpha channel modes.

Note: This mode does not work with PrinterOutput().

#PB_2DDrawing_Outlined
If this flag is set then shapes will be drawn as outlines only and not filled. This applies to commands such as Circle, Box, etc.

Note: The following modes only work with ImageOutput() and CanvasOutput(). They are ignored for all other outputs:

#PB_2DDrawing_AlphaBlend
The drawing operations will be alpha-blended onto the background. The RGBA() command can be used to specify colors with alpha transparency in commands like FrontColor(), Box(), DrawText() etc.

#PB_2DDrawing_AlphaClip
The drawing operations will be alpha-blended onto the background like with the #PB_2DDrawing_AlphaBlend mode, with the addition that the alpha channel of the drawing output acts as a mask. This means that areas of the output that are transparent before the blending will also remain transparent afterwards. If the drawing output has no alpha channel then this mode acts just like the #PB_2DDrawing_AlphaBlend mode.
#PB_2DDrawing_AlphaChannel
The drawing operations will only modify the alpha channel of the drawing output. All color information is ignored. For example drawing a circle with a color value of RGBA(0, 0, 0, 0) will "cut" a hole into the drawing output by making the circle area fully transparent. If the drawing output has no alpha channel, as the CanvasGadget, then no drawing will have an effect in this mode.
#PB_2DDrawing_AllChannels
The drawing operations will modify the color channels and the alpha channel of the drawing output. The content of the channels is replaced by the drawing operation without any blending. Drawing in this mode has the same effect as drawing first using the #PB_2DDrawing_Default mode and then drawing the same operation using the #PB_2DDrawing_AlphaChannel mode. If the drawing output has no alpha channel, as the CanvasGadget, then this mode is equivalent to the #PB_2DDrawing_Default mode.

#PB_2DDrawing_Gradient
This mode allows drawing with a gradient instead of a solid color. The gradient shape can be defined with commands such as LinearGradient(), CircularGradient() etc. and the colors used in the gradient can be set with GradientColor(). The color parameters given to the individual drawing commands will be ignored in this mode. This mode can be combined with the above alpha channel modes to have gradients with semitransparent colors.

#PB_2DDrawing_CustomFilter
In this mode, the drawing of the pixels can be defined by a custom procedure with the CustomFilterCallback() command. This allows the implementation of custom drawing effects while still using the default functions to do the actual drawing.

Return value

None.

Remarks

To use several modes at once, you have to use the '|' (OR) operator. The following is an example for XOR'ed outlined shapes:
  DrawingMode(#PB_2DDrawing_Outlined | #PB_2DDrawing_XOr)

See Also

FrontColor(), BackColor()

Supported OS

All

<- DrawingFont() - 2DDrawing Index - Ellipse() ->