mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 16:19:13 +02:00
Merge branch 'DisabledDrawEffectStyle' into 'main'
LazUtils: Added DisabledDrawEffectStyle to control disabled image appearance See merge request freepascal.org/lazarus/lazarus!298
This commit is contained in:
commit
9f98ea7602
@ -268,6 +268,7 @@ function RawImageQueryFlagsToString(AFlags: TRawImageQueryFlags): string;
|
|||||||
|
|
||||||
var
|
var
|
||||||
MissingBits: array[0..15] of array[0..7] of word;
|
MissingBits: array[0..15] of array[0..7] of word;
|
||||||
|
DisabledDrawEffectStyle: (ddesGrayscale, ddesDarken, ddesLighten) = ddesGrayscale;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -1651,6 +1652,7 @@ var
|
|||||||
AData: PRGBAQuad;
|
AData: PRGBAQuad;
|
||||||
P: Pointer;
|
P: Pointer;
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
|
Gray: Byte;
|
||||||
begin
|
begin
|
||||||
// check here for Description. Only RGBA data can be processed here.
|
// check here for Description. Only RGBA data can be processed here.
|
||||||
if not CheckDescription then
|
if not CheckDescription then
|
||||||
@ -1676,9 +1678,21 @@ begin
|
|||||||
begin
|
begin
|
||||||
with AData^ do
|
with AData^ do
|
||||||
begin
|
begin
|
||||||
Red := (Red + Green + Blue) div 3;
|
Gray := (Red + Green + Blue) div 3;
|
||||||
Green := Red;
|
// Apply existing alpha and reduce visibility by a further 66%
|
||||||
Blue := Red;
|
if DisabledDrawEffectStyle = ddesLighten then
|
||||||
|
begin
|
||||||
|
Alpha := Byte((Integer(Gray) * Alpha) div 768);
|
||||||
|
Gray := $FF;
|
||||||
|
end
|
||||||
|
else if DisabledDrawEffectStyle = ddesDarken then
|
||||||
|
begin
|
||||||
|
Alpha := Byte((Integer($FF - Gray) * Alpha) div 768);
|
||||||
|
Gray := $00;
|
||||||
|
end;
|
||||||
|
Red := Gray;
|
||||||
|
Green := Gray;
|
||||||
|
Blue := Gray;
|
||||||
end;
|
end;
|
||||||
inc(AData);
|
inc(AData);
|
||||||
end;
|
end;
|
||||||
|
@ -1317,6 +1317,26 @@ boundaries.
|
|||||||
<seealso/>
|
<seealso/>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
<element name="DisabledDrawEffectStyle">
|
||||||
|
<short>Controls the appearance of disabled images.</short>
|
||||||
|
<descr>
|
||||||
|
<p>
|
||||||
|
This variable controls how <link id="TRawImage.PerformEffect"/>
|
||||||
|
represents <link id="TGraphicsDrawEffect.gdeDisabled">gdeDisabled</link>.
|
||||||
|
Applications should set it based on the background color for their
|
||||||
|
interfaces.
|
||||||
|
</p>
|
||||||
|
</descr>
|
||||||
|
</element>
|
||||||
|
<element name="DisabledDrawEffectStyle.ddesGrayscale">
|
||||||
|
<short>Convert RGB values to grayscale.</short>
|
||||||
|
</element>
|
||||||
|
<element name="DisabledDrawEffectStyle.ddesDarken">
|
||||||
|
<short>Convert to black with alpha representing grayscale.</short>
|
||||||
|
</element>
|
||||||
|
<element name="DisabledDrawEffectStyle.ddesLighten">
|
||||||
|
<short>Convert to white with alpha representing grayscale.</short>
|
||||||
|
</element>
|
||||||
</module>
|
</module>
|
||||||
<!-- GraphType -->
|
<!-- GraphType -->
|
||||||
</package>
|
</package>
|
||||||
|
Loading…
Reference in New Issue
Block a user