mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
WindowMaker: New get_texture_image function
The new function get_texture_image includes the common code of wTextureMakePixmap() and wTextureMakeTGradient()
This commit is contained in:
committed by
Carlos R. Mafra
parent
1b0ed30b9b
commit
244b63e6b5
@@ -36,6 +36,7 @@
|
|||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
static void bevelImage(RImage * image, int relief);
|
static void bevelImage(RImage * image, int relief);
|
||||||
|
static RImage * get_texture_image(WScreen *scr, char *pixmap_file);
|
||||||
|
|
||||||
WTexSolid *wTextureMakeSolid(WScreen * scr, XColor * color)
|
WTexSolid *wTextureMakeSolid(WScreen * scr, XColor * color)
|
||||||
{
|
{
|
||||||
@@ -265,20 +266,10 @@ WTexPixmap *wTextureMakePixmap(WScreen * scr, int style, char *pixmap_file, XCol
|
|||||||
WTexPixmap *texture;
|
WTexPixmap *texture;
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
RImage *image;
|
RImage *image;
|
||||||
char *file;
|
|
||||||
|
|
||||||
file = FindImage(wPreferences.pixmap_path, pixmap_file);
|
image = get_texture_image(scr, pixmap_file);
|
||||||
if (!file) {
|
if (!image)
|
||||||
wwarning(_("image file \"%s\" used as texture could not be found."), pixmap_file);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
image = RLoadImage(scr->rcontext, file, 0);
|
|
||||||
if (!image) {
|
|
||||||
wwarning(_("could not load texture pixmap \"%s\":%s"), file, RMessageForError(RErrorCode));
|
|
||||||
wfree(file);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
wfree(file);
|
|
||||||
|
|
||||||
texture = wmalloc(sizeof(WTexture));
|
texture = wmalloc(sizeof(WTexture));
|
||||||
memset(texture, 0, sizeof(WTexture));
|
memset(texture, 0, sizeof(WTexture));
|
||||||
@@ -303,20 +294,10 @@ WTexTGradient *wTextureMakeTGradient(WScreen * scr, int style, RColor * from, RC
|
|||||||
WTexTGradient *texture;
|
WTexTGradient *texture;
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
RImage *image;
|
RImage *image;
|
||||||
char *file;
|
|
||||||
|
|
||||||
file = FindImage(wPreferences.pixmap_path, pixmap_file);
|
image = get_texture_image(scr, pixmap_file);
|
||||||
if (!file) {
|
if (!image)
|
||||||
wwarning(_("image file \"%s\" used as texture could not be found."), pixmap_file);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
image = RLoadImage(scr->rcontext, file, 0);
|
|
||||||
if (!image) {
|
|
||||||
wwarning(_("could not load texture pixmap \"%s\":%s"), file, RMessageForError(RErrorCode));
|
|
||||||
wfree(file);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
wfree(file);
|
|
||||||
|
|
||||||
texture = wmalloc(sizeof(WTexture));
|
texture = wmalloc(sizeof(WTexture));
|
||||||
memset(texture, 0, sizeof(WTexture));
|
memset(texture, 0, sizeof(WTexture));
|
||||||
@@ -341,6 +322,27 @@ WTexTGradient *wTextureMakeTGradient(WScreen * scr, int style, RColor * from, RC
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RImage * get_texture_image(WScreen *scr, char *pixmap_file)
|
||||||
|
{
|
||||||
|
char *file;
|
||||||
|
RImage *image;
|
||||||
|
|
||||||
|
file = FindImage(wPreferences.pixmap_path, pixmap_file);
|
||||||
|
if (!file) {
|
||||||
|
wwarning(_("image file \"%s\" used as texture could not be found."), pixmap_file);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
image = RLoadImage(scr->rcontext, file, 0);
|
||||||
|
if (!image) {
|
||||||
|
wwarning(_("could not load texture pixmap \"%s\":%s"), file, RMessageForError(RErrorCode));
|
||||||
|
wfree(file);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
wfree(file);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
RImage *wTextureRenderImage(WTexture * texture, int width, int height, int relief)
|
RImage *wTextureRenderImage(WTexture * texture, int width, int height, int relief)
|
||||||
{
|
{
|
||||||
RImage *image = NULL;
|
RImage *image = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user