color, trans = ReadBrushPixel(id, x, y)
id
. The color is returned in RGB format whereas the format of
the trans
value depends on the type of transparency used by the brush. If the brush
has a mask, trans
will be either 0 (invisible) or 1 (visible). If the brush has an alpha
channel, then trans
will be in the range of 0 (invisible) to 255 (visible). If the
brush does not have a transparency channel, -1 is returned in trans
.
You can also read pixels from brushes by selecting the brush as the output device
using SelectBrush() and then call the ReadPixel() function. Using ReadBrushPixel()
,
however, is faster for most cases because it allows you to access color and transparency
channels at the same time and you can also avoid the overhead that is generated
by calling SelectBrush() and EndSelect().
Note that when using this function with a palette brush, ReadBrushPixel()
won't return
the RGB color but the pen at the specified position.
color, trans = ReadBrushPixel(1, 100, 100)Reads pixel states from position 100:100 in brush 1.