示例#1
0
文件: iclass.c 项目: Limsik/e17
EImage             *
ThemeImageLoad(const char *file)
{
   EImage             *im;
   char               *f;

   if (!file)
      return NULL;

   if (file[0] == '/')
     {
	im = EImageLoad(file);
	return im;
     }

   f = ThemeFileFind(file, FILE_TYPE_IMAGE);
   if (f)
     {
	im = EImageLoad(f);
	Efree(f);
	return im;
     }

   return NULL;
}
示例#2
0
文件: cursors.c 项目: burzumishi/e16
static ECursor     *
ECursorRealize(ECursor * ec)
{
   Pixmap              pmap, mask;
   int                 xh, yh;
   unsigned int        w, h, ww, hh;
   char               *img, msk[FILEPATH_LEN_MAX];

   if (ec->file)
     {
	img = ThemeFileFind(ec->file, FILE_TYPE_CURSOR);
	_EFREE(ec->file);	/* Ok or not - we never need file again */
	if (!img)
	   goto done;

	Esnprintf(msk, sizeof(msk), "%s.mask", img);
	pmap = 0;
	mask = 0;
	xh = 0;
	yh = 0;
	XReadBitmapFile(disp, WinGetXwin(VROOT), msk, &w, &h, &mask, &xh, &yh);
	XReadBitmapFile(disp, WinGetXwin(VROOT), img, &w, &h, &pmap, &xh, &yh);
	XQueryBestCursor(disp, WinGetXwin(VROOT), w, h, &ww, &hh);
	if ((w <= ww) && (h <= hh) && (pmap))
	  {
	     if (xh < 0 || xh >= (int)w)
		xh = (int)w / 2;
	     if (yh < 0 || yh >= (int)h)
		yh = (int)h / 2;
	     ec->cursor =
		ECreatePixmapCursor(pmap, mask, w, h, xh, yh, ec->fg, ec->bg);
	  }

	if (ec->cursor == NoXID)
	  {
	     Eprintf("*** Failed to create cursor \"%s\" from %s,%s\n",
		     ec->name, img, msk);
	  }

	if (pmap)
	   EFreePixmap(pmap);
	if (mask)
	   EFreePixmap(mask);
	Efree(img);
     }
   else
     {
	ec->cursor = (ec->native_id == 999) ?
	   None : XCreateFontCursor(disp, ec->native_id);
     }

 done:
   if (ec->cursor == NoXID)
     {
	ECursorDestroy(ec);
	ec = NULL;
     }

   return ec;
}
示例#3
0
文件: iclass.c 项目: Limsik/e17
static void
ImagestateRealize(ImageState * is)
{
   if (!is)
      return;
   if (is->im)			/* Image is already loaded */
      return;

   if (!is->real_file)
     {
	if (!is->im_file)
	   return;		/* No file - quit */
	/* not loaded, load and setup */
	is->real_file = ThemeFileFind(is->im_file, FILE_TYPE_IMAGE);
     }
   if (is->real_file)
     {
	is->im = EImageLoad(is->real_file);
	if (is->im && is->rotate)
	   EImageOrientate(is->im, is->rotate);
     }
   if (!is->im)
     {
#define S(s) ((s) ? (s) : "(null)")
	Eprintf
	   ("ImagestateRealize: Hmmm... is->im is NULL (im_file=%s real_file=%s)\n",
	    S(is->im_file), S(is->real_file));
	Efree(is->real_file);
	is->real_file = NULL;
	return;
     }

   Efree(is->im_file);		/* We no longer need the file */
   is->im_file = NULL;

   EImageCheckAlpha(is->im);

   if (is->border)
      EImageSetBorder(is->im, is->border);

#if 0				/* To be implemented? */
   if (is->colmod)
     {
	Imlib_set_image_red_curve(pImlib_Context, is->im, is->colmod->red.map);
	Imlib_set_image_green_curve(pImlib_Context, is->im,
				    is->colmod->green.map);
	Imlib_set_image_blue_curve(pImlib_Context, is->im,
				   is->colmod->blue.map);
     }
#endif
}