Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
printing.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010-2011 Henrik Andersson.
4 Copyright (C) 2010 johannes hanika.
5 Copyright (C) 2010 Pascal de Bruijn.
6 Copyright (C) 2012 Richard Wonka.
7 Copyright (C) 2013-2014 Jérémy Rosen.
8 Copyright (C) 2014-2015, 2020-2021 Pascal Obry.
9 Copyright (C) 2015-2017 Tobias Ellinghaus.
10 Copyright (C) 2016 Roman Lebedev.
11 Copyright (C) 2022 Martin Bařinka.
12
13 darktable is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 darktable is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with darktable. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#pragma once
28
29#include <glib.h>
30#include <inttypes.h>
31#include "common/pdf.h"
32#include "common/cups_print.h"
33#include "common/image.h"
34
35
36#define MAX_IMAGE_PER_PAGE 20
37
38typedef struct _imgage_pos
39{
40 float x, y, width, height;
42
43typedef struct _image_box
44{
45 int32_t imgid;
46 int32_t max_width, max_height; // max size for the export (in pixels)
47 int32_t exp_width, exp_height; // final exported size (in pixels)
48 int32_t dis_width, dis_height; // image size on screen (in pixels)
49 int32_t img_width, img_height; // the final image size as it will be exported
51 dt_image_pos pos; // relative pos from screen.page
52 dt_image_pos screen; // current screen pos (in pixels)
53 dt_image_pos print; // current print pos (in pixels) depending on paper size + DPI
54 uint16_t *buf;
56
57typedef struct dt_screen_pos
58{
59 dt_image_pos page; // this is for reference and is the box of the
60 // white page (in pixels) in print module.
61 // it is the full page.
62
63 dt_image_pos print_area; // this is for reference and is the box of the
64 // grey area in the white page (in pixels) in print
65 // module. it is the print area (without margins).
66 gboolean borderless; // whether the print is borderless (user's margins below
67 // hardware margins.
69
70typedef struct dt_images_box
71{
73 int32_t motion_over;
74 int count;
76 float page_width, page_height; // full print page in pixels
77 float page_width_mm, page_height_mm; // full print page in mm
80
81// return the box index or -1 if (x, y) coordinate is not over an image
82int32_t dt_printing_get_image_box(const dt_images_box *imgs, const int x, const int y);
83
86
87/* (x, y) -> (width, height) are in pixels (on screen position) */
89 const float px, const float py, const float pwidth, const float pheight,
90 const float ax, const float ay, const float awidth, const float aheight, gboolean borderless);
91
92void dt_printing_setup_box(dt_images_box *imgs, const int idx,
93 const float x, const float y,
94 const float width, const float height);
95
96/* page_width page_height in mm, compute the max_width and max_height in
97 pixels for the image */
99 const float page_width, const float page_height,
100 const int resolution);
101
102/* setup the image id and exported width x height */
103void dt_printing_setup_image(dt_images_box *imgs, const int idx,
104 const int32_t imgid, const int32_t width, const int32_t height,
105 const dt_alignment_t alignment);
106
107/* return the on screen pos with alignement */
108void dt_printing_get_screen_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos);
110void dt_printing_get_image_pos_mm(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos);
111void dt_printing_get_image_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos);
112
113// clang-format off
114// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
115// vim: shiftwidth=2 expandtab tabstop=2 cindent
116// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
117// clang-format on
118
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
dt_alignment_t
Definition cups_print.h:30
static const float x
Definition iop_profile.h:239
void dt_printing_get_screen_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:250
#define MAX_IMAGE_PER_PAGE
Definition printing.h:36
void dt_printing_setup_display(dt_images_box *imgs, const float px, const float py, const float pwidth, const float pheight, const float ax, const float ay, const float awidth, const float aheight, gboolean borderless)
Definition printing.c:114
void dt_printing_get_image_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:278
int32_t dt_printing_get_image_box(const dt_images_box *imgs, const int x, const int y)
Definition printing.c:65
void dt_printing_clear_box(dt_image_box *img)
Definition printing.c:35
struct _imgage_pos dt_image_pos
void dt_printing_setup_box(dt_images_box *imgs, const int idx, const float x, const float y, const float width, const float height)
Definition printing.c:151
void dt_printing_setup_image(dt_images_box *imgs, const int idx, const int32_t imgid, const int32_t width, const int32_t height, const dt_alignment_t alignment)
Definition printing.c:290
void dt_printing_get_screen_rel_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:257
void dt_printing_setup_page(dt_images_box *imgs, const float page_width, const float page_height, const int resolution)
Definition printing.c:185
void dt_printing_clear_boxes(dt_images_box *imgs)
Definition printing.c:50
void dt_printing_get_image_pos_mm(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:266
struct _image_box dt_image_box
Definition printing.h:44
dt_image_pos screen
Definition printing.h:52
int32_t dis_width
Definition printing.h:48
int32_t exp_height
Definition printing.h:47
int32_t exp_width
Definition printing.h:47
int32_t dis_height
Definition printing.h:48
dt_alignment_t alignment
Definition printing.h:50
int32_t max_width
Definition printing.h:46
int32_t img_height
Definition printing.h:49
int32_t imgid
Definition printing.h:45
dt_image_pos pos
Definition printing.h:51
int32_t max_height
Definition printing.h:46
uint16_t * buf
Definition printing.h:54
int32_t img_width
Definition printing.h:49
dt_image_pos print
Definition printing.h:53
Definition printing.h:39
float width
Definition printing.h:40
float x
Definition printing.h:40
float height
Definition printing.h:40
float y
Definition printing.h:40
Definition printing.h:71
float page_height
Definition printing.h:76
int32_t imgid_to_load
Definition printing.h:72
float page_width
Definition printing.h:76
dt_image_box box[20]
Definition printing.h:75
int count
Definition printing.h:74
int32_t motion_over
Definition printing.h:73
dt_screen_pos screen
Definition printing.h:78
float page_width_mm
Definition printing.h:77
float page_height_mm
Definition printing.h:77
Definition printing.h:58
gboolean borderless
Definition printing.h:66
dt_image_pos print_area
Definition printing.h:63
dt_image_pos page
Definition printing.h:59