Line | |
---|
1 | unit UColorGray8;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, UFGraphics, UGGraphics, Graphics;
|
---|
9 |
|
---|
10 | type
|
---|
11 | { TColorFormatGray8 }
|
---|
12 |
|
---|
13 | TColorFormatGray8 = class(TColorFormat)
|
---|
14 | constructor Create; override;
|
---|
15 | end;
|
---|
16 |
|
---|
17 | TColorGray8 = Byte;
|
---|
18 |
|
---|
19 | TPixmapGray8 = class(TGPixmap<TColorGray8>)
|
---|
20 | function Gray8ToColor(Value: TColorGray8): TColor;
|
---|
21 | end;
|
---|
22 |
|
---|
23 |
|
---|
24 | implementation
|
---|
25 |
|
---|
26 | { TColorFormatGray8 }
|
---|
27 |
|
---|
28 | constructor TColorFormatGray8.Create;
|
---|
29 | begin
|
---|
30 | inherited;
|
---|
31 | Name := 'Gray 8-bit';
|
---|
32 | BitDepth := 8;
|
---|
33 | AddChannel('Gray', 0, 8);
|
---|
34 | end;
|
---|
35 |
|
---|
36 | { TPixmapGray8 }
|
---|
37 |
|
---|
38 | function TPixmapGray8.Gray8ToColor(Value: TColorGray8): TColor;
|
---|
39 | begin
|
---|
40 | Result := (Value shl 16) or (Value shl 8) or (Value shl 0);
|
---|
41 | end;
|
---|
42 |
|
---|
43 |
|
---|
44 | end.
|
---|
45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.