acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
solaris_graphics.h
1#pragma once
2
3
4// Ubuntu apt-get install libx11-dev
7// Ubuntu apt-get install libcairo2-dev
8
9#include "solaris_cross_win_gdi.h"
10
11//#include "graphics/draw2d_xlib/draw2d_xlib.h"
12
13
14
15void set(XColor & color, color32_t color32);
16
17
18
19
20
21/*
22Hi,
23if you want to make a argb window using xlib/Qt here is the code i use
25/*#include <X11/extensions/Xrender.h>
26#include <X11/Xlib.h>
27
29/*Display *dpy = XOpenxDisplay ( 0 ); // open default display
30 if ( !dpy ) {
31 qWarning ( "Cannot connect to the X server" );
32 //exit ( 1 );
33 }
34
36/* bool argbVisual=false;
37 ::i32 screen = DefaultScreen ( dpy );
38 Colormap colormap = 0;
39 Visual *draw2d = 0;
40 ::i32 eventBase, errorBase;
41
42 if ( XRenderQueryExtension ( dpy, &eventBase, &errorBase ) ) {
43 qWarning ("You have argb support");
44 ::i32 nvi;
45 XVisualInfo templ;
46 templ.screen = screen;
47 templ.depth = 32;
48 templ.c_class = TrueColor;
49 XVisualInfo *xvi = XGetVisualInfo ( dpy, VisualScreenMask |
50 VisualDepthMask |
51 VisualClassMask, &templ, &nvi );
52
53 for ( ::i32 i = 0; i < nvi; ++i ) {
54 XRenderPictFormat *format = XRenderFindVisualFormat ( dpy,
55 xvi[i].draw2d );
56 if ( format->type == PictTypeDirect && format->direct.alphaMask
57) {
58 draw2d = xvi[i].draw2d;
59 colormap = XCreateColormap ( dpy, RootWindow ( dpy, screen
60),
61 draw2d, AllocNone );
62 argbVisual=true;
63 break;
64 }
65 }
66 }
68
69
70
71
72
73
74void set(XColor & color, color32_t color32);
75
76
77
78
79
80/*
81Hi,
82if you want to make a argb window using xlib/Qt here is the code i use
84/*#include <X11/extensions/Xrender.h>
85#include <X11/Xlib.h>
86
88/*Display *dpy = XOpenxDisplay ( 0 ); // open default display
89 if ( !dpy ) {
90 qWarning ( "Cannot connect to the X server" );
91 //exit ( 1 );
92 }
93
95/* bool argbVisual=false;
96 ::i32 screen = DefaultScreen ( dpy );
97 Colormap colormap = 0;
98 Visual *draw2d = 0;
99 ::i32 eventBase, errorBase;
100
101 if ( XRenderQueryExtension ( dpy, &eventBase, &errorBase ) ) {
102 qWarning ("You have argb support");
103 ::i32 nvi;
104 XVisualInfo templ;
105 templ.screen = screen;
106 templ.depth = 32;
107 templ.c_class = TrueColor;
108 XVisualInfo *xvi = XGetVisualInfo ( dpy, VisualScreenMask |
109 VisualDepthMask |
110 VisualClassMask, &templ, &nvi );
111
112 for ( ::i32 i = 0; i < nvi; ++i ) {
113 XRenderPictFormat *format = XRenderFindVisualFormat ( dpy,
114 xvi[i].draw2d );
115 if ( format->type == PictTypeDirect && format->direct.alphaMask
116) {
117 draw2d = xvi[i].draw2d;
118 colormap = XCreateColormap ( dpy, RootWindow ( dpy, screen
119),
120 draw2d, AllocNone );
121 argbVisual=true;
122 break;
123 }
124 }
125 }
127
128
129
130
Definition color32.h:12