File: gprinter.h

package info (click to toggle)
photoprint 0.4.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,568 kB
  • ctags: 4,517
  • sloc: cpp: 46,643; sh: 10,360; ansic: 4,755; makefile: 543; sed: 16
file content (90 lines) | stat: -rw-r--r-- 2,020 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * print.cpp - encapsulates printing via GIMP-Print/GutenPrint
 *
 * Copyright (c) 2004 by Alastair M. Robinson
 * Distributed under the terms of the GNU General Public License -
 * see the file named "COPYING" for more details.
 *
 */

#ifndef PRINT_H
#define PRINT_H

#include <string>

#include "support/configdb.h"
#include "support/pageextent.h"
#include "support/consumer.h"
#include "printoutput.h"
#include "support/progress.h"
#include <gutenprint/gutenprint.h>

#include "gprintersettings.h"


class ImageSource; // Forward Declaration

class GPrinter : public GPrinterSettings
{
	public:
	GPrinter(PrintOutput &output,ConfigFile *inf,const char *section);
	~GPrinter();
	void Print(ImageSource *source,int xpos,int ypos,Consumer *consumer=NULL);
	void Help();
	void SetProgress(Progress *p);
	void GetImageableArea();
	void GetSizeLimits(int &minw,int &maxw,int &minh,int &maxh);
	void SetCustomWidth(int w);
	void SetCustomHeight(int h);
	std::string GetResponseHash(Progress *p=NULL);
	protected:
	stp_image_status_t GetRow(int row,unsigned char *data);

	void get_dimensions();
	void custom_get_dimensions();
	void print_dimensions();

	ImageSource *source;
	Consumer *consumer;
	
	int xpos,ypos;

	int ptwidth, ptheight;
	int pixelwidth, pixelheight;

	int paperleft;
	int papertop;
	
	int firstrow;
	int firstpixel;

	int leftbleed;
	int rightbleed;
	int topbleed;
	int bottombleed;
	
	int minwidth;
	int maxwidth;
	int minheight;
	int maxheight;

	const stp_printer_t *the_printer;

	Progress *progress;

	/* Static members and stubs */
	static stp_image_t stpImage;
	static bool writeerror;
	static void writefunc(void *file, const char *buf, size_t bytes);
	static void Image_init(stp_image_t *img);
	static stp_image_status_t GetRowStub(stp_image_t *img, unsigned char *data,
		size_t byte_limit, int row);
	static int Image_width(stp_image_t *img);
	static int Image_height(stp_image_t *img);
	static const char *Image_get_appname(struct stp_image *image);

	void *staticinitializer;
};


#endif