Name
ReadBrushPixel -- read single pixel from brush (V5.0)
Synopsis
color, trans = ReadBrushPixel(id, x, y)
Function
This command reads the color and transparency states of the specified pixel from the brush specified in 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().

Inputs
id
identifier of the brush to use
x
x offset
y
y offset
Results
color
RGB color at the specified location
trans
transparency state at the specified location
Example
color, trans = ReadBrushPixel(1, 100, 100)
Reads pixel states from position 100:100 in brush 1.

Show TOC