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
= malloc(sizeof(WMPixmap
));
43 pixPtr
->screen
= scrPtr
;
44 pixPtr
->width
= width
;
45 pixPtr
->height
= height
;
46 pixPtr
->depth
= depth
;
49 pixPtr
->pixmap
= XCreatePixmap(scrPtr
->display
, W_DRAWABLE(scrPtr
),
50 width
, height
, depth
);
52 pixPtr
->mask
= XCreatePixmap(scrPtr
->display
, W_DRAWABLE(scrPtr
),
63 WMCreatePixmapFromXPixmaps(WMScreen
*scrPtr
, Pixmap pixmap
, Pixmap mask
,
64 int width
, int height
, int depth
)
68 pixPtr
= malloc(sizeof(WMPixmap
));
72 pixPtr
->screen
= scrPtr
;
73 pixPtr
->pixmap
= pixmap
;
75 pixPtr
->width
= width
;
76 pixPtr
->height
= height
;
77 pixPtr
->depth
= depth
;
87 WMCreatePixmapFromFile(WMScreen
*scrPtr
, char *fileName
)
92 image
= RLoadImage(scrPtr
->rcontext
, fileName
, 0);
96 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 127);
105 WMCreatePixmapFromRImage(WMScreen
*scrPtr
, RImage
*image
, int threshold
)
110 if (!RConvertImageMask(scrPtr
->rcontext
, image
, &pixmap
, &mask
,
115 pixPtr
= malloc(sizeof(WMPixmap
));
119 pixPtr
->screen
= scrPtr
;
120 pixPtr
->pixmap
= pixmap
;
122 pixPtr
->width
= image
->width
;
123 pixPtr
->height
= image
->height
;
124 pixPtr
->depth
= scrPtr
->depth
;
125 pixPtr
->refCount
= 1;
132 WMCreateBlendedPixmapFromFile(WMScreen
*scrPtr
, char *fileName
, RColor
*color
)
138 image
= RLoadImage(scrPtr
->rcontext
, fileName
, 0);
142 RCombineImageWithColor(image
, color
);
144 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 0);
146 RDestroyImage(image
);
153 WMCreatePixmapFromXPMData(WMScreen
*scrPtr
, char **data
)
158 image
= RGetImageFromXPMData(scrPtr
->rcontext
, data
);
162 pixPtr
= WMCreatePixmapFromRImage(scrPtr
, image
, 127);
164 RDestroyImage(image
);
171 WMGetPixmapXID(WMPixmap
*pixmap
)
173 wassertrv(pixmap
!= NULL
, None
);
175 return pixmap
->pixmap
;
180 WMGetPixmapMaskXID(WMPixmap
*pixmap
)
182 wassertrv(pixmap
!= NULL
, None
);
189 WMGetPixmapSize(WMPixmap
*pixmap
)
193 wassertrv(pixmap
!= NULL
, size
);
195 size
.width
= pixmap
->width
;
196 size
.height
= pixmap
->height
;
203 WMGetSystemPixmap(WMScreen
*scr
, int image
)
207 return WMRetainPixmap(scr
->buttonArrow
);
209 case WSIHighlightedReturnArrow
:
210 return WMRetainPixmap(scr
->pushedButtonArrow
);
212 case WSIScrollerDimple
:
213 return WMRetainPixmap(scr
->scrollerDimple
);
216 return WMRetainPixmap(scr
->leftArrow
);
218 case WSIHighlightedArrowLeft
:
219 return WMRetainPixmap(scr
->hiLeftArrow
);
222 return WMRetainPixmap(scr
->rightArrow
);
224 case WSIHighlightedArrowRight
:
225 return WMRetainPixmap(scr
->hiRightArrow
);
228 return WMRetainPixmap(scr
->upArrow
);
230 case WSIHighlightedArrowUp
:
231 return WMRetainPixmap(scr
->hiUpArrow
);
234 return WMRetainPixmap(scr
->downArrow
);
236 case WSIHighlightedArrowDown
:
237 return WMRetainPixmap(scr
->hiDownArrow
);
240 return WMRetainPixmap(scr
->checkMark
);
250 WMDrawPixmap(WMPixmap
*pixmap
, Drawable d
, int x
, int y
)
252 WMScreen
*scr
= pixmap
->screen
;
254 XSetClipMask(scr
->display
, scr
->clipGC
, pixmap
->mask
);
255 XSetClipOrigin(scr
->display
, scr
->clipGC
, x
, y
);
257 XCopyArea(scr
->display
, pixmap
->pixmap
, d
, scr
->clipGC
, 0, 0,
258 pixmap
->width
, pixmap
->height
, x
, y
);