mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
added rotation
This commit is contained in:
@@ -8,7 +8,7 @@ libwraster_la_LDFLAGS = -version-info 2:0:0
|
|||||||
|
|
||||||
bin_SCRIPTS = get-wraster-flags
|
bin_SCRIPTS = get-wraster-flags
|
||||||
|
|
||||||
noinst_PROGRAMS = testgrad testdraw view
|
noinst_PROGRAMS = testgrad testdraw view testrot
|
||||||
|
|
||||||
EXTRA_DIST = test.png tile.xpm ballot_box.xpm
|
EXTRA_DIST = test.png tile.xpm ballot_box.xpm
|
||||||
include_HEADERS = wraster.h
|
include_HEADERS = wraster.h
|
||||||
@@ -32,6 +32,7 @@ libwraster_la_SOURCES = \
|
|||||||
context.c \
|
context.c \
|
||||||
misc.c \
|
misc.c \
|
||||||
scale.c \
|
scale.c \
|
||||||
|
rotate.c \
|
||||||
convolve.c \
|
convolve.c \
|
||||||
nxpm.c \
|
nxpm.c \
|
||||||
xpm.c \
|
xpm.c \
|
||||||
@@ -66,6 +67,11 @@ testgrad_SOURCES = testgrad.c
|
|||||||
|
|
||||||
testgrad_LDADD = $(LIBLIST)
|
testgrad_LDADD = $(LIBLIST)
|
||||||
|
|
||||||
|
testrot_SOURCES = testrot.c
|
||||||
|
|
||||||
|
testrot_LDADD = $(LIBLIST)
|
||||||
|
|
||||||
|
|
||||||
testdraw_SOURCES = testdraw.c
|
testdraw_SOURCES = testdraw.c
|
||||||
|
|
||||||
testdraw_LDADD = $(LIBLIST)
|
testdraw_LDADD = $(LIBLIST)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ GFXLIBS = @GFXLIBS@
|
|||||||
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
||||||
ICONEXT = @ICONEXT@
|
ICONEXT = @ICONEXT@
|
||||||
INTLIBS = @INTLIBS@
|
INTLIBS = @INTLIBS@
|
||||||
|
LD = @LD@
|
||||||
LIBPL = @LIBPL@
|
LIBPL = @LIBPL@
|
||||||
LIBRARY_SEARCH_PATH = @LIBRARY_SEARCH_PATH@
|
LIBRARY_SEARCH_PATH = @LIBRARY_SEARCH_PATH@
|
||||||
LIBTOOL = @LIBTOOL@
|
LIBTOOL = @LIBTOOL@
|
||||||
@@ -79,6 +80,7 @@ MAKEINFO = @MAKEINFO@
|
|||||||
MOFILES = @MOFILES@
|
MOFILES = @MOFILES@
|
||||||
NETLIBS = @NETLIBS@
|
NETLIBS = @NETLIBS@
|
||||||
NLSDIR = @NLSDIR@
|
NLSDIR = @NLSDIR@
|
||||||
|
NM = @NM@
|
||||||
OBJDUMP = @OBJDUMP@
|
OBJDUMP = @OBJDUMP@
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
@@ -101,12 +103,12 @@ libwraster_la_LDFLAGS = -version-info 2:0:0
|
|||||||
|
|
||||||
bin_SCRIPTS = get-wraster-flags
|
bin_SCRIPTS = get-wraster-flags
|
||||||
|
|
||||||
noinst_PROGRAMS = testgrad testdraw view
|
noinst_PROGRAMS = testgrad testdraw view testrot
|
||||||
|
|
||||||
EXTRA_DIST = test.png tile.xpm ballot_box.xpm
|
EXTRA_DIST = test.png tile.xpm ballot_box.xpm
|
||||||
include_HEADERS = wraster.h
|
include_HEADERS = wraster.h
|
||||||
|
|
||||||
libwraster_la_SOURCES = LookupCmap.c StdCmap.c StdCmap.h CrCmap.c DelCmap.c CmapAlloc.c raster.c draw.c color.c load.c save.c gradient.c xpixmap.c convert.c x86_specific.c context.c misc.c scale.c convolve.c nxpm.c xpm.c xutil.c ppm.c png.c jpeg.c tiff.c gif.c
|
libwraster_la_SOURCES = LookupCmap.c StdCmap.c StdCmap.h CrCmap.c DelCmap.c CmapAlloc.c raster.c draw.c color.c load.c save.c gradient.c xpixmap.c convert.c x86_specific.c context.c misc.c scale.c rotate.c convolve.c nxpm.c xpm.c xutil.c ppm.c png.c jpeg.c tiff.c gif.c
|
||||||
|
|
||||||
|
|
||||||
INCLUDES = @DFLAGS@ @HEADER_SEARCH_PATH@
|
INCLUDES = @DFLAGS@ @HEADER_SEARCH_PATH@
|
||||||
@@ -121,6 +123,10 @@ testgrad_SOURCES = testgrad.c
|
|||||||
|
|
||||||
testgrad_LDADD = $(LIBLIST)
|
testgrad_LDADD = $(LIBLIST)
|
||||||
|
|
||||||
|
testrot_SOURCES = testrot.c
|
||||||
|
|
||||||
|
testrot_LDADD = $(LIBLIST)
|
||||||
|
|
||||||
testdraw_SOURCES = testdraw.c
|
testdraw_SOURCES = testdraw.c
|
||||||
|
|
||||||
testdraw_LDADD = $(LIBLIST)
|
testdraw_LDADD = $(LIBLIST)
|
||||||
@@ -143,8 +149,8 @@ libwraster_la_DEPENDENCIES = @ALLOCA@
|
|||||||
libwraster_la_OBJECTS = LookupCmap.lo StdCmap.lo CrCmap.lo DelCmap.lo \
|
libwraster_la_OBJECTS = LookupCmap.lo StdCmap.lo CrCmap.lo DelCmap.lo \
|
||||||
CmapAlloc.lo raster.lo draw.lo color.lo load.lo save.lo gradient.lo \
|
CmapAlloc.lo raster.lo draw.lo color.lo load.lo save.lo gradient.lo \
|
||||||
xpixmap.lo convert.lo x86_specific.lo context.lo misc.lo scale.lo \
|
xpixmap.lo convert.lo x86_specific.lo context.lo misc.lo scale.lo \
|
||||||
convolve.lo nxpm.lo xpm.lo xutil.lo ppm.lo png.lo jpeg.lo tiff.lo \
|
rotate.lo convolve.lo nxpm.lo xpm.lo xutil.lo ppm.lo png.lo jpeg.lo \
|
||||||
gif.lo
|
tiff.lo gif.lo
|
||||||
PROGRAMS = $(noinst_PROGRAMS)
|
PROGRAMS = $(noinst_PROGRAMS)
|
||||||
|
|
||||||
testgrad_OBJECTS = testgrad.o
|
testgrad_OBJECTS = testgrad.o
|
||||||
@@ -156,6 +162,9 @@ testdraw_LDFLAGS =
|
|||||||
view_OBJECTS = view.o
|
view_OBJECTS = view.o
|
||||||
view_DEPENDENCIES = $(top_builddir)/wrlib/libwraster.la
|
view_DEPENDENCIES = $(top_builddir)/wrlib/libwraster.la
|
||||||
view_LDFLAGS =
|
view_LDFLAGS =
|
||||||
|
testrot_OBJECTS = testrot.o
|
||||||
|
testrot_DEPENDENCIES = $(top_builddir)/wrlib/libwraster.la
|
||||||
|
testrot_LDFLAGS =
|
||||||
SCRIPTS = $(bin_SCRIPTS)
|
SCRIPTS = $(bin_SCRIPTS)
|
||||||
|
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
@@ -173,8 +182,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
|||||||
|
|
||||||
TAR = tar
|
TAR = tar
|
||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
SOURCES = $(libwraster_la_SOURCES) $(testgrad_SOURCES) $(testdraw_SOURCES) $(view_SOURCES)
|
SOURCES = $(libwraster_la_SOURCES) $(testgrad_SOURCES) $(testdraw_SOURCES) $(view_SOURCES) $(testrot_SOURCES)
|
||||||
OBJECTS = $(libwraster_la_OBJECTS) $(testgrad_OBJECTS) $(testdraw_OBJECTS) $(view_OBJECTS)
|
OBJECTS = $(libwraster_la_OBJECTS) $(testgrad_OBJECTS) $(testdraw_OBJECTS) $(view_OBJECTS) $(testrot_OBJECTS)
|
||||||
|
|
||||||
all: all-redirect
|
all: all-redirect
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@@ -274,6 +283,10 @@ view: $(view_OBJECTS) $(view_DEPENDENCIES)
|
|||||||
@rm -f view
|
@rm -f view
|
||||||
$(LINK) $(view_LDFLAGS) $(view_OBJECTS) $(view_LDADD) $(LIBS)
|
$(LINK) $(view_LDFLAGS) $(view_OBJECTS) $(view_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
testrot: $(testrot_OBJECTS) $(testrot_DEPENDENCIES)
|
||||||
|
@rm -f testrot
|
||||||
|
$(LINK) $(testrot_LDFLAGS) $(testrot_OBJECTS) $(testrot_LDADD) $(LIBS)
|
||||||
|
|
||||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
|||||||
@@ -434,8 +434,7 @@ RCombineAreaWithOpaqueness(RImage *image, RImage *src, int sx, int sy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef OP
|
#undef OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -282,6 +282,79 @@ testBevel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void testScale()
|
||||||
|
{
|
||||||
|
RImage *image;
|
||||||
|
RImage *scaled;
|
||||||
|
XSetWindowAttributes val;
|
||||||
|
Pixmap pix;
|
||||||
|
Window win;
|
||||||
|
|
||||||
|
val.background_pixel = ctx->black;
|
||||||
|
val.colormap = ctx->cmap;
|
||||||
|
win = XCreateWindow(dpy, DefaultRootWindow(dpy), 10, 10, 140, 140,
|
||||||
|
0, ctx->depth, InputOutput, ctx->visual,
|
||||||
|
CWColormap|CWBackPixel, &val);
|
||||||
|
XStoreName(dpy, win, "Scale");
|
||||||
|
pix = XCreatePixmap(ctx->dpy, ctx->drawable, 140, 140, ctx->depth);
|
||||||
|
|
||||||
|
image = RLoadImage(ctx, "ballot_box.xpm", 0);
|
||||||
|
if (!image) {
|
||||||
|
puts("couldnt load ballot_box.xpm");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scaled = RScaleImage(image, 140, 140);
|
||||||
|
|
||||||
|
RDestroyImage(image);
|
||||||
|
RConvertImage(ctx, scaled, &pix);
|
||||||
|
XSetWindowBackgroundPixmap(dpy, win, pix);
|
||||||
|
XMapRaised(dpy, win);
|
||||||
|
XClearWindow(dpy, win);
|
||||||
|
XFlush(dpy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void testRotate()
|
||||||
|
{
|
||||||
|
|
||||||
|
RImage *image;
|
||||||
|
RImage *rotated;
|
||||||
|
XSetWindowAttributes val;
|
||||||
|
Pixmap pix;
|
||||||
|
Window win;
|
||||||
|
|
||||||
|
image = RLoadImage(ctx, "ballot_box.xpm", 0);
|
||||||
|
if (!image) {
|
||||||
|
puts("couldnt load ballot_box.xpm");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
image = RScaleImage(image, 90, 180);
|
||||||
|
|
||||||
|
|
||||||
|
val.background_pixel = ctx->black;
|
||||||
|
val.colormap = ctx->cmap;
|
||||||
|
win = XCreateWindow(dpy, DefaultRootWindow(dpy), 10, 10, image->height,
|
||||||
|
image->width,
|
||||||
|
0, ctx->depth, InputOutput, ctx->visual,
|
||||||
|
CWColormap|CWBackPixel, &val);
|
||||||
|
XStoreName(dpy, win, "Rotate");
|
||||||
|
pix = XCreatePixmap(ctx->dpy, ctx->drawable, image->height, image->width,
|
||||||
|
ctx->depth);
|
||||||
|
|
||||||
|
rotated = RRotateImage(image, 90.0);
|
||||||
|
|
||||||
|
RDestroyImage(image);
|
||||||
|
RConvertImage(ctx, rotated, &pix);
|
||||||
|
XSetWindowBackgroundPixmap(dpy, win, pix);
|
||||||
|
XMapRaised(dpy, win);
|
||||||
|
XClearWindow(dpy, win);
|
||||||
|
XFlush(dpy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
drawClip()
|
drawClip()
|
||||||
{
|
{
|
||||||
@@ -548,6 +621,10 @@ int main(int argc, char **argv)
|
|||||||
testBevel();
|
testBevel();
|
||||||
|
|
||||||
drawClip();
|
drawClip();
|
||||||
|
|
||||||
|
testScale();
|
||||||
|
|
||||||
|
testRotate();
|
||||||
|
|
||||||
/* benchmark();*/
|
/* benchmark();*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Raster graphics library
|
* Raster graphics library
|
||||||
*
|
*
|
||||||
* Copyright (c) 1997, 1998, 1999 Alfredo K. Kojima
|
* Copyright (c) 1997 ~ 2000 Alfredo K. Kojima
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
@@ -355,7 +355,10 @@ RImage *RScaleImage(RImage *image, unsigned new_width, unsigned new_height);
|
|||||||
|
|
||||||
RImage *RSmoothScaleImage(RImage *src, unsigned new_width,
|
RImage *RSmoothScaleImage(RImage *src, unsigned new_width,
|
||||||
unsigned new_height);
|
unsigned new_height);
|
||||||
|
|
||||||
|
RImage *RRotateImage(RImage *image, float angle);
|
||||||
|
|
||||||
|
|
||||||
RImage *RMakeTiledImage(RImage *tile, unsigned width, unsigned height);
|
RImage *RMakeTiledImage(RImage *tile, unsigned width, unsigned height);
|
||||||
|
|
||||||
RImage* RMakeCenteredImage(RImage *image, unsigned width, unsigned height,
|
RImage* RMakeCenteredImage(RImage *image, unsigned width, unsigned height,
|
||||||
|
|||||||
Reference in New Issue
Block a user