annotate libinterp/corefcn/gl2ps-renderer.h @ 17797:06a850f83dd4

build: Remove embedded gl2ps. Require gl2ps as external dependency. * NEWS: Announce that gl2ps is no longer distributed with Octave. * build-aux/common.mk: New AC_SUBST macro GL2PS_LIBS. * configure.ac: When building native graphics, test for gl2ps.h header. If not found, print a warning and disable printing of FLTK figures. * libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h: Only compile files if HAVE_GL2PS_H is true. * libinterp/dldfcn/__init_fltk__.cc(draw): Use #ifdef HAVE_GL2PS_H to either print figure, or issue a warning when gl2ps is not available. * libinterp/link-deps.mk: Add GL2PS_LIBS to libinter link dependencies * libinterp/corefcn/module.mk: Remove gl2ps.h, gl2ps.c from build system. * libinterp/corefcn/gl2ps.c, libinterp/corefcn/gl2ps.h: Removed from distribution.
author Rik <rik@octave.org>
date Tue, 29 Oct 2013 15:16:23 -0700
parents 175b392e91fe
children ebb3ef964372
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
1 /*
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 16892
diff changeset
3 Copyright (C) 2009-2013 Shai Ayal
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
4
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
5 This file is part of Octave.
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
6
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
10 option) any later version.
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
11
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
15 for more details.
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
16
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
20
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
21 */
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
22
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
23 #if !defined (gl2ps_renderer_h)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
24 #define gl2ps_renderer_h 1
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
25
17797
06a850f83dd4 build: Remove embedded gl2ps. Require gl2ps as external dependency.
Rik <rik@octave.org>
parents: 17787
diff changeset
26 #ifdef HAVE_GL2PS_H
06a850f83dd4 build: Remove embedded gl2ps. Require gl2ps as external dependency.
Rik <rik@octave.org>
parents: 17787
diff changeset
27
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
28 #include "gl-render.h"
17797
06a850f83dd4 build: Remove embedded gl2ps. Require gl2ps as external dependency.
Rik <rik@octave.org>
parents: 17787
diff changeset
29 #include <gl2ps.h>
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
30
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
31 class
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
32 OCTINTERP_API
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
33 glps_renderer : public opengl_renderer
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
34 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
35 public:
14418
933101fd5cbb Use file descriptor instead of a FILE pointer for OpenGL printing.
John W. Eaton <jwe@octave.org>
parents: 14380
diff changeset
36 glps_renderer (FILE *_fp, const std::string& _term)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
37 : opengl_renderer () , fp (_fp), term (_term), fontsize (), fontname () { }
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
38
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
39 ~glps_renderer (void) { }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
40
16732
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
41 void draw (const graphics_object& go, const std::string print_cmd);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
42
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
43 protected:
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
44
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
45 Matrix render_text (const std::string& txt,
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
46 double x, double y, double z,
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
47 int halign, int valign, double rotation = 0.0);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
48
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
49 void set_font (const base_properties& props);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
50
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
51 void draw_text (const text::properties& props);
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
52 void draw_pixels (GLsizei w, GLsizei h, GLenum format,
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
53 GLenum type, const GLvoid *data);
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
54
14380
81183cd6eaae Fix OpenGL printing of dashed lines (Bug #33765).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
55 void set_linestyle (const std::string& s, bool use_stipple = false)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
56 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
57 opengl_renderer::set_linestyle (s, use_stipple);
14380
81183cd6eaae Fix OpenGL printing of dashed lines (Bug #33765).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
58
81183cd6eaae Fix OpenGL printing of dashed lines (Bug #33765).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
59 if (s == "-" && ! use_stipple)
81183cd6eaae Fix OpenGL printing of dashed lines (Bug #33765).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
60 gl2psDisable (GL2PS_LINE_STIPPLE);
81183cd6eaae Fix OpenGL printing of dashed lines (Bug #33765).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
61 else
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
62 gl2psEnable (GL2PS_LINE_STIPPLE);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
63 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
64
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
65 void set_polygon_offset (bool on, double offset = 0.0)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
66 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
67 opengl_renderer::set_polygon_offset (on, offset);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
68 if (on)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
69 gl2psEnable (GL2PS_POLYGON_OFFSET_FILL);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
70 else
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
71 gl2psDisable (GL2PS_POLYGON_OFFSET_FILL);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
72 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
73
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
74 void set_linewidth (float w)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
75 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
76 gl2psLineWidth (w);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
77 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
78
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
79 private:
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
80 int alignment_to_mode (int ha, int va) const;
14418
933101fd5cbb Use file descriptor instead of a FILE pointer for OpenGL printing.
John W. Eaton <jwe@octave.org>
parents: 14380
diff changeset
81 FILE *fp;
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10313
diff changeset
82 caseless_str term;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
83 double fontsize;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
84 std::string fontname;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
85 };
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
86
17797
06a850f83dd4 build: Remove embedded gl2ps. Require gl2ps as external dependency.
Rik <rik@octave.org>
parents: 17787
diff changeset
87 #endif // HAVE_GL2PS_H
06a850f83dd4 build: Remove embedded gl2ps. Require gl2ps as external dependency.
Rik <rik@octave.org>
parents: 17787
diff changeset
88
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
89 #endif