annotate libinterp/corefcn/gl2ps-renderer.cc @ 16892:68fc671a9339

maint: Collapse interpfcn and interpfcn-core directories into corefcn directory. * libgui/src/module.mk: Remove -I references to interp-core, interpfcn, add reference to corefcn. * libinterp/Makefile.am: Remove -I references to interp-core, interpfcn, add reference to corefcn. * libinterp/corefcn/module.mk: Add files from interp-core, interpfcn to build system. Copy over special rules from module.mk files in interp-core andd interpfcn. * src/Makefile.am: Replace references to interp-core, interpfcn with those to corefcn. * libinterp/corefcn/Cell.cc, libinterp/corefcn/Cell.h, libinterp/corefcn/action-container.h, libinterp/corefcn/c-file-ptr-stream.cc, libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/comment-list.cc, libinterp/corefcn/comment-list.h, libinterp/corefcn/cutils.c, libinterp/corefcn/cutils.h, libinterp/corefcn/data.cc, libinterp/corefcn/data.h, libinterp/corefcn/debug.cc, libinterp/corefcn/debug.h, libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h, libinterp/corefcn/defun-dld.h, libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc, libinterp/corefcn/defun.h, libinterp/corefcn/dirfns.cc, libinterp/corefcn/dirfns.h, libinterp/corefcn/display.cc, libinterp/corefcn/display.h, libinterp/corefcn/dynamic-ld.cc, libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/error.cc, libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h, libinterp/corefcn/file-io.cc, libinterp/corefcn/file-io.h, libinterp/corefcn/gl-render.cc, libinterp/corefcn/gl-render.h, libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h, libinterp/corefcn/gl2ps.c, libinterp/corefcn/gl2ps.h, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h, libinterp/corefcn/help.cc, libinterp/corefcn/help.h, libinterp/corefcn/hook-fcn.cc, libinterp/corefcn/hook-fcn.h, libinterp/corefcn/input.cc, libinterp/corefcn/input.h, libinterp/corefcn/jit-ir.cc, libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc, libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.cc, libinterp/corefcn/jit-util.h, libinterp/corefcn/load-path.cc, libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc, libinterp/corefcn/load-save.h, libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-ascii-helper.h, libinterp/corefcn/ls-hdf5.cc, libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc, libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc, libinterp/corefcn/ls-mat4.h, libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h, libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/ls-oct-ascii.h, libinterp/corefcn/ls-oct-binary.cc, libinterp/corefcn/ls-oct-binary.h, libinterp/corefcn/ls-utils.cc, libinterp/corefcn/ls-utils.h, libinterp/corefcn/matherr.c, libinterp/corefcn/mex.cc, libinterp/corefcn/mex.h, libinterp/corefcn/mexproto.h, libinterp/corefcn/mxarray.in.h, libinterp/corefcn/oct-errno.h, libinterp/corefcn/oct-errno.in.cc, libinterp/corefcn/oct-fstrm.cc, libinterp/corefcn/oct-fstrm.h, libinterp/corefcn/oct-hdf5.h, libinterp/corefcn/oct-hist.cc, libinterp/corefcn/oct-hist.h, libinterp/corefcn/oct-iostrm.cc, libinterp/corefcn/oct-iostrm.h, libinterp/corefcn/oct-lvalue.cc, libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.cc, libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-prcstrm.cc, libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-procbuf.cc, libinterp/corefcn/oct-procbuf.h, libinterp/corefcn/oct-stdstrm.h, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h, libinterp/corefcn/oct-strstrm.cc, libinterp/corefcn/oct-strstrm.h, libinterp/corefcn/oct.h, libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h, libinterp/corefcn/pager.cc, libinterp/corefcn/pager.h, libinterp/corefcn/pr-output.cc, libinterp/corefcn/pr-output.h, libinterp/corefcn/procstream.cc, libinterp/corefcn/procstream.h, libinterp/corefcn/profiler.cc, libinterp/corefcn/profiler.h, libinterp/corefcn/pt-jit.cc, libinterp/corefcn/pt-jit.h, libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h, libinterp/corefcn/siglist.c, libinterp/corefcn/siglist.h, libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h, libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse-xpow.h, libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h, libinterp/corefcn/sysdep.cc, libinterp/corefcn/sysdep.h, libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h, libinterp/corefcn/txt-eng-ft.cc, libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h, libinterp/corefcn/unwind-prot.cc, libinterp/corefcn/unwind-prot.h, libinterp/corefcn/utils.cc, libinterp/corefcn/utils.h, libinterp/corefcn/variables.cc, libinterp/corefcn/variables.h, libinterp/corefcn/workspace-element.h, libinterp/corefcn/xdiv.cc, libinterp/corefcn/xdiv.h, libinterp/corefcn/xgl2ps.c, libinterp/corefcn/xnorm.cc, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc, libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc, libinterp/corefcn/zfstream.h: Files moved from interp-core and interpfcn directories. * libinterp/interp-core/Cell.cc, libinterp/interp-core/Cell.h, libinterp/interp-core/action-container.h, libinterp/interp-core/c-file-ptr-stream.cc, libinterp/interp-core/c-file-ptr-stream.h, libinterp/interp-core/comment-list.cc, libinterp/interp-core/comment-list.h, libinterp/interp-core/cutils.c, libinterp/interp-core/cutils.h, libinterp/interp-core/defun-dld.h, libinterp/interp-core/defun-int.h, libinterp/interp-core/display.cc, libinterp/interp-core/display.h, libinterp/interp-core/dynamic-ld.cc, libinterp/interp-core/dynamic-ld.h, libinterp/interp-core/event-queue.h, libinterp/interp-core/gl-render.cc, libinterp/interp-core/gl-render.h, libinterp/interp-core/gl2ps-renderer.cc, libinterp/interp-core/gl2ps-renderer.h, libinterp/interp-core/gl2ps.c, libinterp/interp-core/gl2ps.h, libinterp/interp-core/gripes.cc, libinterp/interp-core/gripes.h, libinterp/interp-core/jit-ir.cc, libinterp/interp-core/jit-ir.h, libinterp/interp-core/jit-typeinfo.cc, libinterp/interp-core/jit-typeinfo.h, libinterp/interp-core/jit-util.cc, libinterp/interp-core/jit-util.h, libinterp/interp-core/ls-ascii-helper.cc, libinterp/interp-core/ls-ascii-helper.h, libinterp/interp-core/ls-hdf5.cc, libinterp/interp-core/ls-hdf5.h, libinterp/interp-core/ls-mat-ascii.cc, libinterp/interp-core/ls-mat-ascii.h, libinterp/interp-core/ls-mat4.cc, libinterp/interp-core/ls-mat4.h, libinterp/interp-core/ls-mat5.cc, libinterp/interp-core/ls-mat5.h, libinterp/interp-core/ls-oct-binary.cc, libinterp/interp-core/ls-oct-binary.h, libinterp/interp-core/ls-utils.cc, libinterp/interp-core/ls-utils.h, libinterp/interp-core/matherr.c, libinterp/interp-core/mex.cc, libinterp/interp-core/mex.h, libinterp/interp-core/mexproto.h, libinterp/interp-core/module.mk, libinterp/interp-core/mxarray.in.h, libinterp/interp-core/oct-errno.h, libinterp/interp-core/oct-errno.in.cc, libinterp/interp-core/oct-fstrm.cc, libinterp/interp-core/oct-fstrm.h, libinterp/interp-core/oct-hdf5.h, libinterp/interp-core/oct-iostrm.cc, libinterp/interp-core/oct-iostrm.h, libinterp/interp-core/oct-lvalue.cc, libinterp/interp-core/oct-lvalue.h, libinterp/interp-core/oct-map.cc, libinterp/interp-core/oct-map.h, libinterp/interp-core/oct-obj.cc, libinterp/interp-core/oct-obj.h, libinterp/interp-core/oct-prcstrm.cc, libinterp/interp-core/oct-prcstrm.h, libinterp/interp-core/oct-procbuf.cc, libinterp/interp-core/oct-procbuf.h, libinterp/interp-core/oct-stdstrm.h, libinterp/interp-core/oct-stream.cc, libinterp/interp-core/oct-stream.h, libinterp/interp-core/oct-strstrm.cc, libinterp/interp-core/oct-strstrm.h, libinterp/interp-core/oct.h, libinterp/interp-core/procstream.cc, libinterp/interp-core/procstream.h, libinterp/interp-core/pt-jit.cc, libinterp/interp-core/pt-jit.h, libinterp/interp-core/siglist.c, libinterp/interp-core/siglist.h, libinterp/interp-core/sparse-xdiv.cc, libinterp/interp-core/sparse-xdiv.h, libinterp/interp-core/sparse-xpow.cc, libinterp/interp-core/sparse-xpow.h, libinterp/interp-core/txt-eng-ft.cc, libinterp/interp-core/txt-eng-ft.h, libinterp/interp-core/txt-eng.h, libinterp/interp-core/unwind-prot.cc, libinterp/interp-core/unwind-prot.h, libinterp/interp-core/xdiv.cc, libinterp/interp-core/xdiv.h, libinterp/interp-core/xgl2ps.c, libinterp/interp-core/xnorm.cc, libinterp/interp-core/xnorm.h, libinterp/interp-core/xpow.cc, libinterp/interp-core/xpow.h, libinterp/interp-core/zfstream.cc, libinterp/interp-core/zfstream.h, libinterp/interpfcn/data.cc, libinterp/interpfcn/data.h, libinterp/interpfcn/debug.cc, libinterp/interpfcn/debug.h, libinterp/interpfcn/defaults.cc, libinterp/interpfcn/defaults.in.h, libinterp/interpfcn/defun.cc, libinterp/interpfcn/defun.h, libinterp/interpfcn/dirfns.cc, libinterp/interpfcn/dirfns.h, libinterp/interpfcn/error.cc, libinterp/interpfcn/error.h, libinterp/interpfcn/file-io.cc, libinterp/interpfcn/file-io.h, libinterp/interpfcn/graphics.cc, libinterp/interpfcn/graphics.in.h, libinterp/interpfcn/help.cc, libinterp/interpfcn/help.h, libinterp/interpfcn/hook-fcn.cc, libinterp/interpfcn/hook-fcn.h, libinterp/interpfcn/input.cc, libinterp/interpfcn/input.h, libinterp/interpfcn/load-path.cc, libinterp/interpfcn/load-path.h, libinterp/interpfcn/load-save.cc, libinterp/interpfcn/load-save.h, libinterp/interpfcn/ls-oct-ascii.cc, libinterp/interpfcn/ls-oct-ascii.h, libinterp/interpfcn/module.mk, libinterp/interpfcn/oct-hist.cc, libinterp/interpfcn/oct-hist.h, libinterp/interpfcn/octave-link.cc, libinterp/interpfcn/octave-link.h, libinterp/interpfcn/pager.cc, libinterp/interpfcn/pager.h, libinterp/interpfcn/pr-output.cc, libinterp/interpfcn/pr-output.h, libinterp/interpfcn/profiler.cc, libinterp/interpfcn/profiler.h, libinterp/interpfcn/sighandlers.cc, libinterp/interpfcn/sighandlers.h, libinterp/interpfcn/symtab.cc, libinterp/interpfcn/symtab.h, libinterp/interpfcn/sysdep.cc, libinterp/interpfcn/sysdep.h, libinterp/interpfcn/toplev.cc, libinterp/interpfcn/toplev.h, libinterp/interpfcn/utils.cc, libinterp/interpfcn/utils.h, libinterp/interpfcn/variables.cc, libinterp/interpfcn/variables.h, libinterp/interpfcn/workspace-element.h: deleted files.
author Rik <rik@octave.org>
date Wed, 03 Jul 2013 17:43:48 -0700
parents libinterp/interp-core/gl2ps-renderer.cc@3806afcf974a
children d63878346099
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
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13141
diff changeset
3 Copyright (C) 2009-2012 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 #ifdef HAVE_CONFIG_H
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
24 #include <config.h>
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
25 #endif
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
26
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
27 #if defined (HAVE_OPENGL)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
28
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
29 #include <cstdio>
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
30
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
31 #include "lo-mappers.h"
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
32 #include "oct-locbuf.h"
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
33
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
34 #include "gl2ps-renderer.h"
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
35 #include "gl2ps.h"
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
36
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
37 void
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
38 glps_renderer::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
39 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
40 static bool in_draw = false;
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 static std::string old_print_cmd;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
42
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
43 if (!in_draw)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
44 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
45 in_draw = true;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
46
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
47 GLint buffsize = 0, state = GL2PS_OVERFLOW;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
48 GLint viewport[4];
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
49
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
50 glGetIntegerv (GL_VIEWPORT, viewport);
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
51
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
52 GLint gl2ps_term;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
53 if (term.find ("eps") != std::string::npos) gl2ps_term = GL2PS_EPS;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
54 else if (term.find ("pdf") != std::string::npos) gl2ps_term = GL2PS_PDF;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
55 else if (term.find ("svg") != std::string::npos) gl2ps_term = GL2PS_SVG;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
56 else if (term.find ("ps") != std::string::npos) gl2ps_term = GL2PS_PS;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
57 else if (term.find ("pgf") != std::string::npos) gl2ps_term = GL2PS_PGF;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
58 else if (term.find ("tex") != std::string::npos) gl2ps_term = GL2PS_TEX;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
59 else
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
60 {
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
61 error ("gl2ps-renderer:: Unknown terminal");
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
62 return;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
63 }
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
64
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
65 GLint gl2ps_text = 0;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
66 if (term.find ("notxt") != std::string::npos) gl2ps_text = GL2PS_NO_TEXT;
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
67
14389
6b2448555bbd Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents: 14203
diff changeset
68 // Default sort order optimizes for 3D plots
6b2448555bbd Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents: 14203
diff changeset
69 GLint gl2ps_sort = GL2PS_BSP_SORT;
6b2448555bbd Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents: 14203
diff changeset
70 if (term.find ("is2D") != std::string::npos) gl2ps_sort = GL2PS_NO_SORT;
6b2448555bbd Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents: 14203
diff changeset
71
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
72 while (state == GL2PS_OVERFLOW)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
73 {
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
74 // For LaTeX output the fltk print process uses two drawnow() commands.
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
75 // The first one is for the pdf/ps/eps graph to be included. The print_cmd
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
76 // is saved as old_print_cmd. Then the second drawnow() outputs the tex-file
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
77 // and the graphic filename to be included is extracted from old_print_cmd.
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
78 std::string include_graph;
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
79 std::size_t found_redirect = old_print_cmd.find (">");
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
80 if (found_redirect != std::string::npos)
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
81 include_graph = old_print_cmd.substr (found_redirect + 1);
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
82 else
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
83 include_graph = old_print_cmd;
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
84 std::size_t n_begin = include_graph.find_first_not_of (" ");
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
85 if (n_begin != std::string::npos)
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
86 {
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
87 std::size_t n_end = include_graph.find_last_not_of (" ");
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
88 include_graph = include_graph.substr (n_begin, n_end - n_begin + 1);
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
89 }
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
90 else
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
91 include_graph = "foobar-inc";
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
92 buffsize += 1024*1024;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
93 gl2psBeginPage ("glps_renderer figure", "Octave", viewport,
14389
6b2448555bbd Fix Z-order stacking of axis background for FLTK printing (bug #35559)
Rik <octave@nomad.inbox5.com>
parents: 14203
diff changeset
94 gl2ps_term, gl2ps_sort,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
95 (GL2PS_SILENT | GL2PS_SIMPLE_LINE_OFFSET
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
96 | GL2PS_NO_BLENDING | GL2PS_OCCLUSION_CULL
14203
81ee6b12adbc Disable the PS Level 3 shading feature in gl2ps.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
97 | GL2PS_BEST_ROOT | gl2ps_text
81ee6b12adbc Disable the PS Level 3 shading feature in gl2ps.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
98 | GL2PS_NO_PS3_SHADING),
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10464
diff changeset
99 GL_RGBA, 0, NULL, 0, 0, 0,
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
100 buffsize, fp, include_graph.c_str ());
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 15195
diff changeset
101 old_print_cmd = print_cmd;
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
102 opengl_renderer::draw (go);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
103 state = gl2psEndPage ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
104 }
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
105
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
106 in_draw = 0;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
107 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
108 else
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
109 opengl_renderer::draw (go);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
110 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
111
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
112 int
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
113 glps_renderer::alignment_to_mode (int ha, int va) const
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
114 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
115 int gl2psa=GL2PS_TEXT_BL;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
116 if (ha == 0)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
117 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
118 if (va == 0 || va == 3)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
119 gl2psa=GL2PS_TEXT_BL;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
120 else if (va == 2)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
121 gl2psa=GL2PS_TEXT_TL;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
122 else if (va == 1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
123 gl2psa=GL2PS_TEXT_CL;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
124 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
125 else if (ha == 2)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
126 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
127 if (va == 0 || va == 3)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
128 gl2psa=GL2PS_TEXT_BR;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
129 else if (va == 2)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
130 gl2psa=GL2PS_TEXT_TR;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
131 else if (va == 1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
132 gl2psa=GL2PS_TEXT_CR;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
133 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
134 else if (ha == 1)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
135 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
136 if (va == 0 || va == 3)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
137 gl2psa=GL2PS_TEXT_B;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
138 else if (va == 2)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
139 gl2psa=GL2PS_TEXT_T;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
140 else if (va == 1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
141 gl2psa=GL2PS_TEXT_C;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
142 }
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
143 return gl2psa;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
144 }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
145
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
146 Matrix
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
147 glps_renderer::render_text (const std::string& txt,
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
148 double x, double y, double z,
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
149 int ha, int va, double rotation)
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
150 {
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
151 if (txt.empty ())
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
152 return Matrix (1, 4, 0.0);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
153
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
154 glRasterPos3d (x, y, z);
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
155 gl2psTextOpt (txt.c_str (), fontname.c_str (), fontsize,
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
156 alignment_to_mode (ha, va), rotation);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
157
9834
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
158 // FIXME? -- we have no way of getting a bounding box from gl2ps, so
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
159 // we use freetype
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
160 Matrix bbox;
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
161 uint8NDArray pixels;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
162 text_to_pixels (txt, pixels, bbox, 0, 0, rotation);
9834
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
163 return bbox;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
164 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
165
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
166 void
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
167 glps_renderer::set_font (const base_properties& props)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
168 {
9834
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
169 opengl_renderer::set_font (props);
92d8f35ff217 compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
170
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
171 fontsize = props.get ("fontsize").double_value ();
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
172
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
173 caseless_str fn = props.get ("fontname").string_value ();
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
174 fontname = "";
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
175 if (fn == "times" || fn == "times-roman")
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
176 fontname = "Times-Roman";
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
177 else if (fn == "courier")
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
178 fontname = "Courier";
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
179 else if (fn == "symbol")
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
180 fontname = "Symbol";
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
181 else if (fn == "zapfdingbats")
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
182 fontname = "ZapfDingbats";
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
183 else
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
184 fontname = "Helvetica";
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
185
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
186 // FIXME -- add support for bold and italic
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
187 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
188
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
189 template <typename T>
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
190 static void
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
191 draw_pixels (GLsizei w, GLsizei h, GLenum format, const T *data)
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
192 {
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
193 OCTAVE_LOCAL_BUFFER (GLfloat, a, 3*w*h);
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
194
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
195 for (int i = 0; i < 3*w*h; i++)
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
196 a[i] = data[i];
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
197
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
198 gl2psDrawPixels (w, h, 0, 0, format, GL_FLOAT, a);
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
199 }
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
200
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
201 void
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
202 glps_renderer::draw_pixels (GLsizei w, GLsizei h, GLenum format,
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
203 GLenum type, const GLvoid *data)
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
204 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
205 if (type == GL_UNSIGNED_SHORT)
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
206 ::draw_pixels (w, h, format, static_cast<const GLushort *> (data));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
207 else if (type == GL_UNSIGNED_BYTE)
9950
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
208 ::draw_pixels (w, h, format, static_cast<const GLubyte *> (data));
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
209 else
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
210 gl2psDrawPixels (w, h, 0, 0, format, type, data);
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
211 }
7dedfd70dd9f image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9834
diff changeset
212
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
213 void
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
214 glps_renderer::draw_text (const text::properties& props)
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
215 {
12965
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
216 if (props.get_string ().is_empty ())
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
217 return;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
218
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
219 set_font (props);
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
220 set_color (props.get_color_rgb ());
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
221
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
222 const Matrix pos = get_transform ().scale (props.get_data_position ());
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
223 int halign = 0, valign = 0;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
224
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
225 if (props.horizontalalignment_is ("center"))
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
226 halign = 1;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
227 else if (props.horizontalalignment_is ("right"))
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
228 halign = 2;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
229
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
230 if (props.verticalalignment_is ("top"))
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
231 valign = 2;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
232 else if (props.verticalalignment_is ("baseline"))
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
233 valign = 3;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
234 else if (props.verticalalignment_is ("middle"))
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
235 valign = 1;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
236
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
237 // FIXME: handle margin and surrounding box
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
238
14468
d16638f73691 Modify gl2ps_renderer.cc to properly specificy 2D/3D text object positions.
Konstantinos Poulios <logari81@googlemail.com>
parents: 14418
diff changeset
239 glRasterPos3d (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0);
12965
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
240
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
241 octave_value string_prop = props.get_string ();
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
242
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
243 string_vector sv = string_prop.all_strings ();
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
244
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
245 std::string s = sv.join ("\n");
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12322
diff changeset
246
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 12965
diff changeset
247 gl2psTextOpt (s.c_str (), fontname.c_str (), fontsize,
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
248 alignment_to_mode (halign, valign), props.get_rotation ());
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
249 }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 10955
diff changeset
250
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff changeset
251 #endif