Does anybody know anything about resolution errors in D3.
Here is the problem. When putting a scanned HBitmap into an image, it is
fine UNTIL the resolution/picture size is over say 300 dpi, then an error
(as below).
A similar thing happens with a JPEG image. I expect it is the same Image
problem in JPEG, as this uses Timage as well.
Heres the code:
Procedure anotherfunction;
.......and so on
image := timage.Create(Self);
image.Width := w; image.Height := h;
CopyDibIntoImage(ScanDib, image); //this call causes the error
.......and so on
procedure CopyDIBIntoImage(hDIB: THandle; Image: TImage);
var
DibW, DibH, oldw, oldh: integer;
begin
Oldw := Image.Width;
Oldh := Image.Height;
DibW := TWAIN_DibWidth(hDib);
DibH := TWAIN_DibHeight(hDib);
//@ 300 dpi DibW:=2520 DibH:=3490
Image.Width := DibW; // temporarily enlarge image to ensure the whole
Image.Height := DibH; // DIB gets copied
//ONLY if the resolution is >200 dpi
//here I get (cursor over line IDE exception): delphi exception
image.canvas.handle=Eoutofresources at $718FCBD
//this is BEFORE stepping into the following line, which then generates the
real exception
//otherwise if lower resolution the canvas handle is OK??????????
TWAIN_DrawDibToDC(Image.Canvas.Handle, 0, 0, DibW, DibH, hDIB, 0, 0);
Image.Width := oldw;
Image.Height := oldh;
end;
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz