8
static Pixmap createPixmap(int w, int h, int depth) {
9
return XCreatePixmap(xapp->display(), desktop->handle(), w, h, depth);
12
static Pixmap createPixmap(int w, int h) {
13
return createPixmap(w, h, xapp->depth());
16
static Pixmap createMask(int w, int h) {
17
return XCreatePixmap(xapp->display(), desktop->handle(), w, h, 1);
20
void YPixmap::replicate(bool horiz, bool copyMask) {
21
if (this == NULL || pixmap() == None || (fMask == None && copyMask))
24
int dim(horiz ? width() : height());
25
if (dim >= 128) return;
26
dim = 128 + dim - 128 % dim;
28
Pixmap nPixmap(horiz ? createPixmap(dim, height())
29
: createPixmap(width(), dim));
30
Pixmap nMask(copyMask ? (horiz ? createMask(dim, height())
31
: createMask(width(), dim)) : None);
34
Graphics(nPixmap, dim, height()).repHorz(fPixmap, width(), height(), 0, 0, dim);
36
Graphics(nPixmap, width(), dim).repVert(fPixmap, width(), height(), 0, 0, dim);
40
Graphics(nMask, dim, height()).repHorz(fMask, width(), height(), 0, 0, dim);
42
Graphics(nMask, width(), dim).repVert(fMask, width(), height(), 0, 0, dim);
53
XFreePixmap(xapp->display(), fPixmap);
55
XFreePixmap(xapp->display(), fMask);
61
(horiz ? fWidth : fHeight) = dim;
65
if (fPixmap != None) {
67
XFreePixmap(xapp->display(), fPixmap);
72
XFreePixmap(xapp->display(), fMask);
78
ref<YPixmap> YPixmap::scale(ref<YPixmap> source, int const w, int const h) {
85
ref<YPixmap> YPixmap::scale(int const w, int const h) {
88
ref<YImage> image = YImage::createFromPixmap(pixmap);
90
image = image->scale(w, h);
92
pixmap = YPixmap::createFromImage(image);
97
ref<YPixmap> YPixmap::create(int w, int h, bool useMask) {
100
Pixmap pixmap = createPixmap(w, h);
101
Pixmap mask = useMask ? createMask(w, h) : None;
102
if (pixmap != None && (!useMask || mask != None))
104
n.init(new YPixmap(pixmap, mask, w, h));
108
ref<YPixmap> YPixmap::createFromImage(ref<YImage> image) {
109
return image->renderToPixmap();
112
ref<YPixmap> YPixmap::createFromPixmapAndMask(Pixmap pixmap,
119
ref<YPixmap> YPixmap::createFromPixmapAndMaskScaled(Pixmap pix, Pixmap mask,
120
int width, int height,
125
YImage::createFromPixmapAndMaskScaled(pix, mask,
126
width, height, nw, nh);
128
ref<YPixmap> pixmap =
129
YPixmap::createFromImage(image);
136
ref<YPixmap> YPixmap::load(upath filename) {
137
ref<YImage> image = YImage::load(filename);
140
pixmap = YPixmap::createFromImage(image);