1 /* 2 This file is part of darktable, 3 Copyright (C) 2014-2020 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 <common/colorspaces.h> 22 23 #define MAX_NAME 128 24 25 typedef enum dt_alignment_t { 26 ALIGNMENT_TOP_LEFT, 27 ALIGNMENT_TOP, 28 ALIGNMENT_TOP_RIGHT, 29 ALIGNMENT_LEFT, 30 ALIGNMENT_CENTER, 31 ALIGNMENT_RIGHT, 32 ALIGNMENT_BOTTOM_LEFT, 33 ALIGNMENT_BOTTOM, 34 ALIGNMENT_BOTTOM_RIGHT 35 } dt_alignment_t; 36 37 typedef struct dt_paper_info_t 38 { 39 char name[MAX_NAME], common_name[MAX_NAME]; 40 double width, height; 41 } dt_paper_info_t; 42 43 typedef struct dt_medium_info_t 44 { 45 char name[MAX_NAME], common_name[MAX_NAME]; 46 } dt_medium_info_t; 47 48 typedef struct dt_page_setup_t 49 { 50 gboolean landscape; 51 double margin_top, margin_bottom, margin_left, margin_right; 52 } dt_page_setup_t; 53 54 typedef struct dt_printer_info_t 55 { 56 char name[MAX_NAME]; 57 int resolution; 58 double hw_margin_top, hw_margin_bottom, hw_margin_left, hw_margin_right; 59 dt_iop_color_intent_t intent; 60 char profile[256]; 61 gboolean is_turboprint; 62 } dt_printer_info_t; 63 64 typedef struct dt_print_info_t 65 { 66 dt_printer_info_t printer; 67 dt_page_setup_t page; 68 dt_paper_info_t paper; 69 dt_medium_info_t medium; 70 } dt_print_info_t; 71 72 // Asynchronous printer discovery, cb will be called for each printer found 73 void dt_printers_discovery(void (*cb)(dt_printer_info_t *pr, void *user_data), void *user_data); 74 void dt_printers_abort_discovery(void); 75 76 // initialize the pinfo structure 77 void dt_init_print_info(dt_print_info_t *pinfo); 78 79 // get printer information for the given printer name 80 void dt_get_printer_info(const char *printer_name, dt_printer_info_t *pinfo); 81 82 // get all available papers for the given printer 83 GList *dt_get_papers(const dt_printer_info_t *printer); 84 85 // get paper information for the given paper name 86 dt_paper_info_t *dt_get_paper(GList *papers, const char *name); 87 88 // get all available media type for the given printer 89 GList *dt_get_media_type(const dt_printer_info_t *printer); 90 91 // get paper information for the given paper name 92 dt_medium_info_t *dt_get_medium(GList *media, const char *name); 93 94 // print filename using the printer and the page size and setup 95 void dt_print_file(const int32_t imgid, const char *filename, const char *job_title, const dt_print_info_t *pinfo); 96 97 // given the page settings (media size and border) and the printer (hardware margins) returns the 98 // page and printable area layout in the area_width and area_height (the area that dt allocate 99 // for the central display). 100 // - the page area (px, py, pwidth, pheight) 101 // - the printable area (ax, ay, awidth and aheight), the area without the borders 102 // there is no unit, every returned values are based on the area size. 103 void dt_get_print_layout(const dt_print_info_t *prt, 104 const int32_t area_width, const int32_t area_height, 105 float *px, float *py, float *pwidth, float *pheight, 106 float *ax, float *ay, float *awidth, float *aheight, 107 gboolean *borderless); 108 109 // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh 110 // vim: shiftwidth=2 expandtab tabstop=2 cindent 111 // kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified; 112