File: GtkPrintContext.Rd

package info (click to toggle)
rgtk2 2.20.36-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 33,540 kB
  • sloc: ansic: 137,163; makefile: 2; sh: 1
file content (83 lines) | stat: -rw-r--r-- 2,584 bytes parent folder | download | duplicates (2)
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
\alias{GtkPrintContext}
\name{GtkPrintContext}
\title{GtkPrintContext}
\description{Encapsulates context for drawing pages}
\section{Methods and Functions}{
\code{\link{gtkPrintContextGetCairoContext}(object)}\cr
\code{\link{gtkPrintContextSetCairoContext}(object, cr, dpi.x, dpi.y)}\cr
\code{\link{gtkPrintContextGetPageSetup}(object)}\cr
\code{\link{gtkPrintContextGetWidth}(object)}\cr
\code{\link{gtkPrintContextGetHeight}(object)}\cr
\code{\link{gtkPrintContextGetDpiX}(object)}\cr
\code{\link{gtkPrintContextGetDpiY}(object)}\cr
\code{\link{gtkPrintContextGetPangoFontmap}(object)}\cr
\code{\link{gtkPrintContextCreatePangoContext}(object)}\cr
\code{\link{gtkPrintContextCreatePangoLayout}(object)}\cr
\code{\link{gtkPrintContextGetHardMargins}(object)}\cr

}
\section{Hierarchy}{\preformatted{GObject
   +----GtkPrintContext}}
\section{Detailed Description}{A GtkPrintContext encapsulates context information that is required when
drawing pages for printing, such as the cairo context and important
parameters like page size and resolution. It also lets you easily
create \code{\link{PangoLayout}} and \code{\link{PangoContext}} objects that match the font metrics
of the cairo surface.
  
GtkPrintContext objects gets passed to the ::begin-print, ::end-print,
::request-page-setup and ::draw-page signals on the \code{\link{GtkPrintOperation}}.
  
 \emph{Using GtkPrintContext in a ::draw-page callback}
\preformatted{
draw_page <- function(operation, context, page_nr)
{
  cr <- context$getCairoContext()

  # Draw a red rectangle, as wide as the paper (inside the margins)
  cr$setSourceRgb(1.0, 0, 0)
  cr$rectangle(0, 0, context$getWidth(), 50)
  
  cr$fill()

  # Draw some lines
  cr$moveTo(20, 10)
  cr$lineTo(40, 20)
  cr$arc(60, 60, 20, 0, pi)
  cr$lineTo(80, 20)
  
  cr$setSourceRgb(0, 0, 0)
  cr$setLineWidth(5)
  cr$setLineCap("round")
  cr$setLineJoin("round")
  
  cr$stroke()

  # Draw some text
  
  layout <- context$createLayout()
  layout$setText("Hello World! Printing is easy")
  desc <- pangoFontDescriptionFromString("sans 28")
  layout$setFontDescription(desc)
  
  cr$moveTo(30, 20)
  cr$layoutPath(layout)

  # Font Outline
  cr$setSourceRgb(0.93, 1.0, 0.47)
  cr$setLineWidth(0.5)
  cr$strokePreserve()

  # Font Fill
  cr$setSourceRgb(0, 0.0, 1.0)
  cr$fill()
}
}  
Printing support was added in GTK+ 2.10.}
\section{Structures}{\describe{\item{\verb{GtkPrintContext}}{
\emph{undocumented
}

}}}
\references{\url{https://developer.gnome.org/gtk2/stable/GtkPrintContext.html}}
\author{Derived by RGtkGen from GTK+ documentation}
\keyword{internal}