From b3dbb6e552d0d49fcd23759ebc673f920ddc7d28 Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 19 Jun 2011 06:47:30 +0000 Subject: [PATCH] LCL Win: Call Windows FillRgn and SetStretchBltMode from cross-platform code. Patch from Bernd Gabriel git-svn-id: trunk@31277 - --- lcl/interfaces/win32/win32winapi.inc | 31 +++++++++++++++++++++++++++ lcl/interfaces/win32/win32winapih.inc | 2 ++ 2 files changed, 33 insertions(+) diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index c9d021b1f5..0e8c5c9b19 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -1435,6 +1435,24 @@ begin Result := Boolean(Windows.FillRect(DC, Windows.RECT(R), Brush)); end; +{------------------------------------------------------------------------------ + Method: FillRgn + Params: DC - handle to device context + RegionHnd - handle to region + Brush - handle to brush + Returns: If the function succeeds + + The FillRgn function fills a region by using the specified brush. + ------------------------------------------------------------------------------} +function TWin32WidgetSet.FillRgn(DC: HDC; RegionHnd: HRGN; hbr: HBRUSH): BOOL; +var + OldBrush: HGDIOBJ; +begin + OldBrush := Windows.SelectObject(DC, hbr); + Result := {Boolean}(Windows.FillRgn(DC, RegionHnd, hbr)); + Windows.SelectObject(DC, OldBrush); +end; + function TWin32WidgetSet.FloodFill(DC: HDC; X, Y: Integer; Color: TGraphicsColor; FillStyle: TGraphicsFillStyle; Brush: HBRUSH): Boolean; const @@ -3126,6 +3144,19 @@ begin Result := Windows.SetScrollInfo(Handle, SBStyle, @ScrollInfo, BRedraw); end; +{------------------------------------------------------------------------------ + Method: SetStretchBltMode + Params: DC - handle of device context + StretchMode - strech mode + Returns: 0 if unsuccesful + + The SetStretchBltMode function sets the StrechBlt mode. + ------------------------------------------------------------------------------} +function TWin32WidgetSet.SetStretchBltMode(DC: HDC; StretchMode: Integer): Integer; +begin + Result := Windows.SetStretchBltMode(DC, StretchMode); +end; + {------------------------------------------------------------------------------ Method: SetSysColors Params: CElements - the number of elements diff --git a/lcl/interfaces/win32/win32winapih.inc b/lcl/interfaces/win32/win32winapih.inc index b0e8f588a2..13d08f12a4 100644 --- a/lcl/interfaces/win32/win32winapih.inc +++ b/lcl/interfaces/win32/win32winapih.inc @@ -86,6 +86,7 @@ function ExtTextOut(DC: HDC; X, Y: Integer; Options: LongInt; Rect: PRect; Str: function ExtSelectClipRGN(dc: hdc; rgn : hrgn; Mode : Longint) : Integer; override; function FillRect(DC: HDC; Const Rect: TRect; Brush: HBRUSH): Boolean; override; +function FillRgn(DC: HDC; RegionHnd: HRGN; hbr: HBRUSH): BOOL; override; function FloodFill(DC: HDC; X, Y: Integer; Color: TGraphicsColor; FillStyle: TGraphicsFillStyle; Brush: HBRUSH): Boolean; override; { Draws a 3D border in GTK native style. } function Frame3D(DC: HDC; var ARect: TRect; Const FrameWidth: Integer; Const Style: TBevelCut): Boolean; override; @@ -210,6 +211,7 @@ function SetParent(hWndChild: HWND; hWndParent: HWND): HWND; override; function SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; override; function SetROP2(DC: HDC; Mode: Integer): Integer; override; function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; override; +function SetStretchBltMode(DC: HDC; StretchMode: Integer): Integer; override; function SetSysColors(CElements: Integer; Const LPAElements; Const LPARgbValues): Boolean; override; function SetTextCharacterExtra(_HDC: HDC; NCharExtra: Integer): Integer; override; function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;