source: GraphicTest/Methods/UMethodLazIntfImageColorsCopy.pas

Last change on this file was 543, checked in by chronos, 4 years ago
  • Modified: Removed drawing methods files and classes to use Method prefix.
  • Added: TBitmap.Scanline and Move draw methods.
File size: 1.5 KB
Line 
1unit UMethodLazIntfImageColorsCopy;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, UDrawMethod, UFastBitmap, IntfGraphics, GraphType,
9 fpImage, Graphics;
10
11type
12 { TMethodLazIntfImageColorsCopy }
13
14 TMethodLazIntfImageColorsCopy = class(TDrawMethodImage)
15 constructor Create; override;
16 destructor Destroy; override;
17 procedure DrawFrame(FastBitmap: TFastBitmap); override;
18 end;
19
20
21implementation
22
23{ TMethodLazIntfImageColorsCopy }
24
25constructor TMethodLazIntfImageColorsCopy.Create;
26begin
27 inherited;
28 Caption := 'TLazIntfImage.Colors copy';
29 Description.Add('Method use TLazIntfImage class for faster access to bitmap pixels compared to simple access using TBitmap.Pixels.');
30 Description.Add('TLazIntfImage is created from visible image.');
31end;
32
33destructor TMethodLazIntfImageColorsCopy.Destroy;
34begin
35 inherited Destroy;
36end;
37
38procedure TMethodLazIntfImageColorsCopy.DrawFrame(FastBitmap: TFastBitmap);
39var
40 Y, X: Integer;
41 TempIntfImage: TLazIntfImage;
42begin
43 with FastBitmap do begin
44 TempIntfImage := TLazIntfImage.Create(Image.Picture.Bitmap.Width, Image.Picture.Bitmap.Height);
45 TempIntfImage.LoadFromBitmap(Image.Picture.Bitmap.Handle,
46 Image.Picture.Bitmap.MaskHandle);
47 for X := 0 to Size.X - 1 do
48 for Y := 0 to Size.Y - 1 do
49 TempIntfImage.Colors[X, Y] := TColorToFPColor(SwapBRComponent(Pixels[X, Y]));
50 Image.Picture.Bitmap.LoadFromIntfImage(TempIntfImage);
51 TempIntfImage.Free;
52 end;
53end;
54
55
56end.
57
Note: See TracBrowser for help on using the repository browser.