source: GraphicTest/Methods/UMethodCanvasPixelsUpdateLock.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.2 KB
Line 
1unit UMethodCanvasPixelsUpdateLock;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, UDrawMethod, UFastBitmap, Graphics;
9
10type
11 { TMethodCanvasPixelsUpdateLock }
12
13 TMethodCanvasPixelsUpdateLock = class(TDrawMethodImage)
14 constructor Create; override;
15 procedure DrawFrame(FastBitmap: TFastBitmap); override;
16 end;
17
18
19implementation
20
21{ TMethodCanvasPixelsUpdateLock }
22
23constructor TMethodCanvasPixelsUpdateLock.Create;
24begin
25 inherited;
26 Caption := 'TBitmap.Canvas.Pixels Update locking';
27 Description.Add('This method improves basic canvas pixel access by eliminating ' +
28 'updating of visible area during complete operation. Image data is ' +
29 'painted only one at the end of complete operation');
30end;
31
32procedure TMethodCanvasPixelsUpdateLock.DrawFrame(FastBitmap: TFastBitmap);
33var
34 Y, X: Integer;
35begin
36 with FastBitmap do
37 try
38 Image.Picture.Bitmap.BeginUpdate(True);
39 for Y := 0 to Size.Y - 1 do
40 for X := 0 to Size.X - 1 do
41 Image.Picture.Bitmap.Canvas.Pixels[X, Y] := TColor(SwapBRComponent(Pixels[X, Y]));
42 finally
43 Image.Picture.Bitmap.EndUpdate(False);
44 end;
45end;
46
47
48end.
49
Note: See TracBrowser for help on using the repository browser.