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) 2021 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include <glib.h>
22#include <inttypes.h>
23#include "common/pdf.h"
24#include "common/cups_print.h"
25#include "common/image.h"
26
27
28#define MAX_IMAGE_PER_PAGE 20
29
30typedef struct _imgage_pos
31{
32 float x, y, width, height;
34
35typedef struct _image_box
36{
37 int32_t imgid;
38 int32_t max_width, max_height; // max size for the export (in pixels)
39 int32_t exp_width, exp_height; // final exported size (in pixels)
40 int32_t dis_width, dis_height; // image size on screen (in pixels)
41 int32_t img_width, img_height; // the final image size as it will be exported
43 dt_image_pos pos; // relative pos from screen.page
44 dt_image_pos screen; // current screen pos (in pixels)
45 dt_image_pos print; // current print pos (in pixels) depending on paper size + DPI
46 uint16_t *buf;
48
49typedef struct dt_screen_pos
50{
51 dt_image_pos page; // this is for reference and is the box of the
52 // white page (in pixels) in print module.
53 // it is the full page.
54
55 dt_image_pos print_area; // this is for reference and is the box of the
56 // grey area in the white page (in pixels) in print
57 // module. it is the print area (without margins).
58 gboolean borderless; // whether the print is borderless (user's margins below
59 // hardware margins.
61
62typedef struct dt_images_box
63{
65 int32_t motion_over;
66 int count;
68 float page_width, page_height; // full print page in pixels
69 float page_width_mm, page_height_mm; // full print page in mm
72
73// return the box index or -1 if (x, y) coordinate is not over an image
74int32_t dt_printing_get_image_box(const dt_images_box *imgs, const int x, const int y);
75
78
79/* (x, y) -> (width, height) are in pixels (on screen position) */
81 const float px, const float py, const float pwidth, const float pheight,
82 const float ax, const float ay, const float awidth, const float aheight, gboolean borderless);
83
84void dt_printing_setup_box(dt_images_box *imgs, const int idx,
85 const float x, const float y,
86 const float width, const float height);
87
88/* page_width page_height in mm, compute the max_width and max_height in
89 pixels for the image */
91 const float page_width, const float page_height,
92 const int resolution);
93
94/* setup the image id and exported width x height */
95void dt_printing_setup_image(dt_images_box *imgs, const int idx,
96 const int32_t imgid, const int32_t width, const int32_t height,
97 const dt_alignment_t alignment);
98
99/* return the on screen pos with alignement */
100void dt_printing_get_screen_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos);
102void dt_printing_get_image_pos_mm(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos);
103void dt_printing_get_image_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos);
104
105// clang-format off
106// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
107// vim: shiftwidth=2 expandtab tabstop=2 cindent
108// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
109// clang-format on
110
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
dt_alignment_t
Definition cups_print.h:25
void dt_printing_get_screen_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:242
#define MAX_IMAGE_PER_PAGE
Definition printing.h:28
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:106
void dt_printing_get_image_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:270
int32_t dt_printing_get_image_box(const dt_images_box *imgs, const int x, const int y)
Definition printing.c:57
void dt_printing_clear_box(dt_image_box *img)
Definition printing.c:27
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:143
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:282
void dt_printing_get_screen_rel_pos(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:249
void dt_printing_setup_page(dt_images_box *imgs, const float page_width, const float page_height, const int resolution)
Definition printing.c:177
void dt_printing_clear_boxes(dt_images_box *imgs)
Definition printing.c:42
void dt_printing_get_image_pos_mm(const dt_images_box *imgs, const dt_image_box *img, dt_image_pos *pos)
Definition printing.c:258
struct _image_box dt_image_box
Definition printing.h:36
dt_image_pos screen
Definition printing.h:44
int32_t dis_width
Definition printing.h:40
int32_t exp_height
Definition printing.h:39
int32_t exp_width
Definition printing.h:39
int32_t dis_height
Definition printing.h:40
dt_alignment_t alignment
Definition printing.h:42
int32_t max_width
Definition printing.h:38
int32_t img_height
Definition printing.h:41
int32_t imgid
Definition printing.h:37
dt_image_pos pos
Definition printing.h:43
int32_t max_height
Definition printing.h:38
uint16_t * buf
Definition printing.h:46
int32_t img_width
Definition printing.h:41
dt_image_pos print
Definition printing.h:45
Definition printing.h:31
float width
Definition printing.h:32
float x
Definition printing.h:32
float height
Definition printing.h:32
float y
Definition printing.h:32
Definition printing.h:63
float page_height
Definition printing.h:68
int32_t imgid_to_load
Definition printing.h:64
float page_width
Definition printing.h:68
dt_image_box box[20]
Definition printing.h:67
int count
Definition printing.h:66
int32_t motion_over
Definition printing.h:65
dt_screen_pos screen
Definition printing.h:70
float page_width_mm
Definition printing.h:69
float page_height_mm
Definition printing.h:69
Definition printing.h:50
gboolean borderless
Definition printing.h:58
dt_image_pos print_area
Definition printing.h:55
dt_image_pos page
Definition printing.h:51