Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
pdf.h File Reference
#include <glib.h>
#include <glib/gi18n.h>
#include <inttypes.h>
#include <stdio.h>
+ Include dependency graph for pdf.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_pdf_t
 
struct  dt_pdf_image_t
 
struct  dt_pdf_page_t
 

Macros

#define dt_pdf_inch_to_point(inch)   ((inch) * 72.0)
 
#define dt_pdf_point_to_inch(pt)   ((pt) / 72.0)
 
#define dt_pdf_mm_to_point(mm)   dt_pdf_inch_to_point((mm) / 25.4)
 
#define dt_pdf_point_to_mm(pt)   dt_pdf_point_to_inch((pt) * 25.4)
 
#define dt_pdf_point_to_pixel(pt, dpi)   (dt_pdf_point_to_inch(pt) * (dpi))
 
#define dt_pdf_pixel_to_point(px, dpi)   (dt_pdf_inch_to_point((px) / (dpi)))
 

Typedefs

typedef enum dt_pdf_stream_encoder_t dt_pdf_stream_encoder_t
 
typedef struct dt_pdf_t dt_pdf_t
 
typedef struct dt_pdf_image_t dt_pdf_image_t
 
typedef struct dt_pdf_page_t dt_pdf_page_t
 

Enumerations

enum  dt_pdf_stream_encoder_t {
  DT_PDF_STREAM_ENCODER_ASCII_HEX = 0 ,
  DT_PDF_STREAM_ENCODER_FLATE = 1
}
 

Functions

dt_pdf_tdt_pdf_start (const char *filename, float width, float height, float dpi, dt_pdf_stream_encoder_t default_encoder)
 
int dt_pdf_add_icc (dt_pdf_t *pdf, const char *filename)
 
int dt_pdf_add_icc_from_data (dt_pdf_t *pdf, const unsigned char *data, size_t size)
 
dt_pdf_image_tdt_pdf_add_image (dt_pdf_t *pdf, const unsigned char *image, int width, int height, int bpp, int icc_id, float border)
 
dt_pdf_page_tdt_pdf_add_page (dt_pdf_t *pdf, dt_pdf_image_t **images, int n_images)
 
void dt_pdf_finish (dt_pdf_t *pdf, dt_pdf_page_t **pages, int n_pages)
 
int dt_pdf_parse_length (const char *str, float *length)
 
int dt_pdf_parse_paper_size (const char *str, float *width, float *height)
 

Variables

struct { 
 
   const char *   name 
 
   const float   factor 
 
dt_pdf_units [] 
 
static const int dt_pdf_units_n = sizeof(dt_pdf_units) / sizeof(dt_pdf_units[0])
 
struct { 
 
   const char *   name 
 
   const float   width 
 
   const float   height 
 
dt_pdf_paper_sizes [] 
 
static const int dt_pdf_paper_sizes_n = sizeof(dt_pdf_paper_sizes) / sizeof(dt_pdf_paper_sizes[0]) - 1
 

Macro Definition Documentation

◆ dt_pdf_inch_to_point

#define dt_pdf_inch_to_point (   inch)    ((inch) * 72.0)

◆ dt_pdf_mm_to_point

#define dt_pdf_mm_to_point (   mm)    dt_pdf_inch_to_point((mm) / 25.4)

◆ dt_pdf_pixel_to_point

#define dt_pdf_pixel_to_point (   px,
  dpi 
)    (dt_pdf_inch_to_point((px) / (dpi)))

◆ dt_pdf_point_to_inch

#define dt_pdf_point_to_inch (   pt)    ((pt) / 72.0)

◆ dt_pdf_point_to_mm

#define dt_pdf_point_to_mm (   pt)    dt_pdf_point_to_inch((pt) * 25.4)

◆ dt_pdf_point_to_pixel

#define dt_pdf_point_to_pixel (   pt,
  dpi 
)    (dt_pdf_point_to_inch(pt) * (dpi))

Typedef Documentation

◆ dt_pdf_image_t

◆ dt_pdf_page_t

typedef struct dt_pdf_page_t dt_pdf_page_t

◆ dt_pdf_stream_encoder_t

◆ dt_pdf_t

typedef struct dt_pdf_t dt_pdf_t

Enumeration Type Documentation

◆ dt_pdf_stream_encoder_t

Enumerator
DT_PDF_STREAM_ENCODER_ASCII_HEX 
DT_PDF_STREAM_ENCODER_FLATE 

Function Documentation

◆ dt_pdf_add_icc()

int dt_pdf_add_icc ( dt_pdf_t pdf,
const char *  filename 
)

◆ dt_pdf_add_icc_from_data()

int dt_pdf_add_icc_from_data ( dt_pdf_t pdf,
const unsigned char *  data,
size_t  size 
)

◆ dt_pdf_add_image()

◆ dt_pdf_add_page()

◆ dt_pdf_finish()

void dt_pdf_finish ( dt_pdf_t pdf,
dt_pdf_page_t **  pages,
int  n_pages 
)
Todo:
find something less necrophilic, maybe hash of image + history? or just of filename + date :)

References _pdf_set_offset(), dt_pdf_t::bytes_written, dt_pdf_t::fd, gmt, dt_pdf_t::next_id, dt_pdf_page_t::object_id, dt_pdf_t::offsets, PACKAGE_STRING, size, and dt_pdf_t::title.

Referenced by _create_pdf(), free_params(), and write_image().

◆ dt_pdf_parse_length()

int dt_pdf_parse_length ( const char *  str,
float *  length 
)

References dt_pdf_units, name, and SKIP_SPACES.

Referenced by _paper_size().

◆ dt_pdf_parse_paper_size()

int dt_pdf_parse_paper_size ( const char *  str,
float *  width,
float *  height 
)

◆ dt_pdf_start()

Variable Documentation

◆ [struct]

const struct { ... } dt_pdf_paper_sizes[]
Initial value:
=
{
{N_("a4"), (( ( 210 ) / 25.4 ) * 72.0), (( ( 297 ) / 25.4 ) * 72.0)},
{N_("a3"), (( ( 297 ) / 25.4 ) * 72.0), (( ( 420 ) / 25.4 ) * 72.0)},
{N_("letter"), (( 8.5 ) * 72.0), (( 11.0 ) * 72.0)},
{N_("legal"), (( 8.5 ) * 72.0), (( 14.0 ) * 72.0)},
{NULL, 0.0, 0.0}
}

Referenced by _set_paper_size(), dt_pdf_parse_paper_size(), gui_init(), and size_toggle_callback().

◆ dt_pdf_paper_sizes_n

const int dt_pdf_paper_sizes_n = sizeof(dt_pdf_paper_sizes) / sizeof(dt_pdf_paper_sizes[0]) - 1
static

◆ [struct]

const struct { ... } dt_pdf_units[]
Initial value:
=
{
{N_("mm"), (( ( 1.0 ) / 25.4 ) * 72.0)},
{N_("cm"), (( ( 10.0 ) / 25.4 ) * 72.0)},
{N_("inch"), (( 1.0 ) * 72.0)},
{N_("\""), (( 1.0 ) * 72.0)},
{NULL, 0.0}
}

Referenced by dt_pdf_parse_length(), and dt_pdf_parse_paper_size().

◆ dt_pdf_units_n

const int dt_pdf_units_n = sizeof(dt_pdf_units) / sizeof(dt_pdf_units[0])
static

◆ factor

◆ height

const float height

◆ name

const char* name

◆ width

const float width