mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-07 14:24:14 +01:00
fixed bug in texture panel
This commit is contained in:
@@ -255,6 +255,12 @@ testColorWell(WMScreen *scr)
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
void
|
||||
sliderCallback(WMWidget *w, void *data)
|
||||
{
|
||||
printf("SLIEDER == %i\n", WMGetSliderValue(w));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
testSlider(WMScreen *scr)
|
||||
@@ -274,6 +280,8 @@ testSlider(WMScreen *scr)
|
||||
WMResizeWidget(s, 16, 100);
|
||||
WMMoveWidget(s, 100, 100);
|
||||
WMSetSliderKnobThickness(s, 8);
|
||||
WMSetSliderContinuous(s, False);
|
||||
WMSetSliderAction(s, sliderCallback, s);
|
||||
|
||||
s = WMCreateSlider(win);
|
||||
WMResizeWidget(s, 100, 16);
|
||||
|
||||
@@ -238,13 +238,14 @@ updateTGradImage(TexturePanel *panel)
|
||||
RDiagonalGradient);
|
||||
}
|
||||
|
||||
RCombineImagesWithOpaqueness(image, gradient,
|
||||
RCombineImagesWithOpaqueness(image, gradient,
|
||||
WMGetSliderValue(panel->topaS));
|
||||
RDestroyImage(gradient);
|
||||
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->win),
|
||||
image, 128);
|
||||
|
||||
WMSetLabelImage(panel->imageL, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
WMResizeWidget(panel->imageL, image->width, image->height);
|
||||
RDestroyImage(image);
|
||||
}
|
||||
@@ -387,7 +388,7 @@ static void
|
||||
sliderChangeCallback(WMWidget *w, void *data)
|
||||
{
|
||||
TexturePanel *panel = (TexturePanel*)data;
|
||||
RHSVColor hsv, *hsvp;
|
||||
RHSVColor hsv;
|
||||
int row, rows;
|
||||
WMListItem *item;
|
||||
RColor **colors;
|
||||
@@ -588,7 +589,7 @@ static void
|
||||
updateImage(TexturePanel *panel, char *path)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
RImage *image, *scaled;
|
||||
RImage *image;
|
||||
WMPixmap *pixmap;
|
||||
WMSize size;
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ nlsdir = $(NLSDIR)
|
||||
|
||||
CLEANFILES = $(CATALOGS)
|
||||
|
||||
EXTRA_DIST = pt.po hr.po fr.po ko.po cs.po ja.po zh_TW.Big5.po es.po
|
||||
EXTRA_DIST = pt.po hr.po fr.po ko.po cs.po ja.po zh_TW.Big5.po es.po zh_CN.GB2312.po
|
||||
|
||||
|
||||
POTFILES = $(top_builddir)/WPrefs.app/main.c $(top_builddir)/WPrefs.app/WPrefs.c $(top_builddir)/WPrefs.app/Appearance.c $(top_builddir)/WPrefs.app/Configurations.c $(top_builddir)/WPrefs.app/Expert.c $(top_builddir)/WPrefs.app/Focus.c $(top_builddir)/WPrefs.app/Icons.c $(top_builddir)/WPrefs.app/KeyboardSettings.c $(top_builddir)/WPrefs.app/KeyboardShortcuts.c $(top_builddir)/WPrefs.app/Menu.c $(top_builddir)/WPrefs.app/MenuPreferences.c $(top_builddir)/WPrefs.app/MouseSettings.c $(top_builddir)/WPrefs.app/NoMenuAlert.c $(top_builddir)/WPrefs.app/Paths.c $(top_builddir)/WPrefs.app/Preferences.c $(top_builddir)/WPrefs.app/Text.c $(top_builddir)/WPrefs.app/TexturePanel.c $(top_builddir)/WPrefs.app/Themes.c $(top_builddir)/WPrefs.app/WindowHandling.c $(top_builddir)/WPrefs.app/Workspace.c $(top_builddir)/WPrefs.app/double.c $(top_builddir)/WPrefs.app/editmenu.c $(top_builddir)/WPrefs.app/MenuGuru.c $(top_builddir)/WPrefs.app/xmodifier.c
|
||||
|
||||
|
||||
@@ -689,6 +689,9 @@ freeTexture(BackgroundTexture *texture)
|
||||
&& pixel[0]!=WhitePixelOfScreen(DefaultScreenOfDisplay(dpy)))
|
||||
XFreeColors(dpy, DefaultColormap(dpy, scr), pixel, 1, 0);
|
||||
}
|
||||
if (texture->pixmap) {
|
||||
XFreePixmap(dpy, texture->pixmap);
|
||||
}
|
||||
free(texture->spec);
|
||||
free(texture);
|
||||
}
|
||||
@@ -1066,6 +1069,8 @@ getValueForKey(char *domain, char *keyName)
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
getPixmapPath(char *domain)
|
||||
{
|
||||
|
||||
@@ -141,3 +141,101 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height)
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
|
||||
RImage*
|
||||
RSmoothScaleImage(RImage *image, unsigned new_width, unsigned new_height)
|
||||
{
|
||||
int ox;
|
||||
int px, py;
|
||||
register int x, y, t;
|
||||
int dx, dy;
|
||||
unsigned char *sr, *sg, *sb, *sa;
|
||||
unsigned char *dr, *dg, *db, *da;
|
||||
RImage *img;
|
||||
|
||||
assert(new_width >= 0 && new_height >= 0);
|
||||
|
||||
if (new_width == image->width && new_height == image->height)
|
||||
return RCloneImage(image);
|
||||
|
||||
img = RCreateImage(new_width, new_height, image->data[3]!=NULL);
|
||||
|
||||
if (!img)
|
||||
return NULL;
|
||||
|
||||
dx = (image->width<<16)/new_width;
|
||||
dy = (image->height<<16)/new_height;
|
||||
|
||||
py = 0;
|
||||
|
||||
dr = img->data[0];
|
||||
dg = img->data[1];
|
||||
db = img->data[2];
|
||||
da = img->data[3];
|
||||
|
||||
if (image->data[3]!=NULL) {
|
||||
int ot;
|
||||
ot = -1;
|
||||
for (y=0; y<new_height; y++) {
|
||||
t = image->width*(py>>16);
|
||||
|
||||
sr = image->data[0]+t;
|
||||
sg = image->data[1]+t;
|
||||
sb = image->data[2]+t;
|
||||
sa = image->data[3]+t;
|
||||
|
||||
ot = t;
|
||||
ox = 0;
|
||||
px = 0;
|
||||
for (x=0; x<new_width; x++) {
|
||||
px += dx;
|
||||
|
||||
*(dr++) = *sr;
|
||||
*(dg++) = *sg;
|
||||
*(db++) = *sb;
|
||||
*(da++) = *sa;
|
||||
|
||||
t = (px - ox)>>16;
|
||||
ox += t<<16;
|
||||
|
||||
sr += t;
|
||||
sg += t;
|
||||
sb += t;
|
||||
sa += t;
|
||||
}
|
||||
py += dy;
|
||||
}
|
||||
} else {
|
||||
int ot;
|
||||
ot = -1;
|
||||
for (y=0; y<new_height; y++) {
|
||||
t = image->width*(py>>16);
|
||||
|
||||
sr = image->data[0]+t;
|
||||
sg = image->data[1]+t;
|
||||
sb = image->data[2]+t;
|
||||
|
||||
ot = t;
|
||||
ox = 0;
|
||||
px = 0;
|
||||
for (x=0; x<new_width; x++) {
|
||||
px += dx;
|
||||
|
||||
*(dr++) = *sr;
|
||||
*(dg++) = *sg;
|
||||
*(db++) = *sb;
|
||||
|
||||
t = (px-ox)>>16;
|
||||
ox += t<<16;
|
||||
|
||||
sr += t;
|
||||
sg += t;
|
||||
sb += t;
|
||||
}
|
||||
py += dy;
|
||||
}
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user