summaryrefslogtreecommitdiff
path: root/gfx/x11
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@users.sourceforge.net>2006-12-06 23:16:34 +0000
committerGraeme Geldenhuys <graemeg@users.sourceforge.net>2006-12-06 23:16:34 +0000
commitc91eebac7b6d141d2da3114537942850accccab8 (patch)
tree74b6f30b9ec5ae7d428d142206d3663008673ab1 /gfx/x11
parent1ef11a6d9353b976aa51856b1909f28f8750670b (diff)
downloadfpGUI-c91eebac7b6d141d2da3114537942850accccab8.tar.xz
* Added CreateBitmapCanvas and CreateMonoBitmapCanvas to TFCustomScreen class.
This is required for Styles to work. It could maybe be moved to another class if needed. * Create the missing instances for ImageCanvas, MaskCanvas and Palette in TDefaultStyle. * Removed the ADisplay parameter from the TStyle constructor. * Adapted the UTF Demo to work with the fpGUI changes. Tested under Linux only.
Diffstat (limited to 'gfx/x11')
-rw-r--r--gfx/x11/gfx_x11.pas46
1 files changed, 43 insertions, 3 deletions
diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas
index f6f1ef38..c87d1eb1 100644
--- a/gfx/x11/gfx_x11.pas
+++ b/gfx/x11/gfx_x11.pas
@@ -172,6 +172,8 @@ type
function GetMousePos: TPoint; override;
public
constructor Create; override;
+ function CreateBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; override;
+ function CreateMonoBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; override;
property ScreenIndex: Integer read FScreenIndex;
property ScreenInfo: PScreen read FScreenInfo;
end;
@@ -905,9 +907,47 @@ end;
constructor TX11Screen.Create;
begin
inherited Create;
-
-// FScreenIndex := AScreenIndex;
-// FScreenInfo := XScreenOfDisplay(gApplication.Handle, ScreenIndex);
+ FScreenIndex := 0;
+ FScreenInfo := XScreenOfDisplay(GFApplication.Handle, ScreenIndex);
+end;
+
+function TX11Screen.CreateBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas;
+var
+ Depth: Integer;
+ PixelFormat: TGfxPixelFormat;
+begin
+ Depth := XDefaultDepthOfScreen(ScreenInfo);
+ case Depth of
+ 1: PixelFormat.FormatType := ftMono;
+ 4: PixelFormat.FormatType := ftPal4;
+ 8: PixelFormat.FormatType := ftPal8;
+ 16: PixelFormat.FormatType := ftRGB16;
+ 24: PixelFormat.FormatType := ftRGB24;
+ 32: PixelFormat.FormatType := ftRGB32;
+ else
+ raise EX11Error.CreateFmt(SWindowUnsupportedPixelFormat, [Depth]);
+ end;
+
+ if Depth >= 16 then
+ with XDefaultVisualOfScreen(ScreenInfo)^ do
+ begin
+ PixelFormat.RedMask := red_mask;
+ PixelFormat.GreenMask := green_mask;
+ PixelFormat.BlueMask := blue_mask;
+ end;
+
+ Result := TX11PixmapCanvas.Create(
+ XDefaultColormapOfScreen(ScreenInfo),
+ XCreatePixmap(GFApplication.Handle, XRootWindowOfScreen(ScreenInfo), AWidth, AHeight, Depth),
+ PixelFormat);
+end;
+
+function TX11Screen.CreateMonoBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas;
+begin
+ Result := TX11MonoPixmapCanvas.Create(
+ XDefaultColormap(GFApplication.Handle, ScreenIndex),
+ XCreatePixmap(GFApplication.Handle, XRootWindowOfScreen(ScreenInfo),
+ AWidth, AHeight, 1));
end;