mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-21 18:11:29 +02:00
Implements support for radial gradient in Qt and the LCL with capability indicator
git-svn-id: trunk@51539 -
This commit is contained in:
parent
16ac9de63c
commit
0ac0499be9
@ -104,6 +104,11 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TWidgetSet.CreateBrushWithRadialGradient(const LogBrush: TLogRadialGradient): HBRUSH;
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TWidgetSet.CreateCaret(Handle : HWND; Bitmap : hBitmap; width, Height : Integer) : Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
@ -94,6 +94,11 @@ begin
|
||||
Result := WidgetSet.CreateBrushIndirect(LogBrush);
|
||||
end;
|
||||
|
||||
function CreateBrushWithRadialGradient(const LogBrush: TLogRadialGradient): HBRUSH;
|
||||
begin
|
||||
Result := WidgetSet.CreateBrushWithRadialGradient(LogBrush);
|
||||
end;
|
||||
|
||||
function CreateCaret(Handle : HWND; Bitmap : hBitmap; width, Height : Integer) : Boolean;
|
||||
begin
|
||||
Result := WidgetSet.CreateCaret(Handle, Bitmap, width, Height);
|
||||
|
@ -47,6 +47,7 @@ function ClientToScreen(Handle : HWND; var P : TPoint) : Boolean; {$IFDEF IF_BAS
|
||||
function CombineRgn(Dest, Src1, Src2 : HRGN; fnCombineMode : Longint) : Longint; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateBrushWithRadialGradient(const LogBrush: TLogRadialGradient): HBRUSH; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateCaret(Handle: HWND; Bitmap: hBitmap; width, Height: Integer): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateCompatibleDC(DC: HDC): HDC; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
@ -79,7 +79,8 @@ type
|
||||
lcSendsUTF8KeyPress, // If the interface does not yet send UTF8KeyPress directly, then it will be emulated in TWinControl.CNChar
|
||||
lcAllowChildControlsInNativeControls, // Utilized by LCL-CustomDrawn so that it can inject child controls in native ones
|
||||
lcEmulatedMDI, // used for emulating MDI on widgetsets which does not provide native MDI handling
|
||||
lcAccessibilitySupport // Indicates that accessibility is implemented, mostly for TCustomControl descendents as native widgests should have in-built accessibility
|
||||
lcAccessibilitySupport, // Indicates that accessibility is implemented, mostly for TCustomControl descendents as native widgests should have in-built accessibility
|
||||
lcRadialGradientBrush // Indicates that the function CreateBrushWithRadialGradient is supported, i.e. we can create a brush with a radial gradient pattern
|
||||
);
|
||||
|
||||
{ TDialogButton }
|
||||
|
@ -1230,6 +1230,7 @@ begin
|
||||
{$ifdef HASX11} LCL_CAPABILITY_YES {$else} LCL_CAPABILITY_NO {$endif};
|
||||
{when issue #20475 is fixed, then set this to LCL_CAPABILITY_YES}
|
||||
lcReceivesLMClearCutCopyPasteReliably: Result := LCL_CAPABILITY_NO;
|
||||
lcRadialGradientBrush: Result := LCL_CAPABILITY_YES;
|
||||
else
|
||||
Result := inherited GetLCLCapability(ACapability);
|
||||
end;
|
||||
|
@ -273,11 +273,13 @@ type
|
||||
|
||||
TQtBrush = class(TQtResource)
|
||||
private
|
||||
FRadialGradient: QRadialGradientH;
|
||||
function getStyle: QtBrushStyle;
|
||||
procedure setStyle(style: QtBrushStyle);
|
||||
public
|
||||
FHandle: QBrushH;
|
||||
constructor Create(CreateHandle: Boolean); virtual;
|
||||
constructor CreateWithRadialGradient(ALogBrush: TLogRadialGradient);
|
||||
destructor Destroy; override;
|
||||
function getColor: PQColor;
|
||||
function GetLBStyle(out AStyle: LongWord; out AHatch: PtrUInt): Boolean;
|
||||
@ -1804,6 +1806,28 @@ begin
|
||||
QtGDIObjects.AddGDIObject(Self);
|
||||
end;
|
||||
|
||||
constructor TQtBrush.CreateWithRadialGradient(ALogBrush: TLogRadialGradient);
|
||||
var
|
||||
i: Integer;
|
||||
lColor: PQColor;
|
||||
lR, lG, lB, lA: Double;
|
||||
begin
|
||||
FRadialGradient := QRadialGradient_create(
|
||||
ALogBrush.radCenterX, ALogBrush.radCenterY, ALogBrush.radCenterY
|
||||
ALogBrush.radFocalX, ALogBrush.radFocalY);
|
||||
for i := 0 to Length(ALogBrush.radStops) - 1 do
|
||||
begin
|
||||
lR := ALogBrush.radStops[i].radColorR / $FFFF;
|
||||
lG := ALogBrush.radStops[i].radColorG / $FFFF;
|
||||
lB := ALogBrush.radStops[i].radColorB / $FFFF;
|
||||
lA := ALogBrush.radStops[i].radColorA / $FFFF;
|
||||
QColor_fromRgbF(lColor, lR, lG, lB, lA);
|
||||
QGradient_setColorAt(FRadialGradient, ALogBrush.radStops[i].radPosition, lColor);
|
||||
end;
|
||||
|
||||
FHandle := QBrush_create(FRadialGradient);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtBrush.Destroy
|
||||
Params: None
|
||||
|
@ -460,6 +460,23 @@ begin
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: CreateBrushWithRadialGradient
|
||||
Params: none
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.CreateBrushWithRadialGradient(const LogBrush: TLogRadialGradient): HBRUSH;
|
||||
var
|
||||
QtBrush: TQtBrush;
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
QtBrush := TQtBrush.CreateWithRadialGradient(LogBrush);
|
||||
Result := HBRUSH(QtBrush);
|
||||
if Result = 0 then
|
||||
DebugLn('TQtWidgetSet.CreateBrushWithRadialGradient: Failed');
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.CreateCaret(Handle: HWND; Bitmap: hBitmap; Width, Height: Integer): Boolean;
|
||||
begin
|
||||
Result := (Handle <> 0) and
|
||||
|
@ -45,6 +45,7 @@ function ClipboardRegisterFormat(const AMimeType: string): TClipboardFormat; ove
|
||||
function CombineRgn(Dest, Src1, Src2: HRGN; fnCombineMode: Longint): Longint; override;
|
||||
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; override;
|
||||
function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
|
||||
function CreateBrushWithRadialGradient(const LogBrush: TLogRadialGradient): HBRUSH; override;
|
||||
function CreateCaret(Handle : HWND; Bitmap : hBitmap; Width, Height : Integer) : Boolean; override;
|
||||
function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; override;
|
||||
function CreateCompatibleDC(DC: HDC): HDC; override;
|
||||
|
@ -2320,6 +2320,15 @@ type
|
||||
TLogBrush = tagLOGBRUSH;
|
||||
LOGBRUSH = tagLOGBRUSH;
|
||||
|
||||
// non-winapi radial gradient log info
|
||||
TLogGradientStop = record
|
||||
radColorR, radColorG, radColorB, radColorA: Word;
|
||||
radPosition: Double; // must be in 0..1
|
||||
end;
|
||||
TLogRadialGradient = record
|
||||
radCenterX, radCenterY, radRadius, radFocalX, radFocalY: Integer;
|
||||
radStops: array of TLogGradientStop;
|
||||
end;
|
||||
|
||||
PMaxLogPalette = ^TMaxLogPalette; // not in Windows Headers
|
||||
TMaxLogPalette = record
|
||||
|
Loading…
Reference in New Issue
Block a user