Zitat von
EWeiss:
That is hard
But as I said my code I uploaded here works.
The callback function
ImageScaling is executed in your test?
Edition:
The callback is working to me now, i discovered that my callback function is executed always that Magnifier window is resized:
Delphi-Quellcode:
function MagImageScalingCallback(hwnd: hwnd; srcdata: Pointer;
srcheader: MAGIMAGEHEADER; destdata: Pointer; destheader: MAGIMAGEHEADER;
unclipped: TRect; clipped: TRect; dirty: HRGN): BOOL; stdcall;
var
lpbmih: TBitmapInfoHeader;
lpbmi: TBitmapInfo;
aBitmap: HBITMAP;
aDC: HDC;
bmp: TBitmap;
begin
Fillchar(lpbmih, SizeOf(lpbmih), 0);
lpbmih.biSize := SizeOf(lpbmih);
lpbmih.biWidth := srcheader.width;
lpbmih.biHeight := srcheader.height;
lpbmih.biPlanes := 1;
lpbmih.biBitCount := Floor(lpbmih.biSizeImage / lpbmih.biHeight /
lpbmih.biWidth * 8);
lpbmih.biCompression := BI_RGB;
Fillchar(lpbmi, SizeOf(lpbmi), 0);
lpbmi.bmiHeader.biSize := SizeOf(lpbmi.bmiHeader);
lpbmi.bmiHeader.biWidth := srcheader.width;
lpbmi.bmiHeader.biHeight := srcheader.height;
lpbmi.bmiHeader.biPlanes := 1;
lpbmi.bmiHeader.biBitCount :=
Floor(lpbmi.bmiHeader.biSizeImage / lpbmi.bmiHeader.biHeight /
lpbmi.bmiHeader.biWidth * 8);
lpbmi.bmiHeader.biCompression := BI_RGB;
aDC := GetWindowDC(hwnd);
bmp := TBitmap.Create;
aBitmap := 0;
try
aBitmap := CreateDIBitmap(aDC, lpbmih, 0, nil, lpbmi, DIB_RGB_COLORS);
bmp.handle := aBitmap;
bmp.SaveToFile('c:\tela.bmp');
finally
DeleteObject(aBitmap);
DeleteDC(aDC);
bmp.Free;
end;
Result := True;
end;
//...
if (not MagSetImageScalingCallback(hwndMag, MagImageScalingCallback)) then
My trouble now is that i'm getting a black image. Some idea how fix?