source: GraphicTest/Methods/MethodLazIntfImageColorsCopy.pas

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