Ok, some more clean ups to the filter stuff, should have some new filters to

play with soon - want to get the stuff correct before I commit some more
stuff. dox is the start of dox2 the document viewer based on imlib2. Designed
so that the style of the docs is seperate from the contents. Will evolve
rapdily over the next week.


SVN revision: 2716
This commit is contained in:
Chris Ross 2000-05-28 15:17:38 +00:00
parent 8deb1b493e
commit 28b3445f1a
12 changed files with 193 additions and 14 deletions

View File

@ -9,7 +9,7 @@ MAINTAINERCLEANFILES = INSTALL Makefile.in aclocal.m4 config.guess \
ltconfig ltmain.sh missing mkinstalldirs \
stamp-h.in
SUBDIRS = libltdl loaders src filters
SUBDIRS = libltdl loaders src filters dox
EXTRA_DIST = \
imlib2.spec \

View File

@ -117,5 +117,5 @@ AC_MSG_ERROR([Fatal Error: no FreeType header files detected.])
fi
fi
AC_OUTPUT(Makefile loaders/Makefile src/Makefile test/Makefile filters/Makefile demo/Makefile,
AC_OUTPUT(Makefile loaders/Makefile src/Makefile test/Makefile filters/Makefile demo/Makefile dox/Makefile,
[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])

20
dox/.cvsignore Normal file
View File

@ -0,0 +1,20 @@
config.guess
config.h.in
config.sub
ltconfig
ltmain.sh
aclocal.m4
stamp-h.in
Makefile.in
configure
config.log
config.h
config.cache
libtool
config.status
stamp-h
Makefile
.deps
.libs
*.lo
*.la

14
dox/Makefile.am Normal file
View File

@ -0,0 +1,14 @@
# A list of all the files in the current directory which can be regenerated
MAINTAINERCLEANFILES = Makefile.in
LDFLAGS = -L/usr/X11R6/lib
INCLUDES = -I/usr/X11R6/include \
$(X_CFLAGS) -I$(prefix)/include -I$(includedir) -I. \
-DPREFIX=\""$(prefix)"\"
LIBOBJS = @LIBOBJS@
bin_PROGRAMS = bdox
bdox_SOURCES = main.c dox.h hotspot.c
bdox_LDADD = -lX11
EXTRA_DIST =

46
dox/dox.h Normal file
View File

@ -0,0 +1,46 @@
#ifndef _DOX_H_
#define _DOX_H_
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xos.h>
#include <X11/keysym.h>
#include <X11/Xresource.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
#include <dirent.h>
#include <stdarg.h>
#include <sys/wait.h>
#include <Imlib2.h>
typedef struct __dox_hotspot
{
char *name;
int x;
int y;
int w;
int h;
struct __dox_hotspot *next;
} DoxHotspot;
void parse_args( int argc, char **argv );
void init_hotspot();
void add_hotspot( char *target, int x, int y, int w, int h );
char *check_hotspot( int x, int y );
void tidy_hotspots();
void load_dox( char *file );
void parse_dox( char *file );
void load_dss( char *file );
#endif /* _DOX_H_ */

51
dox/hotspot.c Normal file
View File

@ -0,0 +1,51 @@
#include "dox.h"
DoxHotspot *root;
void init_hotspot()
{
root = malloc( sizeof( DoxHotspot ) );
root->name = strdup( "root" );
root->x = 0;
root->y = 0;
root->w = 0;
root->h = 0;
root->next = NULL;
printf( "Hotspots initialised.\n" );
}
void add_hotspot( char *target, int x, int y, int w, int h )
{
DoxHotspot *ptr;
for( ptr = root; ptr->next != NULL; ptr = ptr->next )
;
ptr->next = malloc( sizeof( DoxHotspot ) );
ptr = ptr->next;
ptr->name = strdup( "root" );
ptr->x = 0;
ptr->y = 0;
ptr->w = 0;
ptr->h = 0;
ptr->next = NULL;
printf( "Hotspot added\n" );
}
char *check_hotspot( int x, int y )
{
DoxHotspot *ptr;
for( ptr = root; ptr != NULL; ptr = ptr->next )
{
if( (x >= ptr->x) && (x <= (ptr->x + ptr->w)) &&
(y >= ptr->y) && (y <= (ptr->y + ptr->h)) )
{
printf( "Found Hotspot\n" );
return ptr->name;
}
}
return NULL;
}
void tidy_hotspots()
{
}

8
dox/main.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main( int argc, char **argv )
{
printf( "dox - version 2.0 - Imlib2\n" );
init_hotspot();
return 0;
}

16
dox/style.dss Normal file
View File

@ -0,0 +1,16 @@
<style
title.font = "brooklyn.ttf",
title.size = 35,
link.normal.colour = "#aaaaff",
link.normal.font = "brooklyn.ttf",
link.normal.size = 26,
link.visited.colour = "#ffaaaa",
link.visited.font = "brooklyn.ttf",
link.visited.size = 26,
bg.picture = "bg.png",
/>

View File

@ -231,13 +231,17 @@ bump_map_point(Imlib_Image im, pIFunctionParam par)
void
init(struct imlib_filter_info *info)
{
char *filters[] = { "bump_map_point", "bump_map" };
int i = (sizeof(filters) / sizeof(*filters));
info->num_filters = i;
info->filters = malloc(sizeof(char *) * i);
while (--i >= 0)
info->filters[i] = strdup(filters[i]);
char *filters[] = { "bump_map_point", "bump_map" };
int i = (sizeof(filters) / sizeof(*filters));
info->name = strdup( "Bump Mapping" );
info->author = strdup( "Willem Monsuwe (willem@stack.nl)" );
info->description = strdup( "Provides bumpmapping to a point and bumpmapping from an infinite light source. *very* cool." );
info->num_filters = i;
info->filters = malloc(sizeof(char *) * i);
while (--i >= 0)
info->filters[i] = strdup(filters[i]);
}
void

View File

@ -18,10 +18,13 @@ void *exec( char *filter, void *im, pIFunctionParam params );
void init( struct imlib_filter_info *info )
{
char *filters[] = { "tint", "cool_text" };
char *filters[] = { "tint", "cool_text", "gradient" };
int i = 0;
info->num_filters = 2;
info->name = strdup( "Test Filter" );
info->author = strdup( "Chris Ross - Boris - chris@darkrock.co.uk" );
info->description = strdup( "This filter is used to show that the imlib2 filter system works!" );
info->num_filters = 3;
info->filters = malloc(sizeof(char *)*2);
for (i = 0; i < info->num_filters; i++)
info->filters[i] = strdup(filters[i]);
@ -89,7 +92,6 @@ void *exec( char *filter, void *im, pIFunctionParam params )
imlib_free_image_and_decache();
imlib_context_set_image(imge);
return imge;
}
@ -97,4 +99,13 @@ void *exec( char *filter, void *im, pIFunctionParam params )
{
return imge;
}
if( strcmp( filter, "gradient" ) == 0 )
{
int angle = 0;
for( ptr = params; ptr != NULL; ptr = ptr->next )
{
ASSIGN_INT( "angle", angle );
}
return imge;
}
}

View File

@ -62,7 +62,10 @@ pImlibExternalFilter __imlib_LoadFilter( char *file )
ptr->init_filter( info );
ptr->num_filters = info->num_filters;
ptr->filters = info->filters;
ptr->name = info->name;
ptr->author = info->author;
ptr->description = info->description;
free( info );
#ifdef FDEBUG

View File

@ -5,6 +5,9 @@
struct imlib_filter_info
{
char *name;
char *author;
char *description;
char **filters;
int num_filters;
};
@ -13,6 +16,9 @@ typedef struct _imlib_external_filter ImlibExternalFilter;
typedef struct _imlib_external_filter *pImlibExternalFilter;
struct _imlib_external_filter
{
char *name;
char *author;
char *description;
int num_filters;
char *filename;
void *handle;