Ignore:
Timestamp:
Feb 1, 2012, 3:02:33 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Updated BGRABitmap package to version 5.5.
  • Modified: Removed draw method ComboBox and reorganized method list to single listview with using ownerdraw facility.
  • Added: New draw method TBitmap.RawImage.Data Move which use fast Move operation. It requires same pixel format.
  • Added: New draw method Dummy for comparion of empty method and to determine possibily max frame rate limit.
Location:
GraphicTest/BGRABitmap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/BGRABitmap

    • Property svn:ignore set to
      lib
  • GraphicTest/BGRABitmap/bgrabitmap.pas

    r210 r317  
    4141interface
    4242
     43{ Compiler directives are used to include the best version according
     44  to the platform }
     45
    4346uses
    4447  Classes, SysUtils,
     
    8184{$ENDIF}
    8285
    83 
     86// draw a bitmap from pure data
    8487procedure BGRABitmapDraw(ACanvas: TCanvas; Rect: TRect; AData: Pointer;
    8588  VerticalFlip: boolean; AWidth, AHeight: integer; Opaque: boolean);
    86 procedure BGRAReplace(var Source: TBGRABitmap; Temp: TObject);
     89 
     90{ Replace the content of the variable Destination with the variable
     91  Temp and frees previous object contained in Destination.
     92 
     93  This function is useful as a shortcut for :
     94 
     95  var
     96    temp: TBGRABitmap;
     97  begin
     98    ...
     99    temp := someBmp.Filter... as TBGRABitmap;
     100    someBmp.Free;
     101    someBmp := temp;
     102  end;
     103 
     104  which becomes :
     105 
     106  begin
     107    ...
     108    BGRAReplace(temp, someBmp.Filter... );
     109  end;
     110}
     111procedure BGRAReplace(var Destination: TBGRABitmap; Temp: TObject);
    87112
    88113implementation
    89114
    90 uses GraphType, BGRAAnimatedGif;
     115uses GraphType, BGRABitmapTypes;
    91116
    92117var
    93   bmp: TBGRABitmap;
     118  tempBmp: TBGRABitmap;
    94119
    95120procedure BGRABitmapDraw(ACanvas: TCanvas; Rect: TRect; AData: Pointer;
     
    98123  LineOrder: TRawImageLineOrder;
    99124begin
     125  if tempBmp = nil then
     126    tempBmp := TBGRABitmap.Create;
    100127  if VerticalFlip then
    101128    LineOrder := riloBottomToTop
     
    103130    LineOrder := riloTopToBottom;
    104131  if Opaque then
    105     bmp.DataDrawOpaque(ACanvas, Rect, AData, LineOrder, AWidth, AHeight)
     132    tempBmp.DataDrawOpaque(ACanvas, Rect, AData, LineOrder, AWidth, AHeight)
    106133  else
    107     bmp.DataDrawTransparent(ACanvas, Rect, AData, LineOrder, AWidth, AHeight);
     134    tempBmp.DataDrawTransparent(ACanvas, Rect, AData, LineOrder, AWidth, AHeight);
    108135end;
    109136
    110 procedure BGRAReplace(var Source: TBGRABitmap; Temp: TObject);
     137procedure BGRAReplace(var Destination: TBGRABitmap; Temp: TObject);
    111138begin
    112   Source.Free;
    113   Source := Temp as TBGRABitmap;
     139  Destination.Free;
     140  Destination := Temp as TBGRABitmap;
    114141end;
    115142
    116143initialization
    117144
    118   bmp := TBGRABitmap.Create(0, 0);
     145  //this variable is assigned to access appropriate functions
     146  //depending on the platform
     147  BGRABitmapFactory := TBGRABitmap;
    119148
    120149finalization
    121150
    122   bmp.Free;
     151  tempBmp.Free;
    123152
    124153end.
Note: See TracChangeset for help on using the changeset viewer.