8 WMRetainPixmap(WMPixmap
*pixmap
)
18 WMReleasePixmap(WMPixmap
*pixmap
)
20 wassertr(pixmap
!=NULL
);
24 if (pixmap
->refCount
<1) {
25 XFreePixmap(pixmap
->screen
->display
, pixmap
->pixmap
);
27 XFreePixmap(pixmap
->screen
->display
, pixmap
->mask
);
34 WMCreatePixmap(WMScreen
*scrPtr
, int width
, int height
, int depth
, Bool masked
)
38 pixPtr
= malloc(sizeof(WMPixmap
));
42 pixPtr
->screen
= scrPtr
;
43 pixPtr
->width
= width
;
44 pixPtr
->height
= height
;
45 pixPtr
->depth
= depth
;
48 pixPtr
->pixmap
= XCreatePixmap(scrPtr
->display
, W_DRAWABLE(scrPtr
),
49 width
, height
, depth
);
51 pixPtr
->mask
= XCreatePixmap(scrPtr
->display
, W_DRAWABLE(scrPtr
),
62 WMCreatePixmapFromXPixmaps(WMScreen
*scrPtr
, Pixmap pixmap
, Pixmap mask
,
63 int width
, int height
, int depth
)
67 pixPtr
= malloc(sizeof(WMPixmap
));
71 pixPtr
->screen
= scrPtr
;
72 pixPtr
->pixmap
= pixmap
;
74 pixPtr
->width
= width
;
75 pixPtr
->height
= height
;
76 pixPtr
->depth
= depth
;
86 WMCreatePixmapFromFile(WMScreen
*scrPtr
, char *fileName
)
91 image
= RLoadImage(scrPtr
->rcontext
, fileName
, 0);
95 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 127);
104 WMCreatePixmapFromRImage(WMScreen
*scrPtr
, RImage
*image
, int threshold
)
109 if (!RConvertImageMask(scrPtr
->rcontext
, image
, &pixmap
, &mask
,
114 pixPtr
= malloc(sizeof(WMPixmap
));
118 pixPtr
->screen
= scrPtr
;
119 pixPtr
->pixmap
= pixmap
;
121 pixPtr
->width
= image
->width
;
122 pixPtr
->height
= image
->height
;
123 pixPtr
->depth
= scrPtr
->depth
;
124 pixPtr
->refCount
= 1;
131 WMCreateBlendedPixmapFromFile(WMScreen
*scrPtr
, char *fileName
, RColor
*color
)
137 image
= RLoadImage(scrPtr
->rcontext
, fileName
, 0);
141 RCombineImageWithColor(image
, color
);
143 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 0);
145 RDestroyImage(image
);
152 WMCreatePixmapFromXPMData(WMScreen
*scrPtr
, char **data
)
157 image
= RGetImageFromXPMData(scrPtr
->rcontext
, data
);
161 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 127);
163 RDestroyImage(image
);
170 WMGetPixmapXID(WMPixmap
*pixmap
)
172 wassertrv(pixmap
!= NULL
, None
);
174 return pixmap
->pixmap
;
179 WMGetPixmapMaskXID(WMPixmap
*pixmap
)
181 wassertrv(pixmap
!= NULL
, None
);
188 WMGetPixmapSize(WMPixmap
*pixmap
)
192 wassertrv(pixmap
!= NULL
, size
);
194 size
.width
= pixmap
->width
;
195 size
.height
= pixmap
->height
;
202 WMGetSystemPixmap(WMScreen
*scr
, int image
)
206 return WMRetainPixmap(scr
->buttonArrow
);
208 case WSIHighlightedReturnArrow
:
209 return WMRetainPixmap(scr
->pushedButtonArrow
);
211 case WSIScrollerDimple
:
212 return WMRetainPixmap(scr
->scrollerDimple
);
215 return WMRetainPixmap(scr
->leftArrow
);
217 case WSIHighlightedArrowLeft
:
218 return WMRetainPixmap(scr
->hiLeftArrow
);
221 return WMRetainPixmap(scr
->rightArrow
);
223 case WSIHighlightedArrowRight
:
224 return WMRetainPixmap(scr
->hiRightArrow
);
227 return WMRetainPixmap(scr
->upArrow
);
229 case WSIHighlightedArrowUp
:
230 return WMRetainPixmap(scr
->hiUpArrow
);
233 return WMRetainPixmap(scr
->downArrow
);
235 case WSIHighlightedArrowDown
:
236 return WMRetainPixmap(scr
->hiDownArrow
);
239 return WMRetainPixmap(scr
->checkMark
);
249 WMDrawPixmap(WMPixmap
*pixmap
, Drawable d
, int x
, int y
)
251 WMScreen
*scr
= pixmap
->screen
;
253 XSetClipMask(scr
->display
, scr
->clipGC
, pixmap
->mask
);
254 XSetClipOrigin(scr
->display
, scr
->clipGC
, x
, y
);
256 XCopyArea(scr
->display
, pixmap
->pixmap
, d
, scr
->clipGC
, 0, 0,
257 pixmap
->width
, pixmap
->height
, x
, y
);