TLama

Untitled

Jul 24th, 2014
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.78 KB | None | 0 0
  1. var
  2.   SrcBitmap: TBitmap;
  3.   DstBitmap: TBitmap;
  4.   JPEGImage: TJPEGImage;
  5. begin
  6.   SrcBitmap := TBitmap.Create;
  7.   try
  8.     JPEGImage := TJPEGImage.Create;
  9.     try
  10.       JPEGImage.LoadFromFile('C:\Image.jpg');
  11.       SrcBitmap.Assign(JPEGImage);
  12.     finally
  13.       JPEGImage.Free;
  14.     end;
  15.  
  16.     DstBitmap := TBitmap.Create;
  17.     try
  18.       DstBitmap.Width := 100;
  19.       DstBitmap.Height := 100;
  20.  
  21.       SetStretchBltMode(DstBitmap.Canvas.Handle, HALFTONE);
  22.       StretchBlt(
  23.         DstBitmap.Canvas.Handle, 0, 0, DstBitmap.Width, DstBitmap.Height,
  24.         SrcBitmap.Canvas.Handle, 0, 0, SrcBitmap.Width, SrcBitmap.Height,
  25.         SRCCOPY
  26.       );
  27.  
  28.       Image1.Picture.Assign(DstBitmap);
  29.     finally
  30.       DstBitmap.Free;
  31.     end;
  32.  
  33.   finally
  34.     SrcBitmap.Free;
  35.   end;
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment