kplot is a small graphics plotting library written by kristaps
this version includes small changes to make it suitable for siril okay op@
This commit is contained in:
parent
6c4b051a0c
commit
a5aec62fc4
36
graphics/kplot/Makefile
Normal file
36
graphics/kplot/Makefile
Normal file
@ -0,0 +1,36 @@
|
||||
COMMENT = library for plotting graphs on cairo surfaces
|
||||
|
||||
VERSION = 0.1.15
|
||||
DISTNAME = kplot-${VERSION}
|
||||
SHARED_LIBS = kplot 0.0
|
||||
CATEGORIES = graphics math
|
||||
HOMEPAGE = https://kristaps.bsd.lv/kplot/
|
||||
|
||||
# ISC licence
|
||||
PERMIT_PACKAGE = Yes
|
||||
|
||||
MASTER_SITES = ${HOMEPAGE}/snapshots/
|
||||
|
||||
EXTRACT_SUFX = .tgz
|
||||
|
||||
WANTLIB += cairo
|
||||
LIB_DEPENDS = graphics/cairo
|
||||
MAKE_FLAGS = CFLAGS="${CFLAGS}"
|
||||
SUBST_VARS += VERSION
|
||||
|
||||
MAKE_FILE = ${FILESDIR}/Makefile.lib
|
||||
|
||||
do-configure:
|
||||
touch ${WRKDIST}/compat.h # we have reallocarray
|
||||
|
||||
pre-build:
|
||||
echo "major=${LIBkplot_VERSION:R}" >${WRKDIST}/shlib_version
|
||||
echo "minor=${LIBkplot_VERSION:E}" >>${WRKDIST}/shlib_version
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/pkgconfig
|
||||
${SUBST_DATA} ${FILESDIR}/kplot.pc.in ${PREFIX}/share/pkgconfig/kplot.pc
|
||||
${INSTALL_DATA} ${WRKDIST}/kplot.h ${PREFIX}/include
|
||||
|
||||
|
||||
.include <bsd.port.mk>
|
2
graphics/kplot/distinfo
Normal file
2
graphics/kplot/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (kplot-0.1.15.tgz) = JnBCJxBMOh8Yax1MeAMZ9O4XEjHg4zRu1p491JSK5VA=
|
||||
SIZE (kplot-0.1.15.tgz) = 32808
|
80
graphics/kplot/files/Makefile.lib
Normal file
80
graphics/kplot/files/Makefile.lib
Normal file
@ -0,0 +1,80 @@
|
||||
# ex:filetype=make:
|
||||
|
||||
CPPFLAGS != pkg-config --cflags cairo
|
||||
CPPFLAGS += -I${.CURDIR}
|
||||
LDADD != pkg-config --libs cairo
|
||||
|
||||
.PATH: ${.CURDIR}/man
|
||||
MAN = kdata_array_alloc.3 \
|
||||
kdata_array_fill.3 \
|
||||
kdata_bucket_alloc.3 \
|
||||
kdata_bucket_add.3 \
|
||||
kdata_buffer_alloc.3 \
|
||||
kdata_buffer_copy.3 \
|
||||
kdata_destroy.3 \
|
||||
kdata_get.3 \
|
||||
kdata_hist_alloc.3 \
|
||||
kdata_hist_add.3 \
|
||||
kdata_mean_alloc.3 \
|
||||
kdata_mean_attach.3 \
|
||||
kdata_pmfmean.3 \
|
||||
kdata_pmfstddev.3 \
|
||||
kdata_pmfvar.3 \
|
||||
kdata_stddev_alloc.3 \
|
||||
kdata_stddev_attach.3 \
|
||||
kdata_vector_append.3 \
|
||||
kdata_vector_alloc.3 \
|
||||
kdata_xmax.3 \
|
||||
kdata_xmean.3 \
|
||||
kdata_xmin.3 \
|
||||
kdata_xstddev.3 \
|
||||
kdatacfg_defaults.3 \
|
||||
kplot.3 \
|
||||
kplot_alloc.3 \
|
||||
kplot_attach_data.3 \
|
||||
kplot_attach_datas.3 \
|
||||
kplot_attach_smooth.3 \
|
||||
kplot_detach.3 \
|
||||
kplot_draw.3 \
|
||||
kplot_free.3 \
|
||||
kplot_get_datacfg.3 \
|
||||
kplot_get_plotcfg.3 \
|
||||
kplotcfg_defaults.3
|
||||
|
||||
LIB = kplot
|
||||
LIBDIR = ${TRUEPREFIX}/lib
|
||||
MANDIR = ${TRUEPREFIX}/man/man
|
||||
SRCS = array.c \
|
||||
border.c \
|
||||
bucket.c \
|
||||
buffer.c \
|
||||
colours.c \
|
||||
draw.c \
|
||||
grid.c \
|
||||
hist.c \
|
||||
label.c \
|
||||
kdata.c \
|
||||
kplot.c \
|
||||
margin.c \
|
||||
mean.c \
|
||||
plotctx.c \
|
||||
stddev.c \
|
||||
tic.c \
|
||||
vector.c
|
||||
|
||||
NOPROFILE =
|
||||
|
||||
PROGS = example0 example1 example2 example3 example4 example5 \
|
||||
example6 example7 example8 example9 example10 example11 \
|
||||
example12 example13
|
||||
|
||||
.for p in ${PROGS}
|
||||
test: $p.png
|
||||
$p.png: $p
|
||||
LD_LIBRARY_PATH=. ./$p
|
||||
|
||||
$p: $p.o
|
||||
${CC} ${CFLAGS} -o $p $p.o ${LDADD} -L${.CURDIR} -lkplot -lm
|
||||
.endfor
|
||||
|
||||
.include <bsd.lib.mk>
|
13
graphics/kplot/files/kplot.pc.in
Normal file
13
graphics/kplot/files/kplot.pc.in
Normal file
@ -0,0 +1,13 @@
|
||||
prefix=/usr/local
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: kplot
|
||||
Description: plotting library for cairo
|
||||
Version: ${VERSION}
|
||||
|
||||
Requires:
|
||||
Libs: -L${libdir} -lkplot
|
||||
Cflags: -I${includedir}
|
||||
|
59
graphics/kplot/patches/patch-draw_c
Normal file
59
graphics/kplot/patches/patch-draw_c
Normal file
@ -0,0 +1,59 @@
|
||||
Extra glue that siril wants
|
||||
Index: draw.c
|
||||
--- draw.c.orig
|
||||
+++ draw.c
|
||||
@@ -27,6 +27,12 @@
|
||||
#include "kplot.h"
|
||||
#include "extern.h"
|
||||
|
||||
+static double dimx = 0.0;
|
||||
+static double dimy = 0.0;
|
||||
+static double offsx = 0.0;
|
||||
+static double offsy = 0.0;
|
||||
+
|
||||
+
|
||||
/*
|
||||
* Simple function to check that the double-precision values in the
|
||||
* kpair are valid: normal (or 0.0) values.
|
||||
@@ -766,8 +772,10 @@ kplot_draw(struct kplot *p, double w, double h, cairo_
|
||||
kplotctx_border_init(&ctx);
|
||||
kplotctx_tic_init(&ctx);
|
||||
|
||||
- ctx.h = ctx.dims.y;
|
||||
- ctx.w = ctx.dims.x;
|
||||
+ dimy = ctx.h = ctx.dims.y;
|
||||
+ dimx = ctx.w = ctx.dims.x;
|
||||
+ offsx = ctx.offs.x;
|
||||
+ offsy = ctx.offs.y;
|
||||
|
||||
for (i = 0; i < p->datasz; i++) {
|
||||
d = &p->datas[i];
|
||||
@@ -908,4 +916,28 @@ kplotcfg_default_palette(struct kplotccfg **pp, size_t
|
||||
(*pp)[6].rgba[2] = 0x10 / 255.0;
|
||||
|
||||
return(1);
|
||||
+}
|
||||
+
|
||||
+double
|
||||
+get_dimx()
|
||||
+{
|
||||
+ return dimx;
|
||||
+}
|
||||
+
|
||||
+double
|
||||
+get_dimy()
|
||||
+{
|
||||
+ return dimy;
|
||||
+}
|
||||
+
|
||||
+double
|
||||
+get_offsx()
|
||||
+{
|
||||
+ return offsx;
|
||||
+}
|
||||
+
|
||||
+double
|
||||
+get_offsy()
|
||||
+{
|
||||
+ return offsy;
|
||||
}
|
17
graphics/kplot/patches/patch-kplot_h
Normal file
17
graphics/kplot/patches/patch-kplot_h
Normal file
@ -0,0 +1,17 @@
|
||||
Extra glue that siril wants
|
||||
Index: kplot.h
|
||||
--- kplot.h.orig
|
||||
+++ kplot.h
|
||||
@@ -240,6 +240,12 @@ int kplot_get_datacfg(struct kplot *, size_t,
|
||||
struct kdatacfg **, size_t *);
|
||||
struct kplotcfg *kplot_get_plotcfg(struct kplot *);
|
||||
|
||||
+/* getters needed for siril for now */
|
||||
+double get_dimx(void);
|
||||
+double get_dimy(void);
|
||||
+double get_offsx(void);
|
||||
+double get_offsy(void);
|
||||
+
|
||||
|
||||
__END_DECLS
|
||||
|
15
graphics/kplot/patches/patch-label_c
Normal file
15
graphics/kplot/patches/patch-label_c
Normal file
@ -0,0 +1,15 @@
|
||||
Silence warnings by using better functions
|
||||
Index: label.c
|
||||
--- label.c.orig
|
||||
+++ label.c
|
||||
@@ -32,8 +32,8 @@ bbox_extents(struct kplotctx *ctx, const char *v,
|
||||
cairo_text_extents_t e;
|
||||
|
||||
cairo_text_extents(ctx->cr, v, &e);
|
||||
- *h = abs(e.width * sin(rot)) + abs(e.height * cos(rot));
|
||||
- *w = abs(e.width * cos(rot)) + abs(e.height * sin(rot));
|
||||
+ *h = fabs(e.width * sin(rot)) + fabs(e.height * cos(rot));
|
||||
+ *w = fabs(e.width * cos(rot)) + fabs(e.height * sin(rot));
|
||||
}
|
||||
|
||||
void
|
8
graphics/kplot/pkg/DESCR
Normal file
8
graphics/kplot/pkg/DESCR
Normal file
@ -0,0 +1,8 @@
|
||||
kplot is a programming library for plotting graphs on a Cairo
|
||||
surface. It handles drawing margins, axis labels, tic labels, tics,
|
||||
borders, grids, and the data itself. Data may be specified structurally
|
||||
as finite buckets, range histograms, arrays, and vectors. Data may
|
||||
also be computed from other sources, such as the mean and standard
|
||||
deviation.
|
||||
|
||||
This version has been patched to work with siril
|
39
graphics/kplot/pkg/PLIST
Normal file
39
graphics/kplot/pkg/PLIST
Normal file
@ -0,0 +1,39 @@
|
||||
include/kplot.h
|
||||
@static-lib lib/libkplot.a
|
||||
@lib lib/libkplot.so.${LIBkplot_VERSION}
|
||||
@man man/man3/kdata_array_alloc.3
|
||||
@man man/man3/kdata_array_fill.3
|
||||
@man man/man3/kdata_bucket_add.3
|
||||
@man man/man3/kdata_bucket_alloc.3
|
||||
@man man/man3/kdata_buffer_alloc.3
|
||||
@man man/man3/kdata_buffer_copy.3
|
||||
@man man/man3/kdata_destroy.3
|
||||
@man man/man3/kdata_get.3
|
||||
@man man/man3/kdata_hist_add.3
|
||||
@man man/man3/kdata_hist_alloc.3
|
||||
@man man/man3/kdata_mean_alloc.3
|
||||
@man man/man3/kdata_mean_attach.3
|
||||
@man man/man3/kdata_pmfmean.3
|
||||
@man man/man3/kdata_pmfstddev.3
|
||||
@man man/man3/kdata_pmfvar.3
|
||||
@man man/man3/kdata_stddev_alloc.3
|
||||
@man man/man3/kdata_stddev_attach.3
|
||||
@man man/man3/kdata_vector_alloc.3
|
||||
@man man/man3/kdata_vector_append.3
|
||||
@man man/man3/kdata_xmax.3
|
||||
@man man/man3/kdata_xmean.3
|
||||
@man man/man3/kdata_xmin.3
|
||||
@man man/man3/kdata_xstddev.3
|
||||
@man man/man3/kdatacfg_defaults.3
|
||||
@man man/man3/kplot.3
|
||||
@man man/man3/kplot_alloc.3
|
||||
@man man/man3/kplot_attach_data.3
|
||||
@man man/man3/kplot_attach_datas.3
|
||||
@man man/man3/kplot_attach_smooth.3
|
||||
@man man/man3/kplot_detach.3
|
||||
@man man/man3/kplot_draw.3
|
||||
@man man/man3/kplot_free.3
|
||||
@man man/man3/kplot_get_datacfg.3
|
||||
@man man/man3/kplot_get_plotcfg.3
|
||||
@man man/man3/kplotcfg_defaults.3
|
||||
share/pkgconfig/kplot.pc
|
Loading…
x
Reference in New Issue
Block a user