Move theme path related stuff out of eimage.c, add function to get image data.

SVN revision: 27623
This commit is contained in:
Kim Woelders 2006-12-28 17:44:42 +00:00
parent fbb669f65f
commit 34253bc0c4
7 changed files with 45 additions and 29 deletions

View File

@ -418,16 +418,16 @@ DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
switch (db->image)
{
case DLG_BUTTON_OK:
im = EImageLoad("pix/ok.png");
im = ThemeImageLoad("pix/ok.png");
break;
case DLG_BUTTON_CANCEL:
im = EImageLoad("pix/cancel.png");
im = ThemeImageLoad("pix/cancel.png");
break;
case DLG_BUTTON_APPLY:
im = EImageLoad("pix/apply.png");
im = ThemeImageLoad("pix/apply.png");
break;
case DLG_BUTTON_CLOSE:
im = EImageLoad("pix/close.png");
im = ThemeImageLoad("pix/close.png");
break;
default:
break;
@ -1221,7 +1221,7 @@ DialogRealizeItem(Dialog * d, DItem * di)
di->h = ih;
break;
case DITEM_IMAGE:
im = EImageLoad(di->item.image.image);
im = ThemeImageLoad(di->item.image.image);
if (im)
{
Pixmap pmap = 0, mask = 0;

View File

@ -55,27 +55,7 @@ EImageInit(Display * dpy)
EImage *
EImageLoad(const char *file)
{
EImage *im;
char *f;
if (!file)
return NULL;
if (file[0] == '/')
{
im = imlib_load_image(file);
return im;
}
f = ThemeFileFind(file, 0);
if (f)
{
im = imlib_load_image(f);
Efree(f);
return im;
}
return NULL;
return imlib_load_image(file);
}
void
@ -203,6 +183,13 @@ EImageGetSize(EImage * im, int *pw, int *ph)
*ph = imlib_image_get_height();
}
void *
EImageGetData(EImage * im)
{
imlib_context_set_image(im);
return imlib_image_get_data_for_reading_only();
}
void
EImageFill(EImage * im, int x, int y, int w, int h, int r, int g, int b, int a)
{

View File

@ -54,6 +54,7 @@ void EImageSetBorder(EImage * im, EImageBorder * border);
int EImageHasAlpha(EImage * im);
void EImageGetSize(EImage * im, int *pw, int *ph);
void *EImageGetData(EImage * im);
void EImageFill(EImage * im, int x, int y, int w, int h, int r,
int g, int b, int a);
@ -100,4 +101,6 @@ void ScaleRect(Win wsrc, Drawable src,
void EDrawableDumpImage(Drawable draw, const char *txt);
EImage *ThemeImageLoad(const char *file);
#endif /* _EIMAGE_H_ */

View File

@ -115,7 +115,7 @@ ExtInitWinMain(void)
if (EDebug(EDBUG_TYPE_SESSION))
Eprintf("ExtInitWinCreate - child %s\n", s);
im = EImageLoad(s);
im = ThemeImageLoad(s);
if (im)
{
EImageRenderPixmaps(im, NULL, &pmap, &mask, 0, 0);

View File

@ -634,7 +634,7 @@ FX_imagespinner_timeout(int val __UNUSED__, void *data __UNUSED__)
{
EImage *im;
im = EImageLoad(string);
im = ThemeImageLoad(string);
if (im)
{
int x, y, w, h;

View File

@ -168,6 +168,32 @@ TransparencySet(int transparency)
#endif /* ENABLE_THEME_TRANSPARENCY */
EImage *
ThemeImageLoad(const char *file)
{
EImage *im;
char *f;
if (!file)
return NULL;
if (file[0] == '/')
{
im = EImageLoad(file);
return im;
}
f = ThemeFileFind(file, 0);
if (f)
{
im = EImageLoad(f);
Efree(f);
return im;
}
return NULL;
}
static ImageState *
ImagestateCreate(void)
{

View File

@ -178,7 +178,7 @@ IB_GetEIcon(EWin * ewin)
if (!file)
return NULL;
im = EImageLoad(file);
im = ThemeImageLoad(file);
return im;
}