ReadPixel -- read a pixel from output device (V1.5)
col = ReadPixel(x, y)
This function reads a pixel from the position specified by x and y from the current output device and returns its color.

Please note: The color returned by this function can slightly vary from the original color at this position. For example, if you have a brush which is completely white (i.e. all pixels have the color $FFFFFF). If you use ReadPixel() now to read the color of an arbitrary pixel from this brush, you will receive the color $FFFFFF only if Hollywood runs on a 24-bit or 32-bit screen. If Hollywood runs on a 16-bit screen, you will get the color $FCF8FC, on a 15-bit screen you would receive $F8F8F8. This is because those screens do not have 16.7 million colors but only 65536 (16-bit screens) or 32768 (15-bit screens) respectively. You can use the function GetRealColor() to find out which color represents the specified color on the current screen.

If the current output device is the mask of a brush, then ReadPixel() will return either 0 if the pixel is invisible or 1 if the pixel is visible.

If the current output device is an alpha channel of a brush, then ReadPixel() will return the transparency level of the requested pixel which ranges from 0 (full transparency) to 255 (no transparency).

x coordinate of the pixel
y coordinate of the pixel
color or transparency setting of the pixel at the specified position
CreateBrush(1, 320, 256)
Box(0, 0, 320, 256, #GREEN)
a = ReadPixel(100, 100)
The above code draws a green rectangle to brush 1 and reads the pixel at 100:100 from it. The variable a will receive the value of #GREEN because the whole brush is filled with green.

Show TOC