summaryrefslogtreecommitdiffstats
path: root/src/trace/imagemap.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/trace/imagemap.h
parentInitial commit. (diff)
downloadinkscape-upstream/1.2.2.tar.xz
inkscape-upstream/1.2.2.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/trace/imagemap.h')
-rw-r--r--src/trace/imagemap.h302
1 files changed, 302 insertions, 0 deletions
diff --git a/src/trace/imagemap.h b/src/trace/imagemap.h
new file mode 100644
index 0000000..4a938da
--- /dev/null
+++ b/src/trace/imagemap.h
@@ -0,0 +1,302 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/** @file
+ * TODO: insert short description here
+ *//*
+ * Authors: see git history
+ *
+ * Copyright (C) 2018 Authors
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+#ifndef __IMAGEMAP_H__
+#define __IMAGEMAP_H__
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+/*#########################################################################
+### G R A Y M A P
+#########################################################################*/
+
+
+typedef struct GrayMap_def GrayMap;
+
+#define GRAYMAP_BLACK 0
+#define GRAYMAP_WHITE 765
+
+/**
+ *
+ */
+struct GrayMap_def
+{
+
+ /*#################
+ ### METHODS
+ #################*/
+
+ /**
+ *
+ */
+ void (*setPixel)(GrayMap *me, int x, int y, unsigned long val);
+
+ /**
+ *
+ */
+ unsigned long (*getPixel)(GrayMap *me, int x, int y);
+
+ /**
+ *
+ */
+ int (*writePPM)(GrayMap *me, char *fileName);
+
+
+
+ /**
+ *
+ */
+ void (*destroy)(GrayMap *me);
+
+
+
+ /*#################
+ ### FIELDS
+ #################*/
+
+ /**
+ *
+ */
+ int width;
+
+ /**
+ *
+ */
+ int height;
+
+ /**
+ * The pixel array
+ */
+ unsigned long *pixels;
+
+ /**
+ * Pointer to the beginning of each row
+ */
+ unsigned long **rows;
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GrayMap *GrayMapCreate(int width, int height);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+/*#########################################################################
+### R G B M A P
+#########################################################################*/
+
+struct RGB
+{
+ unsigned char r;
+ unsigned char g;
+ unsigned char b;
+};
+
+
+
+typedef struct RgbMap_def RgbMap;
+
+/**
+ *
+ */
+struct RgbMap_def
+{
+
+ /*#################
+ ### METHODS
+ #################*/
+
+ /**
+ *
+ */
+ void (*setPixel)(RgbMap *me, int x, int y, int r, int g, int b);
+
+
+ /**
+ *
+ */
+ void (*setPixelRGB)(RgbMap *me, int x, int y, RGB rgb);
+
+ /**
+ *
+ */
+ RGB (*getPixel)(RgbMap *me, int x, int y);
+
+ /**
+ *
+ */
+ int (*writePPM)(RgbMap *me, char *fileName);
+
+
+
+ /**
+ *
+ */
+ void (*destroy)(RgbMap *me);
+
+
+
+ /*#################
+ ### FIELDS
+ #################*/
+
+ /**
+ *
+ */
+ int width;
+
+ /**
+ *
+ */
+ int height;
+
+ /**
+ * The allocated array of pixels
+ */
+ RGB *pixels;
+
+ /**
+ * Pointers to the beginning of each row of pixels
+ */
+ RGB **rows;
+
+};
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+RgbMap *RgbMapCreate(int width, int height);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+/*#########################################################################
+### I N D E X E D M A P
+#########################################################################*/
+
+
+typedef struct IndexedMap_def IndexedMap;
+
+/**
+ *
+ */
+struct IndexedMap_def
+{
+
+ /*#################
+ ### METHODS
+ #################*/
+
+ /**
+ *
+ */
+ void (*setPixel)(IndexedMap *me, int x, int y, unsigned int index);
+
+
+ /**
+ *
+ */
+ unsigned int (*getPixel)(IndexedMap *me, int x, int y);
+
+ /**
+ *
+ */
+ RGB (*getPixelValue)(IndexedMap *me, int x, int y);
+
+ /**
+ *
+ */
+ int (*writePPM)(IndexedMap *me, char *fileName);
+
+
+
+ /**
+ *
+ */
+ void (*destroy)(IndexedMap *me);
+
+
+
+ /*#################
+ ### FIELDS
+ #################*/
+
+ /**
+ *
+ */
+ int width;
+
+ /**
+ *
+ */
+ int height;
+
+ /**
+ * The allocated array of pixels
+ */
+ unsigned int *pixels;
+
+ /**
+ * Pointers to the beginning of each row of pixels
+ */
+ unsigned int **rows;
+
+ /**
+ *
+ */
+ int nrColors;
+
+ /**
+ * Color look up table
+ */
+ RGB clut[256];
+
+};
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+IndexedMap *IndexedMapCreate(int width, int height);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+#endif /* __IMAGEMAP_H__ */
+
+/*#########################################################################
+### E N D O F F I L E
+#########################################################################*/