source: trunk/Methods/UMethodCanvasPixels.pas

Last change on this file was 2, checked in by chronos, 4 years ago
File size: 978 bytes
Line 
1unit UMethodCanvasPixels;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, UDrawMethod, UFastBitmap, Graphics;
9
10type
11 { TMethodCanvasPixels }
12
13 TMethodCanvasPixels = class(TDrawMethodCanvas)
14 constructor Create; override;
15 procedure DrawFrame(FastBitmap: TFastBitmap); override;
16 end;
17
18
19implementation
20
21{ TMethodCanvasPixels }
22
23constructor TMethodCanvasPixels.Create;
24begin
25 inherited;
26 Caption := 'TBitmap.Canvas.Pixels';
27 Description.Add('This is simple naive approach to copy image by accessing Pixels property. ' +
28 'Method is slow because of much of overhead in access methods like multiple nested method calls, ' +
29 'pixel format conversion, update notification, etc.');
30end;
31
32procedure TMethodCanvasPixels.DrawFrame(FastBitmap: TFastBitmap);
33var
34 Y, X: Integer;
35begin
36 with FastBitmap do begin
37 for Y := 0 to Size.Y - 1 do
38 for X := 0 to Size.X - 1 do
39 Canvas.Pixels[X, Y] := TColor(SwapBRComponent(Pixels[X, Y]));
40 end;
41end;
42
43
44end.
45
Note: See TracBrowser for help on using the repository browser.