コード例 #1
0
ファイル: XImlib2Image.cpp プロジェクト: fixxxer/idesk
void XImlib2Image::repaint()
{
    XDesktopContainer * xContainer =
	dynamic_cast<XDesktopContainer *>(container);
    
    Imlib_Image cropImage = xContainer->bg->createCropImage(x, y, width, height, width, height);
    
    imlib_context_set_dither(1);

    imlib_context_set_blend(1);       //automatically blend image and background
    imlib_context_set_dither_mask(0);
    imlib_context_set_image(cropImage);
    imlib_blend_image_onto_image(image, 1, 0, 0, width, height, 0, 0, width, height);
    
    imlib_image_set_has_alpha(1);
    
    imlib_context_set_anti_alias(1);  //smoother scaling
    imlib_context_set_blend(0);    
    
    imlib_context_set_drawable(window);
    imlib_render_image_on_drawable_at_size(0, 0, width, height);
    
    imlib_free_image();
    imlib_context_set_drawable(xContainer->getRootWindow());
}
コード例 #2
0
ファイル: render.c プロジェクト: carriercomm/bmpanel
static void update_bg()
{
	if (currootpmap != *rootpmap && *rootpmap != 0) {
		currootpmap = *rootpmap;
		imlib_context_set_drawable(currootpmap);
		if (bg) {
			imlib_context_set_image(bg);
			imlib_free_image();
		}
		bg = imlib_create_image_from_drawable(0, bbx, bby, bbwidth, bbheight, 1);

		Pixmap tile, mask;
		imlib_context_set_display(bbdpy);
		imlib_context_set_visual(bbvis);
		imlib_context_set_drawable(bbwin);
		imlib_context_set_image(bg);
		
		Imlib_Image tmpbg = imlib_clone_image();
		tile_image_blend(tmpbg, theme->tile_img, 0, bbwidth);
		imlib_render_pixmaps_for_whole_image(&tile, &mask);
		XSetWindowBackgroundPixmap(bbdpy, bbwin, tile);
		imlib_free_pixmap_and_mask(tile);
		imlib_free_image();
	}
}
コード例 #3
0
ファイル: render.c プロジェクト: carriercomm/bmpanel
void render_present()
{
	update_bg();
#ifdef WITH_COMPOSITE
	if (theme->use_composite) {
		/* 
		 * Because XRender can't do directly SRCc * SRCa + DSTc * (1 - SRCa) blending,
		 * I must apply SRCa to my SRCc manually. To do this I'm using PictOpSrc with 
		 * alpha channel in mask. So, I need to copy RGB data to one buffer (color) and 
		 * Alpha to another buffer (mask), then use them in XRenderComposite.
		 *
		 * But I think in can be done on theme loading stage. Just apply SRCa to SRCc 
		 * immediately. Optimization?
		 */

		/* copy color part to bbcolor */
		imlib_context_set_image(bbcolor);
		imlib_image_set_has_alpha(1);
		imlib_context_set_color(0,0,0,255);
		imlib_image_fill_rectangle(0,0,bbwidth,bbheight);
		imlib_blend_image_onto_image(bb,0,0,0,bbwidth,bbheight,0,0,bbwidth,bbheight);
		imlib_context_set_drawable(pixcolor);
		imlib_render_image_on_drawable(0,0);

		/* copy alpha part to bbalpha */
		imlib_context_set_image(bbalpha);
		imlib_image_copy_alpha_to_image(bb,0,0);
		imlib_image_set_has_alpha(1);
		imlib_context_set_drawable(pixalpha);
		imlib_render_image_on_drawable(0,0);

		XRenderComposite(bbdpy,
				 PictOpSrc,
				 piccolor,
				 picalpha,
				 rootpic,
				 0, 0, 0, 0, 0, 0, bbwidth, 
				 bbheight);
	} else 
#endif
	if (*rootpmap) {
		imlib_context_set_image(bbcolor);
		imlib_blend_image_onto_image(bg,0,0,0,bbwidth,bbheight,0,0,bbwidth,bbheight);
		imlib_context_set_blend(1);
		imlib_blend_image_onto_image(bb,0,0,0,bbwidth,bbheight,0,0,bbwidth,bbheight);
		imlib_context_set_blend(0);

		imlib_context_set_drawable(bbwin);
		imlib_render_image_on_drawable(0,0);	
	} else {
		imlib_context_set_drawable(bbwin);
		imlib_context_set_image(bb);
		imlib_render_image_on_drawable(0,0);
	}
}
コード例 #4
0
ファイル: imgcat.c プロジェクト: TrilbyWhite/imgcat
int command_line(int argc, const char **argv) {
	if ( !(dpy=XOpenDisplay(0x0)) ) exit(1);
	scr = DefaultScreen(dpy); root = DefaultRootWindow(dpy);
	sw = DisplayWidth(dpy,scr); sh = DisplayHeight(dpy,scr);
	int i; const char *c;
	for (i = 1; i < argc; i++) {
		if (argv[i][0] != '-') break;
		if ( *(c=argv[i]+1) == '-' ) c++;
		if (*c == '\0') continue;
		if (*c == 'b') win = root;
	}
	if ( !(img=imlib_load_image(argv[i])) ) exit(2);;
	imlib_context_set_image(img);
	imlib_context_set_display(dpy);
	imlib_context_set_visual(DefaultVisual(dpy,scr));
	imlib_context_set_colormap(DefaultColormap(dpy,scr));
	iw = imlib_image_get_width();
	ih = imlib_image_get_height();
	imlib_context_set_anti_alias(0);
	imlib_context_set_dither(0);
	imlib_context_set_blend(0);
	XSetWindowAttributes wa;
	if (win == root) {
		Pixmap buf = XCreatePixmap(dpy,root,sw,sh,DefaultDepth(dpy,scr));
		imlib_context_set_drawable(buf);
		imlib_render_image_on_drawable_at_size(0, 0, sw, sh);
		wa.background_pixmap = buf;
		XSetWindowBackgroundPixmap(dpy,root,buf);
		XFlush(dpy);
		XFreePixmap(dpy,buf);
		XCloseDisplay(dpy);
		exit(0);
	}
	if (iw > mw) scale = mw / (float) iw;
	if (ih * scale > mh) scale = mh / (float) ih;
	ww = iw * scale + 0.5; wh = ih * scale + 0.5;
	wa.background_pixel = BlackPixel(dpy,scr);
	wa.event_mask = KeyPressMask | ExposureMask | StructureNotifyMask;
	win = XCreateWindow(dpy,root,0,0,ww,wh,0,DefaultDepth(dpy,scr),
			InputOutput, DefaultVisual(dpy,scr),CWEventMask|CWBackPixel,&wa);
	const char *name;
	if ( (name=strrchr(argv[i],'/')) ) name++;
	else name = argv[i];
	XStoreName(dpy,win,name);
	class.res_name = (char *) argv[0];
	class.res_class = "float";
	XSetClassHint(dpy,win,&class);
	XMapWindow(dpy,win); XFlush(dpy);
	imlib_context_set_drawable(win);
	return 0;
}
コード例 #5
0
ファイル: tag.c プロジェクト: decasm/sxiv
void tag_render_palette(tag_t * tag) {
	palette_t * pal;
	win_t * win;
	int button_x = 10, button_y = 0;
	int button_w = 0, button_h = button_height;
	
	win = tag->win;
	imlib_context_set_drawable(win->pm);
	pal = tag->palette;

	button_y = tag_bar_y;

	while ( pal ) {
		if ( tag->current_palette != -1 && tag->current_palette == pal->index) {
			tag_render_palette_mapping(tag);
			set_label_highlight();
		}
		else {
			set_label_normal();
		}
		render_button(pal->index + 0x30, pal->label, button_x, button_y, &button_w, &button_h, true);
		button_x += button_w;

		pal = pal->next;
	}
}
コード例 #6
0
ファイル: imlib2.c プロジェクト: rdebath/sgt
void image_to_pixmap(image *img, GdkPixmap *pm, int w, int h)
{
    int realw, realh;
    int need_free;

    imlib_context_set_image(img->image);
    realw = imlib_image_get_width();
    realh = imlib_image_get_height();
    if (w != realw || h != realh) {
	Imlib_Image newimg;

	newimg = imlib_create_cropped_scaled_image(0, 0, realw, realh, w, h);
	imlib_context_set_image(newimg);
	need_free = TRUE;
    } else
	need_free = FALSE;

    imlib_context_set_display(GDK_WINDOW_XDISPLAY(pm));
    imlib_context_set_visual(GDK_VISUAL_XVISUAL(gdk_visual_get_system()));
    imlib_context_set_colormap
	(GDK_COLORMAP_XCOLORMAP(gdk_colormap_get_system()));
    imlib_context_set_drawable(GDK_WINDOW_XWINDOW(pm));
    imlib_context_set_blend(1);
    imlib_render_image_on_drawable(0, 0);

    if (need_free)
	imlib_free_image();
}
コード例 #7
0
ファイル: draw.c プロジェクト: fsckoff/minimusWM
/** Draw an image in a drawable
  * \param dr Drawable
  * \param x X position
  * \param y Y position
  * \param name Path of the image
*/
static void draw_image(Drawable dr, int x, int y, int w, int h, char *name)
{
     Imlib_Image image;

     if(!name)
          return;

     imlib_set_cache_size(2048 * 1024);
     imlib_context_set_display(dpy);
     imlib_context_set_visual(DefaultVisual(dpy, DefaultScreen(dpy)));
     imlib_context_set_colormap(DefaultColormap(dpy, DefaultScreen(dpy)));
     imlib_context_set_drawable(dr);

     image = imlib_load_image(patht(name));
     imlib_context_set_image(image);

     if(w <= 0)
          w = imlib_image_get_width();

     if(h <= 0)
          h = imlib_image_get_height();

     if(image)
     {
          imlib_render_image_on_drawable_at_size(x, y, w, h);
          imlib_free_image();
     }
     else
          warnx("Can't draw image: '%s'", name);

     return;
}
コード例 #8
0
ファイル: extinitwin.c プロジェクト: Limsik/e17
static void
_eiw_render_loop(Window win, EImage * im, EiwData * d)
{
   int                 w, h;
   XRenderPictFormat  *pictfmt;
   Pixmap              pmap;
   Picture             pict;

   EImageGetSize(im, &w, &h);

   pictfmt = XRenderFindStandardFormat(disp, PictStandardARGB32);
   pmap = XCreatePixmap(disp, WinGetXwin(VROOT), w, h, 32);
   imlib_context_set_image(im);
   imlib_context_set_drawable(pmap);
   imlib_render_image_on_drawable(0, 0);
   pict = XRenderCreatePicture(disp, pmap, pictfmt, 0, 0);
   XFreePixmap(disp, pmap);

   if (d->curs != None)
      XFreeCursor(disp, d->curs);
   d->curs = XRenderCreateCursor(disp, pict, w / 2, h / 2);
   XRenderFreePicture(disp, pict);

   XDefineCursor(disp, win, d->curs);
}
コード例 #9
0
ファイル: gib_imlib.c プロジェクト: cbane/giblib
void
gib_imlib_render_image_part_on_drawable_at_size_with_rotation(Drawable d,
                                                              Imlib_Image im,
                                                              int sx, int sy,
                                                              int sw, int sh,
                                                              int dx, int dy,
                                                              int dw, int dh,
                                                              double angle,
                                                              char dither,
                                                              char blend,
                                                              char alias)
{
   Imlib_Image new_im;

   imlib_context_set_image(im);
   imlib_context_set_drawable(d);
   imlib_context_set_anti_alias(alias);
   imlib_context_set_dither(dither);
   imlib_context_set_angle(angle);
   imlib_context_set_blend(blend);
   new_im = imlib_create_rotated_image(angle);
   imlib_context_set_image(new_im);
   imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh, dx, dy, dw,
                                               dh);
   imlib_free_image_and_decache();
}
コード例 #10
0
ファイル: tinto.c プロジェクト: chigoncalves/tinto
void
tinto_take_snapshot(const char *path) {
  Panel* panel = &panel1[0];

  if (panel->area.bounds.width > server.monitor[0].width)
    panel->area.bounds.width = server.monitor[0].width;

  panel->temp_pmap = XCreatePixmap (server.dsp, server.root_win,
				    panel->area.bounds.width,
				    panel->area.bounds.height,
				    server.depth);
  rendering (panel);

  imlib_context_set_drawable (panel->temp_pmap);
  Imlib_Image img =
    imlib_create_image_from_drawable (None, 0, 0,
				      panel->area.bounds.width,
				      panel->area.bounds.height, 0);

  imlib_context_set_image (img);
  if (!panel_horizontal) {
    imlib_image_flip_horizontal ();
    imlib_image_flip_diagonal ();
  }
  imlib_save_image (path);
  imlib_free_image ();
}
コード例 #11
0
ファイル: tag.c プロジェクト: decasm/sxiv
void tag_render_palette_mapping(tag_t *tag) {
	win_t * win;
	palette_t * pal;
	keytagmap_t * ktm;
	int button_x = tag_bar_left_offset, button_y = 0;
	int button_w = 0, button_h = button_height;

	win = tag->win;
	imlib_context_set_drawable(win->pm);

	pal = tag->palette;
	while ( pal->index != tag->current_palette) {
		pal = pal->next;
		if (pal == NULL ) return;
	}
	ktm = pal->tags;

	set_label_normal();
	button_y = tag_bar_y + button_height + 1;
	while ( ktm ) {
		render_button(ktm->key, ktm->tag, button_x, button_y, &button_w, &button_h, false);
		button_x += button_w;
		ktm = ktm->next;
	}
}
コード例 #12
0
ファイル: XImlib2Caption.cpp プロジェクト: mutek/Idesk
void XImlib2Caption::draw()
{
        XDesktopContainer * xContainer =
			dynamic_cast<XDesktopContainer *>(AbstractImage::container);
	XIconWithShadow * sIcon = dynamic_cast<XIconWithShadow *>(AbstractImage::iconParent);

        Display * display = xContainer->getDisplay();
    
	int fX, fY;
    
	setXY(fX, fY);
	
	Imlib_Image cropImage = xContainer->bg->createCropImage(fX, fY, width, height, width, height);
	
	imlib_context_set_image(cropImage);
	
	imlib_context_set_drawable(window);
	imlib_render_image_on_drawable(0, 0);
	
	Pixmap shapeMask;
	imlib_render_pixmaps_for_whole_image (&pixmap, &shapeMask);
	XSetWindowBackgroundPixmap (display, window, pixmap);
	imlib_free_image();
	
	imlib_context_set_drawable(xContainer->getRootWindow());

       	imlib_context_set_image(xContainer->bg->spareRoot);
    
    // if the icon shadow is enabled and the shadow is visible underneath the
    // text window
	if (sIcon && //TODO Fix this
		   sIcon->getShadowX() > fX - sIcon->getWidth() &&
		   sIcon->getShadowY() > fY - sIcon->getHeight() &&
		   sIcon->getShadowX() < fX + sIcon->getWidth() &&
		   sIcon->getShadowY() < fY + sIcon->getHeight() )
		sIcon->renderShadowToImage(pixmap, fX, fY);

	updateText();

	XMoveWindow(display, window, fX, fY );
    
        //apply the buffer to the window
	XSetFillStyle(display, gc, FillTiled);
	XSetTile(display, gc, pixmap);
	XFillRectangle(display, window, gc, 0, 0, width, height);
	imlib_free_pixmap_and_mask(pixmap);
}
コード例 #13
0
ファイル: gib_imlib.c プロジェクト: cbane/giblib
Imlib_Image
gib_imlib_create_image_from_drawable(Drawable d, Pixmap mask, int x, int y,
                                     int width, int height,
                                     char need_to_grab_x)
{
   imlib_context_set_drawable(d);
   return imlib_create_image_from_drawable(mask, x, y, width, height,
                                           need_to_grab_x);
}
コード例 #14
0
ファイル: launcher.c プロジェクト: Dok-Sergey/tint2
void draw_launcher_icon(void *obj, cairo_t *c)
{
	LauncherIcon *launcherIcon = (LauncherIcon*)obj;

	Imlib_Image icon_scaled = launcherIcon->icon_scaled;
	// Render
	imlib_context_set_image (icon_scaled);
	imlib_context_set_blend(1);
	imlib_context_set_drawable(launcherIcon->area.pix);
	imlib_render_image_on_drawable(0, 0);
}
コード例 #15
0
ファイル: gib_imlib.c プロジェクト: cbane/giblib
void
gib_imlib_render_image_on_drawable(Drawable d, Imlib_Image im, int x, int y,
                                   char dither, char blend, char alias)
{
   imlib_context_set_image(im);
   imlib_context_set_drawable(d);
   imlib_context_set_anti_alias(alias);
   imlib_context_set_dither(dither);
   imlib_context_set_blend(blend);
   imlib_context_set_angle(0);
   imlib_render_image_on_drawable(x, y);
}
コード例 #16
0
ファイル: render.c プロジェクト: carriercomm/bmpanel
static void set_bg()
{
		Pixmap tile, mask;
		imlib_context_set_display(bbdpy);
		imlib_context_set_visual(bbvis);
		imlib_context_set_drawable(bbwin);
		
		imlib_context_set_image(theme->tile_img);
		imlib_render_pixmaps_for_whole_image(&tile, &mask);
		XSetWindowBackgroundPixmap(bbdpy, bbwin, tile);
		imlib_free_pixmap_and_mask(tile);
}
コード例 #17
0
ファイル: image.c プロジェクト: pts/pts-qiv
static void setup_imlib_for_drawable(GdkDrawable * d)
{
  imlib_context_set_dither(1); /* dither for depths < 24bpp */
  imlib_context_set_display(
    gdk_x11_drawable_get_xdisplay(d));
  imlib_context_set_visual(
    gdk_x11_visual_get_xvisual(gdk_drawable_get_visual(d)));
  imlib_context_set_colormap(
    gdk_x11_colormap_get_xcolormap(gdk_drawable_get_colormap(d)));
  imlib_context_set_drawable(
    gdk_x11_drawable_get_xid(d));
}
コード例 #18
0
ファイル: draw.c プロジェクト: lf94/Resurrection
void
Rterm_draw_screen_string_imlib2(struct R_termscreen *screen, int row, int column, int len)
{
    R_text_t *text;
    R_textflags_t *textflags;
    int bufferrow;
    int bgcolor, fgcolor;
    int textw, texth;
    struct imlib2color *color;
    Imlib_Image *textimg;

    if (screen == NULL) {

	return;
    }
    text = screen->textbuf.data[screen->viewrow + row] + column;
    textflags = screen->textbuf.renddata[screen->viewrow + row] + column;
    memcpy(screen->stringbuffer, text, len);
    screen->stringbuffer[len] = '\0';
    fprintf(stderr, "string: %s\n", screen->stringbuffer);
    fgcolor = RTERM_CHAR_FG_COLOR(*textflags);
    if (fgcolor) {
	color = &screen->im2colors[fgcolor];
    } else {
	color = &screen->im2colors[RTERM_SCREEN_FOREGROUND];
    }
#if 0
    fprintf(stderr, "red == %d, green == %d, blue == %d, alpha == %d\n",
	    color->red, color->green, color->blue, color->alpha);
#endif
    imlib_context_set_font(screen->im2font);
    imlib_context_set_color(color->red, color->green, color->blue,
			    color->alpha);
    imlib_context_set_drawable(screen->buf);
    imlib_get_text_size(screen->stringbuffer,
                        &textw, &texth);
    textimg = imlib_create_image(textw, texth);
    imlib_context_set_image(textimg);
    imlib_image_clear();
    imlib_image_set_has_alpha(1);
    imlib_context_set_blend(0);
    imlib_context_set_anti_alias(0);
    imlib_text_draw(0,
                    0,
		    screen->stringbuffer);
    imlib_render_image_on_drawable(Rterm_screen_column_x(screen, column),
                                   Rterm_screen_row_y(screen, column));
    imlib_free_image();

    return;
}
コード例 #19
0
ファイル: imlib2.c プロジェクト: lf94/Resurrection
struct R_image *
image_clone_imlib2(Drawable drawable, struct R_image *image, int w, int h)
{
    struct R_image *newimage;
    Imlib_Image img, newimg;
    int imagew, imageh;
    int neww, newh;

    if (image == NULL) {

	return NULL;
    }

    newimage = NULL;
    img = image->im2img;
    if (img) {
	imlib_context_set_drawable(drawable);
	imlib_context_set_image(img);
	imagew = imlib_image_get_width();
	imageh = imlib_image_get_height();
	if (w == 0) {
	    neww = imagew;
	} else {
	    neww = w;
	}
	if (h == 0) {
	    newh = imageh;
	} else {
	    newh = h;
	}
	newimg = imlib_create_cropped_scaled_image(0, 0,
						   imagew, imageh,
						   neww, newh);
	if (newimg == NULL) {

	    return NULL;
	}
	newimage = image_alloc();
	if (newimage == NULL) {

	    return NULL;
	}
	newimage->w = neww;
	newimage->h = newh;
	newimage->im2img = newimg;
    }

    return newimage;
}
コード例 #20
0
ファイル: im2int.c プロジェクト: kopoli/sequview
static tvalue im2_draw(struct sequ_image *img,XID drw,
  int sx, int sy, int sw, int sh, 
  int tx, int ty, int tw, int th)
{
  if(!img)
    return FALSE;

  imlib_context_set_image((Imlib_Image)img->privdata);
  imlib_context_set_drawable(drw);

  imlib_render_image_part_on_drawable_at_size
    (sx,sy,sw,sh,tx,ty,tw,th);

  return TRUE;
}
コード例 #21
0
ファイル: XDesktopContainer.cpp プロジェクト: mutek/Idesk
void XDesktopContainer::getRootImage()
{
     DesktopConfig * dConfig = dynamic_cast<DesktopConfig *>(config);
     
     
     imlib_context_set_drawable(rootWindow);
     
     bg = new XImlib2Background(this,config);
    
     bg->InitSpareRoot(rootWindow);
	
     if(!bg->IsOneShot()){	
        timer = new Timer(this);
	bg->Finish();
     }
}
コード例 #22
0
ファイル: gib_imlib.c プロジェクト: cbane/giblib
void
gib_imlib_render_image_part_on_drawable_at_size(Drawable d, Imlib_Image im,
                                                int sx, int sy, int sw,
                                                int sh, int dx, int dy,
                                                int dw, int dh, char dither,
                                                char blend, char alias)
{
   imlib_context_set_image(im);
   imlib_context_set_drawable(d);
   imlib_context_set_anti_alias(alias);
   imlib_context_set_dither(dither);
   imlib_context_set_blend(blend);
   imlib_context_set_angle(0);
   imlib_render_image_part_on_drawable_at_size(sx, sy, sw, sh, dx, dy, dw,
                                               dh);
}
コード例 #23
0
ファイル: XImlib2Shadow.cpp プロジェクト: mutek/Idesk
void XImlib2Shadow::renderShadowToImage(Pixmap &buffer, int fX, int fY)
{
    XIconWithShadow * sIcon = dynamic_cast<XIconWithShadow *>(iconParent);
    
    //sIcon->snapShadow();

    x = sIcon->getShadowX();
    y = sIcon->getShadowY();

    int xCord = x - fX;
    int yCord = y - fY;
    
    imlib_context_set_image(image);
    imlib_context_set_anti_alias(1);  //smoother scaling
    imlib_context_set_blend(1);       //automatically blend image and background

    imlib_context_set_drawable(buffer);
    imlib_render_image_on_drawable(xCord, yCord);
}
コード例 #24
0
ファイル: x11.c プロジェクト: BackupTheBerlios/xsysguard-svn
int init_x11() {
	if ((display = XOpenDisplay(NULL)) == NULL)
		dief("cannot open display");
	window = XCreateSimpleWindow(display, DefaultRootWindow(display),
			x, y, width, height, 0, 0, 0);
	XSelectInput(display, window, ExposureMask);
	XMapWindow(display, window);

	imlib_context_set_dither(1);
	imlib_context_set_anti_alias(1);
	imlib_context_set_display(display);
	imlib_context_set_visual(DefaultVisual(display, DefaultScreen(display)));
	imlib_context_set_colormap(DefaultColormap(display, DefaultScreen(display)));
	imlib_context_set_drawable(window);

	updates = imlib_updates_init();

	return ConnectionNumber(display);
}
コード例 #25
0
ファイル: gib_imlib.c プロジェクト: cbane/giblib
void
gib_imlib_render_image_on_drawable_with_rotation(Drawable d, Imlib_Image im,
                                                 int x, int y, double angle,
                                                 char dither, char blend,
                                                 char alias)
{
   Imlib_Image new_im;

   imlib_context_set_image(im);
   imlib_context_set_anti_alias(alias);
   imlib_context_set_dither(dither);
   imlib_context_set_blend(blend);
   imlib_context_set_angle(angle);
   imlib_context_set_drawable(d);
   new_im = imlib_create_rotated_image(angle);
   imlib_context_set_image(new_im);
   imlib_render_image_on_drawable(x, y);
   imlib_free_image();
}
コード例 #26
0
ファイル: mainwin.c プロジェクト: jameswthorne/skippy
void
mainwin_update_background(MainWin *mw)
{
	Pixmap dummy = wm_get_root_pmap(mw->dpy);
	Window dummy_root;
	int x, y;
	unsigned int root_w, root_h, border_width, depth;
	
	XGetGeometry(mw->dpy, mw->root, &dummy_root, &x, &y, &root_w, &root_h, &border_width, &depth);
	
	if(mw->background != 0)
	{
		imlib_context_set_image(mw->background);
		imlib_free_image();
	}
	
	if(dummy != None)
	{
		unsigned int width, height;
		
		mw->background = imlib_create_image(root_w, root_h);
		imlib_context_set_image(mw->background);
		
		XGetGeometry(mw->dpy, dummy, &dummy_root, &x, &y, &width, &height, &border_width, &depth);
		imlib_context_set_drawable(dummy);
		imlib_copy_drawable_to_image(0, 0, 0, width, height, 0, 0, 1);
		
		for(x = 1; x < (int)ceil((double)root_w / width); ++x)
			imlib_image_copy_rect(0, 0, width, height, x * width, 0);
		for(y = 1; y < (int)ceil((double)root_h / height); ++y)
			imlib_image_copy_rect(0, 0, root_w, height, 0, y * height);
	}
	else
	{
		mw->background = imlib_create_image(root_w, root_h);
		imlib_context_set_image(mw->background);
		imlib_image_clear();
	}
	
	mainwin_update_bg_pixmap(mw);
	REDUCE(clientwin_render((ClientWin*)iter->data), mw->cod);
}
コード例 #27
0
ファイル: render.c プロジェクト: penma/feht2
static void render_checkerboard() {
	/* create the checkerboard texture, if not already done. */

	static Pixmap checks_pmap = None;
	Imlib_Image checks = NULL;

	if (checks_pmap == None) {
		checks = imlib_create_image(16, 16);

		if (!checks) {
			fputs("Unable to create a teeny weeny imlib image. I detect problems\n", stderr);
		}

		imlib_context_set_image(checks);

		imlib_context_set_color(144, 144, 144, 255);
		imlib_image_fill_rectangle(0, 0, 16, 16);

		imlib_context_set_color(100, 100, 100, 255);
		imlib_image_fill_rectangle(0, 0, 8, 8);
		imlib_image_fill_rectangle(8, 8, 8, 8);

		checks_pmap = XCreatePixmap(x11.display, x11_window, 16, 16, x11.depth);

		imlib_context_set_drawable(checks_pmap);
		imlib_render_image_on_drawable(0, 0);
		imlib_free_image_and_decache();
	}

	/* and plot the checkerboards onto the pixmap */

	static GC gc = None;
	XGCValues gcval;

	if (gc == None) {
		gcval.tile = checks_pmap;
		gcval.fill_style = FillTiled;
		gc = XCreateGC(x11.display, x11_window, GCTile | GCFillStyle, &gcval);
	}

	XFillRectangle(x11.display, window_pixmap, gc, 0, 0, s_view.win_width, s_view.win_height);
}
コード例 #28
0
ファイル: task.c プロジェクト: chigoncalves/tinto
// TODO icons look too large when the panel is large
void draw_task_icon (Task *tsk, int text_width)
{
	if (tsk->icon[tsk->current_state] == 0) return;

	// Find pos
	int pos_x;
	Panel *panel = (Panel*)tsk->area.panel;
	if (panel->g_task.centered) {
		if (panel->g_task.text)
			pos_x = (tsk->area.bounds.width - text_width - panel->g_task.icon_size1) / 2;
		else
			pos_x = (tsk->area.bounds.width - panel->g_task.icon_size1) / 2;
	}
	else pos_x = panel->g_task.area.paddingxlr + tsk->area.background->border.width;

	// Render
	imlib_context_set_image (tsk->icon[tsk->current_state]);
	imlib_context_set_blend(1);
	imlib_context_set_drawable(tsk->area.pixmap);
	imlib_render_image_on_drawable(pos_x, panel->g_task.icon_posy);
}
コード例 #29
0
ファイル: imlib2.c プロジェクト: lf94/Resurrection
int
app_init_imlib2(struct R_app *app)
{
    if (app == NULL) {

	return -1;
    }

    imlib_context_set_display(app->display);
    imlib_context_set_visual(app->visual);
    imlib_context_set_colormap(app->colormap);
    imlib_context_set_drawable(app->window->win);
    imlib_context_set_blend(0);
    imlib_context_set_mask(0);
    imlib_set_font_cache_size(1024 * 1024);
#if 0
    imlib_add_path_to_font_path(RESURRECTION_FONT_SEARCH_PATH "ttf/");
#endif
    imlib_set_cache_size(4096 * 1024);

    return 0;
}
コード例 #30
0
ファイル: XImlib2Caption.cpp プロジェクト: mutek/Idesk
void XImlib2Caption::renderFont2Imlib()
{
   
    XDesktopContainer * xContainer =
        dynamic_cast<XDesktopContainer *>(AbstractImage::container);

    Display * display = xContainer->getDisplay();
    int screen =  DefaultScreen(display);

    pixmap = XCreatePixmap(display, window, width,
                            height,
                           DefaultDepth(display, screen));
    
    XSetWindowBackgroundPixmap (display, window, pixmap);
    
    gc = XCreateGC(display, window, 0, 0);
    
    if( pixmap == (Pixmap) NULL )
    {
	    printf("\nError creando Pixmap\n");
	    XCloseDisplay(display);
	    exit(1);
    }
    
    fontDrawHandle = XftDrawCreate(display, pixmap, visual, cmap);

    XSetFillStyle(display, gc, FillSolid);
    XSetForeground(display, gc, BlackPixel(display, 0));
    XSetBackground(display, gc, WhitePixel(display, 0));
    XFillRectangle(display, pixmap, gc, 0, 0, width, height);
    Pixmap shapeMask = XCreatePixmap(display, window, width, height,1);
    GC tempGc = XCreateGC(display, shapeMask, 0, 0);
    XCopyPlane(display, pixmap, shapeMask, tempGc, 0, 0, width, height, 0, 0, 1);
#ifdef SHAPE					
    XShapeCombineMask(display, window, 0, 0, 0, shapeMask, ShapeUnion);
#endif // SHAPE
    imlib_context_set_drawable(pixmap);
}