static void ImagestateDrawNoImg(ImageState * is, EX_Drawable draw, int x, int y, int w, int h) { ImagestateColorsAlloc(is); EXFillAreaSolid(draw, x, y, w, h, is->bg_pixel); if (is->bevelstyle != BEVEL_NONE) ImagestateDrawBevel(is, draw, x, y, w, h); }
static void ImagestateDrawNoImg(ImageState * is, Drawable draw, int x, int y, int w, int h) { GC gc; ImagestateColorsAlloc(is); gc = EXCreateGC(draw, 0, NULL); XSetFillStyle(disp, gc, FillSolid); XSetForeground(disp, gc, is->bg_pixel); XFillRectangle(disp, draw, gc, x, y, w, h); if (is->bevelstyle != BEVEL_NONE) ImagestateDrawBevel(is, draw, gc, x, y, w, h); EXFreeGC(gc); }
void ITApply(Win win, ImageClass * ic, ImageState * is, int state, int active, int sticky, int image_type, TextClass * tc, TextState * ts, const char *text, int flags) { int w, h; if (!win || !ic) return; w = WinGetW(win); h = WinGetH(win); if (w <= 0 || h <= 0) return; if (!is) is = ImageclassGetImageState(ic, state, active, sticky); if (!is) return; if (tc && text) { if (!ts) ts = TextclassGetTextState(tc, state, active, sticky); } if (!is->im) ImagestateRealize(is); /* Imlib2 will not render pixmaps with dimensions > 8192 */ if (is->im && w <= 8192 && h <= 8192) { PmapMask pmm; ImagestateMakePmapMask(is, win, &pmm, IC_FLAG_MAKE_MASK, w, h, image_type); if (pmm.pmap) { Pixmap pmap = pmm.pmap; if ((ts && text) || (is->bevelstyle != BEVEL_NONE) || (flags & ITA_BGPMAP)) { if (pmm.type != 0) { pmap = EGetWindowBackgroundPixmap(win); EXCopyAreaTiled(pmm.pmap, None, pmap, 0, 0, w, h, 0, 0); } if (is->bevelstyle != BEVEL_NONE) { GC gc; gc = EXCreateGC(WinGetXwin(win), 0, NULL); ImagestateDrawBevel(is, pmap, gc, 0, 0, w, h); EXFreeGC(gc); } if (ts && text) TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h, &(ic->padding), 0, TextclassGetJustification(tc), flags & ITA_JUSTV); } /* Set window pixmap */ if (pmap == pmm.pmap) { ESetWindowBackgroundPixmap(win, pmap); EFreeWindowBackgroundPixmap(win); } if (pmm.w == w && pmm.h == h) EShapeSetMask(win, 0, 0, pmm.mask); else if (pmm.mask) EShapeSetMaskTiled(win, 0, 0, pmm.mask, w, h); } PmapMaskFree(&pmm); if ((is->unloadable) || (Conf.memory_paranoia)) { EImageFree(is->im); is->im = NULL; } } else { ImagestateColorsAlloc(is); if (is->bevelstyle == BEVEL_NONE && !text) { ESetWindowBackground(win, is->bg_pixel); } else { Pixmap pmap; pmap = EGetWindowBackgroundPixmap(win); ImagestateDrawNoImg(is, pmap, 0, 0, w, h); if (ts && text) TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h, &(ic->padding), 0, TextclassGetJustification(tc), flags & ITA_JUSTV); } } EClearWindow(win); }