PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/cairo/library/cairo_pdf_surface.e

http://github.com/tybor/Liberty
Specman e | 97 lines | 34 code | 17 blank | 46 comment | 2 complexity | 20971f77fea775de6d43da3104ed80e9 MD5 | raw file
 1note
 2	description: "PDF Surfaces -- Rendering PDF documents."
 3	copyright: "[
 4					Copyright (C) 2007-2017: Paolo Redaelli, GTK+ team
 5					
 6					This library is free software; you can redistribute it and/or
 7					modify it under the terms of the GNU Lesser General Public License
 8					as published by the Free Software Foundation; either version 2.1 of
 9					the License, or (at your option) any later version.
10					
11					This library is distributed in the hope that it will be useful, but
12					WITHOUT ANY WARRANTY; without even the implied warranty of
13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14					Lesser General Public License for more details.
15
16					You should have received a copy of the GNU Lesser General Public
17					License along with this library; if not, write to the Free Software
18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19					02110-1301 USA
20			]"
21
22	wrapped_version: "1.2.4"
23
24class CAIRO_PDF_SURFACE
25
26inherit CAIRO_SURFACE
27
28insert CAIRO_PDF_SURFACE_EXTERNALS
29
30create {ANY} make, from_external_pointer
31
32feature {} -- Creation
33	make (a_filename: STRING; a_width_in_points, an_height_in_points: REAL)
34			-- Creates a PDF surface of the specified size in points to
35			-- be written to filename.
36
37			-- `a_filename' : a filename for the PDF output (must be
38			-- writable)
39		
40			-- `a_width_in_points' : width of the surface, in points (1
41			-- point == 1/72.0 inch)
42		
43			-- `an_height_in_points' : height of the surface, in points
44			-- (1 point == 1/72.0 inch)		
45		do
46			from_external_pointer(cairo_pdf_surface_create
47										 (a_filename.to_external, a_width_in_points,an_height_in_points))
48			-- cairo_pdf_surface_create returns a pointer to the newly
49			-- created surface. The caller owns the surface and should
50			-- call cairo_surface_destroy when done with it. This
51			-- function always returns a valid pointer, but it will
52			-- return a pointer to a "nil" surface if an error such as
53			-- out of memory occurs. You can use cairo_surface_status()
54			-- to check for this.
55		end
56
57	-- TODO: cairo_pdf_surface_create_for_stream ()
58
59	-- cairo_surface_t* cairo_pdf_surface_create_for_stream
60	--                                             (cairo_write_func_t write_func,
61	--                                              void *closure,
62	--                                              double width_in_points,
63	--                                              double height_in_points);
64	--
65	--   Creates a PDF surface of the specified size in points to be written
66	--   incrementally to the stream represented by write_func and closure.
67	--
68	--   write_func :       a cairo_write_func_t to accept the output data
69	--   closure :          the closure argument for write_func
70	--   width_in_points :  width of the surface, in points (1 point == 1/72.0
71	--                      inch)
72	--   height_in_points : height of the surface, in points (1 point == 1/72.0
73	--                      inch)
74	--   Returns :          a pointer to the newly created surface. The caller owns
75	--                      the surface and should call cairo_surface_destroy when
76	--                      done with it. This function always returns a valid
77	--                      pointer, but it will return a pointer to a "nil"
78	--                      surface if an error such as out of memory occurs. You
79	--                      can use cairo_surface_status() to check for this.
80
81feature {ANY}
82	set_size (a_width_in_points, an_height_in_points: REAL)
83			-- Changes the size of a PDF surface for the current (and subsequent) pages.
84
85			-- This function should only be called before any drawing
86			-- operations have been performed on the current page. The
87			-- simplest way to do this is to call this function
88			-- immediately after creating the surface or immediately
89			-- after completing a page with either cairo_show_page() or
90			-- cairo_copy_page().
91
92			--   width_in_points :  new surface width, in points (1 point == 1/72.0 inch)
93			--   height_in_points : new surface height, in points (1 point == 1/72.0 inch)		
94		do
95			cairo_pdf_surface_set_size(handle,a_width_in_points,an_height_in_points)
96		end
97end -- class CAIRO_PDF_SURFACE