Главная страница | назад

Article #17622: Raster operations.

 Question and Answer Database

FAQ2622D.txt   Raster operations.
Category   :VCL
Platform    :All
Product    :All 32 bit  

When using a canvas, the return value from the pixels 
property returns an invalid color of -1 or hex $FFFFFFFF. 
How can I get around this?

This can happen if the requested pixel is not in the 
current clipping region. This can also happen on devices 
that do not support the Windows API functions GetPixel() 
and SetPixel(). You should check the return value from 
the GetDeviceCaps() to check to see if a device supports 
raster operations before using these functions. A printer 
and/or metafile canvas is a likley candidate for a device 
that the pixels property may fail on.


if (GetDeviceCaps(Printer.Canvas.Handle, RASTERCAPS) 
  and RC_NONE) = RC_NONE then
NoRasterOperations := True;

7/16/98 4:31:28 PM

Last Modified: 01-SEP-99