source: Generics/TemplateGenerics/Generic/GenericBitmap.inc

Last change on this file was 426, checked in by chronos, 12 years ago
File size: 1.8 KB
Line 
1{$IFDEF INTERFACE}
2
3// TGBitmap<TGBitmapIndexX, TGBitmapIndexY, TGBitmapItem>
4{$DEFINE TGMatrixIndexX := TGBitmapIndexX}
5{$DEFINE TGMatrixIndexY := TGBitmapIndexY}
6{$DEFINE TGMatrixItem := TGBitmapItem}
7{$DEFINE TGMatrixIndex := TGBitmapIndex}
8{$DEFINE TGMatrixRow := TGBitmapRow}
9{$DEFINE TGMatrix := TGBitmapMatrix}
10{$DEFINE INTERFACE}
11{$I 'GenericMatrix.inc'}
12
13 // TGBitmap<TGBitmapIndex, TGBitmapIndex, TGBitmapItem> = class
14 TGBitmap = class(TGMatrix)
15 private
16 function GetWidth: TGBitmapIndexX;
17 function GetHeight: TGBitmapIndexX;
18 procedure SetWidth(Value: TGBitmapIndexX);
19 procedure SetHeight(Value: TGBitmapIndexY);
20 public
21 property Pixels[X: TGBitmapIndexX; Y: TGBitmapIndexY]: TGBitmapItem
22 read GetItemXY write PutItemXY;
23 property Width: TGBitmapIndexX read GetWidth write SetWidth;
24 property Height: TGBitmapIndexY read GetHeight write SetHeight;
25 end;
26
27{$UNDEF INTERFACE}
28{$ENDIF}
29
30{$IFDEF IMPLEMENTATION_USES}
31
32 {$DEFINE IMPLEMENTATION_USES}
33 {$I 'GenericMatrix.inc'}
34
35{$UNDEF IMPLEMENTATION_USES}
36{$ENDIF}
37
38{$IFDEF IMPLEMENTATION}
39
40// TGBitmap<TGBitmapIndexX, TGBitmapIndexY, TGBitmapItem>
41{$DEFINE TGMatrixIndexX := TGBitmapIndexX}
42{$DEFINE TGMatrixIndexY := TGBitmapIndexY}
43{$DEFINE TGMatrixItem := TGBitmapItem}
44{$DEFINE TGMatrixIndex := TGBitmapIndex}
45{$DEFINE TGMatrixRow := TGBitmapRow}
46{$DEFINE TGMatrix := TGBitmapMatrix}
47{$DEFINE IMPLEMENTATION}
48{$I 'GenericMatrix.inc'}
49
50function TGBitmap.GetWidth: TGBitmapIndexX;
51begin
52 Result := Count.X;
53end;
54
55function TGBitmap.GetHeight: TGBitmapIndexX;
56begin
57 Result := Count.Y;
58end;
59
60procedure TGBitmap.SetWidth(Value: TGBitmapIndexX);
61begin
62 Count := CreateIndex(Value, Count.Y);
63end;
64
65procedure TGBitmap.SetHeight(Value: TGBitmapIndexY);
66begin
67 Count := CreateIndex(Count.X, Value);
68end;
69
70{$UNDEF IMPLEMENTATION}
71{$ENDIF}
72
Note: See TracBrowser for help on using the repository browser.