1 | {$IFDEF INCLUDE_USES}
|
---|
2 | {$UNDEF INCLUDE_USES}
|
---|
3 | ,fpg_base, fpg_main
|
---|
4 | {$ENDIF}
|
---|
5 |
|
---|
6 | {$IFDEF INCLUDE_INTERFACE}
|
---|
7 | {$UNDEF INCLUDE_INTERFACE}
|
---|
8 | type
|
---|
9 | TColor = TfpgColor;
|
---|
10 | TRawImage = class(TfpgImage)
|
---|
11 | procedure BGRASetSizeAndTransparency(AWidth,AHeight: Integer; ATransparent: boolean);
|
---|
12 | end;
|
---|
13 | TGUICanvas = TfpgCanvas;
|
---|
14 |
|
---|
15 | const
|
---|
16 | clNone = fpg_base.clNone;
|
---|
17 | clBlack = fpg_base.clBlack;
|
---|
18 | clWhite = fpg_base.clWhite;
|
---|
19 |
|
---|
20 | function clRgbBtnHighlight: TColor;
|
---|
21 | function clRgbBtnShadow: TColor;
|
---|
22 | function ColorToRGB(c: TColor): TColor; inline;
|
---|
23 | function RGBToColor(R, G, B: Byte): TColor;
|
---|
24 | procedure RedGreenBlue(rgb: TColor; out Red, Green, Blue: Byte); // does not work on system color
|
---|
25 | function GetScreenDPIX: integer;
|
---|
26 | function GetScreenDPIY: integer;
|
---|
27 | {$ENDIF}
|
---|
28 |
|
---|
29 | {$IFDEF INCLUDE_IMPLEMENTATION}
|
---|
30 | {$UNDEF INCLUDE_IMPLEMENTATION}
|
---|
31 |
|
---|
32 | procedure TRawImage.BGRASetSizeAndTransparency(AWidth,AHeight: Integer; ATransparent: boolean);
|
---|
33 | var
|
---|
34 | tempData: pointer;
|
---|
35 | begin
|
---|
36 | if (Width <> AWidth) or (Height <> AHeight) then
|
---|
37 | begin
|
---|
38 | AllocateImage(32,AWidth,AHeight);
|
---|
39 | if ATransparent then AllocateMask;
|
---|
40 | end else
|
---|
41 | begin
|
---|
42 | if ATransparent and not Masked then AllocateMask else
|
---|
43 | if not ATransparent and Masked then
|
---|
44 | begin
|
---|
45 | getmem(tempData, ImageDataSize);
|
---|
46 | if tempData <> nil then
|
---|
47 | begin
|
---|
48 | move(ImageData^, tempData^, ImageDataSize);
|
---|
49 | FreeImage;
|
---|
50 | AllocateImage(32,AWidth,AHeight);
|
---|
51 | move(tempData^, ImageData^, ImageDataSize);
|
---|
52 | freemem(tempData);
|
---|
53 | end;
|
---|
54 | end;
|
---|
55 | end;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | function clRgbBtnHighlight: TColor;
|
---|
59 | begin
|
---|
60 | result := fpgColorToRGB(fpg_base.clHilite2);
|
---|
61 | end;
|
---|
62 |
|
---|
63 | function clRgbBtnShadow: TColor;
|
---|
64 | begin
|
---|
65 | result := fpgColorToRGB(fpg_base.clShadow2);
|
---|
66 | end;
|
---|
67 |
|
---|
68 | function ColorToRGB(c: TColor): TColor; inline;
|
---|
69 | begin
|
---|
70 | result := fpgColorToRGB(c);
|
---|
71 | end;
|
---|
72 |
|
---|
73 | function RGBToColor(R, G, B: Byte): TColor;
|
---|
74 | begin
|
---|
75 | Result := (R shl 16) or (G shl 8) or B;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure RedGreenBlue(rgb: TColor; out Red, Green, Blue: Byte);
|
---|
79 | begin
|
---|
80 | Blue := rgb and $000000ff;
|
---|
81 | Green := (rgb shr 8) and $000000ff;
|
---|
82 | Red := (rgb shr 16) and $000000ff;
|
---|
83 | end;
|
---|
84 |
|
---|
85 | function GetScreenDPIX: integer;
|
---|
86 | begin
|
---|
87 | result := fpgApplication.Screen_dpi_x;
|
---|
88 | end;
|
---|
89 |
|
---|
90 | function GetScreenDPIY: integer;
|
---|
91 | begin
|
---|
92 | result := fpgApplication.Screen_dpi_y;
|
---|
93 | end;
|
---|
94 |
|
---|
95 | {$ENDIF}
|
---|