I dont think its an good idea to use the fpcanvas functions in the interfaces becaose the native functions of the interfaces especially in windows can be faster. I use this to set another StretchBltMode in Windows and the results looks great:

 {$IFDEF MSWINDOWS}
 SetStretchBltMode(CanvasHandle,STRETCH_HALFTONE);
 SetBrushOrgEx(CanvasHandle,0,0,nil);
 {$ENDIF}

maybe we schould add this in the interface code for stretchdraw in windows.

Christian

Patrick Chevalley schrieb:
Hi,

I start to play with you new stretchdraw, this work fine with today Lazarus snapshot. I quickly hack TCanvas.StretchDraw to use it and I am pleased with the first result as this solve the ugly stretchdraw we have previously on Win32. See the attached image that show the result,new stretchdraw on right :) , this is a TImage with Stretch property to true.

This is how I change TCanvas.StretchDraw, any idea to avoid this multiple conversion from TGraphic to TBitmap to TFPCustomImage ?

procedure TCanvas.StretchDraw(const DestRect: TRect; SrcGraphic: TGraphic);
var img: TLazIntfImage;
    bmp: TBitmap;
begin
  if not Assigned(SrcGraphic) then exit;
  Changing;
  RequiredState([csHandleValid]);
//  SrcGraphic.Draw(Self, DestRect);
// added for FPCanvas.Strechdraw
  bmp:=TBitmap.Create;
  bmp.Assign(SrcGraphic);
  img:=bmp.CreateIntfImage;
  Inherited StretchDraw(DestRect.Left,DestRect.Top,
DestRect.Right-DestRect.Left,DestRect.Bottom-DestRect.Top,img);
  img.free;
  bmp.free;
//
  Changed;
end;

------------------------------------------------------------------------


_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to