Plot vector graphics using linked list structure

Simplifies the implementation of individual vector graphic file formats
This commit is contained in:
Robin Stuart 2018-06-10 09:16:18 +01:00
parent dddf2934fc
commit 30fcd7986c
7 changed files with 1255 additions and 2340 deletions

View file

@ -1,7 +1,7 @@
/* zint.h - definitions for libzint
libzint - the open source barcode library
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2018 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -40,6 +40,12 @@ extern "C" {
float x, y, length, width;
struct zint_render_line *next; /* Pointer to next line */
};
struct zint_vector_rect {
float x, y, height, width;
int colour;
struct zint_vector_rect *next;
};
struct zint_render_string {
float x, y, fsize;
@ -48,17 +54,36 @@ extern "C" {
unsigned char *text;
struct zint_render_string *next; /* Pointer to next character */
};
struct zint_vector_string {
float x, y, fsize;
float width; /* Suggested string width, may be 0 if none recommended */
int length;
unsigned char *text;
struct zint_vector_string *next; /* Pointer to next character */
};
struct zint_render_ring {
float x, y, radius, line_width;
struct zint_render_ring *next; /* Pointer to next ring */
};
struct zint_vector_circle {
float x, y, diameter;
int colour;
struct zint_vector_circle *next; /* Pointer to next circle */
};
struct zint_render_hexagon {
float x, y, height;
struct zint_render_hexagon *next; /* Pointer to next hexagon */
};
struct zint_vector_hexagon {
float x, y, diameter;
struct zint_vector_hexagon *next; /* Pointer to next hexagon */
};
struct zint_render {
float width, height;
struct zint_render_line *lines; /* Pointer to first line */
@ -66,6 +91,14 @@ extern "C" {
struct zint_render_ring *rings; /* Pointer to first ring */
struct zint_render_hexagon *hexagons; /* Pointer to first hexagon */
};
struct zint_vector {
float width, height;
struct zint_vector_rect *rectangles; /* Pointer to first rectangle */
struct zint_vector_hexagon *hexagons; /* Pointer to first hexagon */
struct zint_vector_string *strings; /* Points to first string */
struct zint_vector_circle *circles; /* Points to first circle */
};
struct zint_symbol {
int symbology;
@ -96,6 +129,7 @@ extern "C" {
int bitmap_height;
unsigned int bitmap_byte_length;
float dot_size;
struct zint_vector *vector;
struct zint_render *rendered;
int debug;
};
@ -242,6 +276,9 @@ extern "C" {
// Raster file types
#define OUT_BUFFER 0
#define OUT_SVG_FILE 10
#define OUT_EPS_FILE 20
#define OUT_EMF_FILE 30
#define OUT_PNG_FILE 100
#define OUT_BMP_FILE 120
#define OUT_GIF_FILE 140