8 WMRetainPixmap(WMPixmap
*pixmap
)
18 WMReleasePixmap(WMPixmap
*pixmap
)
20 wassertr(pixmap
!=NULL
);
24 if (pixmap
->refCount
<1) {
26 XFreePixmap(pixmap
->screen
->display
, pixmap
->pixmap
);
28 XFreePixmap(pixmap
->screen
->display
, pixmap
->mask
);
35 WMCreatePixmap(WMScreen
*scrPtr
, int width
, int height
, int depth
, Bool masked
)
39 pixPtr
= wmalloc(sizeof(WMPixmap
));
40 pixPtr
->screen
= scrPtr
;
41 pixPtr
->width
= width
;
42 pixPtr
->height
= height
;
43 pixPtr
->depth
= depth
;
46 pixPtr
->pixmap
= XCreatePixmap(scrPtr
->display
, W_DRAWABLE(scrPtr
),
47 width
, height
, depth
);
49 pixPtr
->mask
= XCreatePixmap(scrPtr
->display
, W_DRAWABLE(scrPtr
),
60 WMCreatePixmapFromXPixmaps(WMScreen
*scrPtr
, Pixmap pixmap
, Pixmap mask
,
61 int width
, int height
, int depth
)
65 pixPtr
= wmalloc(sizeof(WMPixmap
));
66 pixPtr
->screen
= scrPtr
;
67 pixPtr
->pixmap
= pixmap
;
69 pixPtr
->width
= width
;
70 pixPtr
->height
= height
;
71 pixPtr
->depth
= depth
;
79 WMCreatePixmapFromFile(WMScreen
*scrPtr
, char *fileName
)
84 image
= RLoadImage(scrPtr
->rcontext
, fileName
, 0);
88 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 127);
97 WMCreatePixmapFromRImage(WMScreen
*scrPtr
, RImage
*image
, int threshold
)
102 if (!RConvertImageMask(scrPtr
->rcontext
, image
, &pixmap
, &mask
,
107 pixPtr
= wmalloc(sizeof(WMPixmap
));
108 pixPtr
->screen
= scrPtr
;
109 pixPtr
->pixmap
= pixmap
;
111 pixPtr
->width
= image
->width
;
112 pixPtr
->height
= image
->height
;
113 pixPtr
->depth
= scrPtr
->depth
;
114 pixPtr
->refCount
= 1;
121 WMCreateBlendedPixmapFromRImage(WMScreen
*scrPtr
, RImage
*image
, RColor
*color
)
126 copy
= RCloneImage(image
);
130 RCombineImageWithColor(copy
, color
);
131 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, copy
, 0);
139 WMCreateBlendedPixmapFromFile(WMScreen
*scrPtr
, char *fileName
, RColor
*color
)
145 image
= RLoadImage(scrPtr
->rcontext
, fileName
, 0);
149 RCombineImageWithColor(image
, color
);
151 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 0);
153 RReleaseImage(image
);
160 WMCreatePixmapFromXPMData(WMScreen
*scrPtr
, char **data
)
165 image
= RGetImageFromXPMData(scrPtr
->rcontext
, data
);
169 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 127);
171 RReleaseImage(image
);
178 WMGetPixmapXID(WMPixmap
*pixmap
)
180 wassertrv(pixmap
!= NULL
, None
);
182 return pixmap
->pixmap
;
187 WMGetPixmapMaskXID(WMPixmap
*pixmap
)
189 wassertrv(pixmap
!= NULL
, None
);
196 WMGetPixmapSize(WMPixmap
*pixmap
)
200 wassertrv(pixmap
!= NULL
, size
);
202 size
.width
= pixmap
->width
;
203 size
.height
= pixmap
->height
;
210 WMGetSystemPixmap(WMScreen
*scr
, int image
)
214 return WMRetainPixmap(scr
->buttonArrow
);
216 case WSIHighlightedReturnArrow
:
217 return WMRetainPixmap(scr
->pushedButtonArrow
);
219 case WSIScrollerDimple
:
220 return WMRetainPixmap(scr
->scrollerDimple
);
223 return WMRetainPixmap(scr
->leftArrow
);
225 case WSIHighlightedArrowLeft
:
226 return WMRetainPixmap(scr
->hiLeftArrow
);
229 return WMRetainPixmap(scr
->rightArrow
);
231 case WSIHighlightedArrowRight
:
232 return WMRetainPixmap(scr
->hiRightArrow
);
235 return WMRetainPixmap(scr
->upArrow
);
237 case WSIHighlightedArrowUp
:
238 return WMRetainPixmap(scr
->hiUpArrow
);
241 return WMRetainPixmap(scr
->downArrow
);
243 case WSIHighlightedArrowDown
:
244 return WMRetainPixmap(scr
->hiDownArrow
);
247 return WMRetainPixmap(scr
->checkMark
);
257 WMDrawPixmap(WMPixmap
*pixmap
, Drawable d
, int x
, int y
)
259 WMScreen
*scr
= pixmap
->screen
;
261 XSetClipMask(scr
->display
, scr
->clipGC
, pixmap
->mask
);
262 XSetClipOrigin(scr
->display
, scr
->clipGC
, x
, y
);
264 XCopyArea(scr
->display
, pixmap
->pixmap
, d
, scr
->clipGC
, 0, 0,
265 pixmap
->width
, pixmap
->height
, x
, y
);