From f33af8ecd7dae0b663b0eb99474d16403faaf4e1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 18 Jul 2022 23:18:48 +0200 Subject: Add man pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- LIBTRACEBITMAP_INK_OFF.3 | 1 + LIBTRACEBITMAP_INK_ON.3 | 1 + Makefile | 22 +++++++ libtracebitmap.7 | 12 ++++ libtracebitmap.h.0 | 36 +++++++++++ libtracebitmap_bitmap.3 | 1 + libtracebitmap_trace.3 | 144 +++++++++++++++++++++++++++++++++++++++++ struct_libtracebitmap_bitmap.3 | 1 + 8 files changed, 218 insertions(+) create mode 120000 LIBTRACEBITMAP_INK_OFF.3 create mode 120000 LIBTRACEBITMAP_INK_ON.3 create mode 100644 libtracebitmap.7 create mode 100644 libtracebitmap.h.0 create mode 120000 libtracebitmap_bitmap.3 create mode 100644 libtracebitmap_trace.3 create mode 120000 struct_libtracebitmap_bitmap.3 diff --git a/LIBTRACEBITMAP_INK_OFF.3 b/LIBTRACEBITMAP_INK_OFF.3 new file mode 120000 index 0000000..b3eb321 --- /dev/null +++ b/LIBTRACEBITMAP_INK_OFF.3 @@ -0,0 +1 @@ +libtracebitmap_trace.3 \ No newline at end of file diff --git a/LIBTRACEBITMAP_INK_ON.3 b/LIBTRACEBITMAP_INK_ON.3 new file mode 120000 index 0000000..b3eb321 --- /dev/null +++ b/LIBTRACEBITMAP_INK_ON.3 @@ -0,0 +1 @@ +libtracebitmap_trace.3 \ No newline at end of file diff --git a/Makefile b/Makefile index 02b0018..6dabda0 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,19 @@ OBJ =\ HDR =\ libtracebitmap.h +MAN0 =\ + libtracebitmap.h.0 + +MAN3 =\ + libtracebitmap_trace.3\ + LIBTRACEBITMAP_INK_OFF.3\ + LIBTRACEBITMAP_INK_ON.3\ + libtracebitmap_bitmap.3\ + struct_libtracebitmap_bitmap.3 + +MAN7 =\ + libtracebitmap.7 + LOBJ = $(OBJ:.o=.lo) @@ -48,12 +61,18 @@ libtracebitmap.$(LIBEXT): $(LOBJ) install: libtracebitmap.a libtracebitmap.$(LIBEXT) mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man0" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7" cp -- libtracebitmap.a "$(DESTDIR)$(PREFIX)/lib/" cp -- libtracebitmap.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.$(LIBMINOREXT)" $(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.$(LIBMINOREXT)" ln -sf -- libtracebitmap.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.$(LIBMAJOREXT)" ln -sf -- libtracebitmap.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.$(LIBEXT)" cp -- libtracebitmap.h "$(DESTDIR)$(PREFIX)/include/" + cp -P -- $(MAN0) "$(DESTDIR)$(MANPREFIX)/man0" + cp -P -- $(MAN3) "$(DESTDIR)$(MANPREFIX)/man3" + cp -P -- $(MAN7) "$(DESTDIR)$(MANPREFIX)/man7" uninstall: -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.a" @@ -61,6 +80,9 @@ uninstall: -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.$(LIBMINOREXT)" -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libtracebitmap.$(LIBEXT)" -rm -f -- "$(DESTDIR)$(PREFIX)/include/libtracebitmap.h" + -cd -- "$(DESTDIR)$(MANPREFIX)/man0" && rm -f -- $(MAN0) + -cd -- "$(DESTDIR)$(MANPREFIX)/man3" && rm -f -- $(MAN3) + -cd -- "$(DESTDIR)$(MANPREFIX)/man7" && rm -f -- $(MAN7) clean: -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib diff --git a/libtracebitmap.7 b/libtracebitmap.7 new file mode 100644 index 0000000..c84ce22 --- /dev/null +++ b/libtracebitmap.7 @@ -0,0 +1,12 @@ +.TH LIBTRACEBITMAP 7 LIBTRACEBITMAP +.SH NAME +libtracebitmap \- Bitmap vectorisation library +.SH DESCRIPTION +.B libtracebitmap +is a C library for tracing bitmaps (monochrome raster +images) into vectors, and is primarily intented for +converting bitmap fonts into vector fonts, and will +therefore only create horizontal and vertical vectors. +.SH SEE ALSO +.BR libtracebitmap.h (0), +.BR libtracebitmap_trace (3) diff --git a/libtracebitmap.h.0 b/libtracebitmap.h.0 new file mode 100644 index 0000000..f13b4df --- /dev/null +++ b/libtracebitmap.h.0 @@ -0,0 +1,36 @@ +.TH LIBTRACEBITMAP.H 0 LIBTRACEBITMAP +.SH NAME +libtracebitmap.h \- Bitmap vectorisation library header +.SH SYNOPSIS +.nf +#include +.fi +.PP +Link with +.IR -ltracebitmap . +.SH DESCRIPTION +The +.B +header file defines structures, macros, and functions for +vectorising bitmaps into horizontal and vertical vectors. +.PP +This header defines the following function: +.TP +.BR libtracebitmap_trace (3) +Vectorise a bitmap. +.PP +This header defines the following structures: +.TP +.B struct libtracebitmap_bitmap +Bitmap image with size information. +.PP +This header defines the following value macros: +.TP +.B LIBTRACEBITMAP_INK_OFF +Ink-off value (display background) for bitmap pixels. +.TP +.B LIBTRACEBITMAP_INK_ON +Ink-on value (display foreground) for bitmap pixels. +.SH SEE ALSO +.BR libtracebitmap (7), +.BR libtracebitmap_trace (3) diff --git a/libtracebitmap_bitmap.3 b/libtracebitmap_bitmap.3 new file mode 120000 index 0000000..6efbd16 --- /dev/null +++ b/libtracebitmap_bitmap.3 @@ -0,0 +1 @@ +struct_libtracebitmap_bitmap.3 \ No newline at end of file diff --git a/libtracebitmap_trace.3 b/libtracebitmap_trace.3 new file mode 100644 index 0000000..dc76bf3 --- /dev/null +++ b/libtracebitmap_trace.3 @@ -0,0 +1,144 @@ +.TH LIBTRACEBITMAP_TRACE 3 LIBTRACEBITMAP +.SH NAME +libtracebitmap_trace \- Vectorise a bitmap +.SH SYNOPSIS +.nf +#include + +#define LIBTRACEBITMAP_INK_OFF 0 +#define LIBTRACEBITMAP_INK_ON 1 + +struct libtracebitmap_bitmap { + size_t \fIheight\fP; + size_t \fIwidth\fP; + uint8_t *\fIimage\fP; +}; + +int libtracebitmap_trace( + struct libtracebitmap_bitmap *\fIbitmap\fP, + int (*\fInew_component\fP)(int \fInegative\fP, void *\fIuser_data\fP), + int (*\fInew_stop\fP)(size_t \fIy\fP, size_t \fIx\fP, void *\fIuser_data\fP), + int (*\fIcomponent_finished\fP)(void *\fIuser_data\fP), + void *\fIuser_data\fP); +.fi +.PP +Link with +.IR -ltracebitmap . +.SH DESCRIPTION +The +.B libtracebitmap_trace +function vectorises a bitmap image into horizonal and +vertical vectors. +.PP +The image to vectorise is given via the +.I bitmap +parameter. +.I bitmap->height +shall be the bitmap's height, measured in pixels, and +.I bitmap->width +shall be the bitmap's width. +.I bitmap->image +shall be a pointer to a memory segment of +.I bitmap->height*bitmap->width +.BR uint8_t s, +here for an y-position +.I y +and an x-position +.I x +the ink status of the pixel at that position is +specified by the value of +.IR bitmap->image[y*bitmap->width+x] , +which shall have the value +.I LIBTRACEBITMAP_INK_OFF +if the image is transparent at that pixel and +.I LIBTRACEBITMAP_INK_ON +if the image is opaque at that pixel, no other +values are allowed. The contents of +.IR bitmap->image +will be erased during execution (which stops +whenever a callback function returns a non-zero +value), however the memory is not deallocated. +.PP +.I *new_component +shall be a callback function for +.B libtracebitmap_trace +to invoke whenever it starts tracing a new +part of the bitmap, which it will only do at +the beginning or immediately after finishing +tracing a part indicated by a previous call to +the callback function. Its +.I negative +parameter will be 0 if the traced area shall +be drawn, and 1 if the traced area shall be +erased from a previously drawn area. It is safe +to ignore this argument and draw with XOR. +.PP +The +.B libtracebitmap_trace +function will call +.I *component_finished +when it has traced a part of the bitmap, at +this point, the application shall connect the +the stop indicated by the first invocation to +.IR *new_stop , +after the previous invocation of +.IR *new_component , +and the stop indicated by the previous +invocation to +.IR *new_stop . +.PP +After invoking +.I *new_component +but before the corresponding invocation of +.IR *component_finished , +the +.B libtracebitmap_trace +function will invoke +.I *new_stop +at least four times, each time indicating a stop +in the vectorisation adjacent to the previous stop +(or in the case of the first stop since the previous +invocation of +.IR *new_component , +the last stop before the next invocation of +.IR *component_component ). +The adjacent stops creates a vector which will not +cross any other vector, however two stops may share +location. Each stop's location is indicated by the +.I y +(values will be integers in [0, +.IR bitmap->height ]) +and +.I x +(values will be integers in [0, +.IR bitmap->width ]) +arguments. +.PP +.I user_data +will be passed on as is as the last argument to +.IR *new_component , +.IR *new_stop , +and +.IR *component_finished . +.PP +Only +.I user_data +parameter may be +.IR NULL . +.SH RETURN VALUE +The +.B libtracebitmap_trace +function will return any non-zero value returned by a +callback function, indicating failure; if all invocations +to callback functions return zero, the function returns +zero indicating successful completion. +.SH ERRORS +The +.B libtracebitmap_trace +function cannot itself fail and will not modify +.IR errno , +it will however let its callback functions modify +.IR errno . +.SH SEE ALSO +.BR libtracebitmap (7), +.BR libtracebitmap.h (0) diff --git a/struct_libtracebitmap_bitmap.3 b/struct_libtracebitmap_bitmap.3 new file mode 120000 index 0000000..b3eb321 --- /dev/null +++ b/struct_libtracebitmap_bitmap.3 @@ -0,0 +1 @@ +libtracebitmap_trace.3 \ No newline at end of file -- cgit v1.2.3-70-g09d2