Mercurial > octave
annotate libinterp/corefcn/gl2ps-print.cc @ 31605:e88a07dec498 stable
maint: Use macros to begin/end C++ namespaces.
* oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE,
OCTAVE_END_NAMESPACE) that can be used to start/end a namespace.
* mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc,
__dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc,
__ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc,
auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc,
colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc,
defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc,
display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc,
ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h,
event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc,
fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc,
ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc,
getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc,
gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc,
graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc,
help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h,
mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc,
oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h,
oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy,
ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc,
pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc,
qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h,
sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc,
sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h,
stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc,
symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h,
symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h,
text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc,
toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc,
url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc,
variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh,
mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc,
ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h,
ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc,
ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h,
ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc,
op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc,
op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc,
op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc,
op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc,
op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h,
anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h,
comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc,
oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h,
pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h,
pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h,
pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h,
pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h,
pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc,
pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc,
pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc,
pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc,
pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc,
pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc,
pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h,
pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h,
range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc,
chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h,
lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h,
oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h,
oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc,
qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc,
randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc,
sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc,
child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc,
file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h,
mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h,
oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc,
oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h,
base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h,
file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc,
lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h,
oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h,
oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h,
pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h,
url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 14:23:45 -0800 |
parents | 670a0d878af1 |
children | aac27ad79be6 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3 // Copyright (C) 2009-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21539
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21230
diff
changeset
|
27 # include "config.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
28 #endif |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
29 |
21539
212bafe8413a
gl2ps-print.cc: Fix compiling whet --without-opengl used.
Rik <rik@octave.org>
parents:
21527
diff
changeset
|
30 // Both header files are required outside of HAVE_GLP2S_H |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
31 #include "errwarn.h" |
21539
212bafe8413a
gl2ps-print.cc: Fix compiling whet --without-opengl used.
Rik <rik@octave.org>
parents:
21527
diff
changeset
|
32 #include "gl2ps-print.h" |
19648
16f21db320b5
Fix compilation error when building without gl2ps
Mike Miller <mtmiller@ieee.org>
parents:
19639
diff
changeset
|
33 |
22750
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
34 #if defined (HAVE_GL2PS_H) && defined (HAVE_OPENGL) |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
35 |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
36 #include <cstdio> |
21852
25493c55d976
don't include unistd.h unless it is needed
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
37 |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
38 #include <limits> |
21852
25493c55d976
don't include unistd.h unless it is needed
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
39 |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
40 #include <gl2ps.h> |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
41 |
28337
8d2f9cfc16bc
Use relative filename in .tex file when printing using -dXXXlatex devices (bug #58374).
Rik <rik@octave.org>
parents:
28293
diff
changeset
|
42 #include "file-ops.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
43 #include "lo-mappers.h" |
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
44 #include "oct-locbuf.h" |
30881
1921d9d0e62b
Unify detection of temporary directory (bug #62215).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30565
diff
changeset
|
45 #include "oct-env.h" |
21910
4d723ba06b4a
provide wrappers for some unistd.h functions
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
46 #include "unistd-wrappers.h" |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
47 #include "unistr-wrappers.h" |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
48 #include "unwind-prot.h" |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
49 |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
50 #include "gl-render.h" |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
51 #include "interpreter-private.h" |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
52 #include "oct-opengl.h" |
21527
ab8760b1245d
Raise an error if writes to pipe fail (bug #47381).
Rik <rik@octave.org>
parents:
21391
diff
changeset
|
53 #include "sighandlers.h" |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
54 #include "sysdep.h" |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21207
diff
changeset
|
55 #include "text-renderer.h" |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
56 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
57 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
58 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
59 class |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
60 OCTINTERP_API |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
61 gl2ps_renderer : public opengl_renderer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
62 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
63 public: |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
64 |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
65 gl2ps_renderer (opengl_functions& glfcns, FILE *_fp, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
66 const std::string& _term) |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
67 : opengl_renderer (glfcns), m_fp (_fp), m_term (_term), m_fontsize (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
68 m_fontname (), m_buffer_overflow (false), m_svg_def_index (0) |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
69 { } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
70 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22862
diff
changeset
|
71 ~gl2ps_renderer (void) = default; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
72 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
73 // FIXME: should we import the functions from the base class and |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
74 // overload them here, or should we use a different name so we don't |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
75 // have to do this? Without the using declaration or a name change, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
76 // the base class functions will be hidden. That may be OK, but it |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
77 // can also cause some confusion. |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
78 using opengl_renderer::draw; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
79 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
80 void draw (const graphics_object& go, const std::string& print_cmd); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
81 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
82 protected: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
83 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
84 Matrix render_text (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
85 double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
86 int halign, int valign, double rotation = 0.0); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
87 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
88 void set_font (const base_properties& props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
89 |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
90 static bool has_alpha (const graphics_handle& h) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
91 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
92 bool retval = false; |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
93 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30885
diff
changeset
|
94 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
95 |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
96 graphics_object go = gh_mgr.get_object (h); |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
97 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
98 if (! go.valid_object ()) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
99 return retval; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
100 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
101 if (go.isa ("axes") || go.isa ("hggroup")) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
102 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
103 Matrix children = go.get ("children").matrix_value (); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
104 for (octave_idx_type ii = 0; ii < children.numel (); ii++) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
105 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
106 retval = has_alpha (graphics_handle (children(ii))); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
107 if (retval) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
108 break; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
109 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
110 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
111 else if (go.isa ("patch") || go.isa ("surface")) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
112 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
113 octave_value fa = go.get ("facealpha"); |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
114 if (fa.is_scalar_type () && fa.is_double_type () |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
115 && fa.double_value () < 1) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
116 retval = true; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
117 } |
28293
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
118 else if (go.isa ("scatter")) |
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
119 { |
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
120 octave_value fa = go.get ("markerfacealpha"); |
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
121 if (fa.is_scalar_type () && fa.is_double_type () |
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
122 && fa.double_value () < 1) |
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
123 retval = true; |
332e644726f9
Allow printing transparent scatter objects (bug #58282)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
28189
diff
changeset
|
124 } |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
125 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
126 return retval; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
127 } |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
128 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
129 void draw_axes (const axes::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
130 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
131 // Initialize a sorting tree (viewport) in gl2ps for each axes |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
132 GLint vp[4]; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
133 m_glfcns.glGetIntegerv (GL_VIEWPORT, vp); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
134 gl2psBeginViewport (vp); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
135 |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
136 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
137 // Don't remove hidden primitives when some of them are transparent |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
138 GLint opts; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
139 gl2psGetOptions (&opts); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
140 if (has_alpha (props.get___myhandle__ ())) |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
141 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
142 opts &= ~GL2PS_OCCLUSION_CULL; |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
143 // FIXME: currently the GL2PS_BLEND (which is more an equivalent of |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
144 // GL_ALPHA_TEST than GL_BLEND) is not working on a per primitive |
27929
265b386f8b20
maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
145 // basis. We thus set it once per viewport. |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
146 gl2psEnable (GL2PS_BLEND); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
147 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
148 else |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
149 { |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
150 opts |= GL2PS_OCCLUSION_CULL; |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
151 gl2psDisable (GL2PS_BLEND); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
152 } |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
153 |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
154 gl2psSetOptions (opts); |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
155 |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
156 // Draw and finish () or there may be primitives missing in the gl2ps |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
157 // output. |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
158 opengl_renderer::draw_axes (props); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
159 finish (); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
160 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
161 // Finalize viewport |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
162 GLint state = gl2psEndViewport (); |
23858
cb8251337689
Fix printing of plots with axes that are not visible (bug #51713).
Rik <rik@octave.org>
parents:
23848
diff
changeset
|
163 if (state == GL2PS_NO_FEEDBACK && props.is_visible ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
164 warning ("gl2ps_renderer::draw_axes: empty feedback buffer and/or nothing else to print"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
165 else if (state == GL2PS_ERROR) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
166 error ("gl2ps_renderer::draw_axes: gl2psEndPage returned GL2PS_ERROR"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
167 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
168 m_buffer_overflow |= (state == GL2PS_OVERFLOW); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
169 |
24208
eec262017c6a
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
24179
diff
changeset
|
170 // Don't draw background for subsequent viewports (legends, subplots, |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
171 // etc.) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
172 gl2psGetOptions (&opts); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
173 opts &= ~GL2PS_DRAW_BACKGROUND; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
174 gl2psSetOptions (opts); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
175 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
176 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
177 void draw_text (const text::properties& props); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
178 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
179 void draw_image (const image::properties& props); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
180 void draw_pixels (int w, int h, const float *data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
181 void draw_pixels (int w, int h, const uint8_t *data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
182 void draw_pixels (int w, int h, const uint16_t *data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
183 |
24689
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
184 void init_marker (const std::string& m, double size, float width) |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
185 { |
28189
5624fd0c5efb
Fix inconsistent marker size between screen and printout (bug #57552)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27992
diff
changeset
|
186 opengl_renderer::init_marker (m, size, width); |
27992
46fe22bf1458
Fix size of markers in printouts to match screen (bug #57552).
Rik <rik@octave.org>
parents:
27957
diff
changeset
|
187 |
46fe22bf1458
Fix size of markers in printouts to match screen (bug #57552).
Rik <rik@octave.org>
parents:
27957
diff
changeset
|
188 // FIXME: gl2ps can't handle closed contours so we set linecap/linejoin |
24689
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
189 // round to obtain a better looking result for some markers. |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
190 if (m == "o" || m == "v" || m == "^" || m == ">" || m == "<" || m == "h" |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
191 || m == "hexagram" || m == "p" || m == "pentagram") |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
192 { |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
193 set_linejoin ("round"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
194 set_linecap ("round"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
195 } |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
196 else |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
197 { |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
198 set_linejoin ("miter"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
199 set_linecap ("square"); |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
200 } |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
201 } |
800876b7132c
Make some markers linejoin/linecap round for better looking printout (bug #53023)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24686
diff
changeset
|
202 |
22396
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22392
diff
changeset
|
203 void set_linestyle (const std::string& s, bool use_stipple = false, |
52c205a0ad88
Make linestyles compatible at larger linewidths (bug #48884).
Rik <rik@octave.org>
parents:
22392
diff
changeset
|
204 double linewidth = 0.5) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
205 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
206 opengl_renderer::set_linestyle (s, use_stipple, linewidth); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
207 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
208 if (s == "-" && ! use_stipple) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
209 gl2psDisable (GL2PS_LINE_STIPPLE); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
210 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
211 gl2psEnable (GL2PS_LINE_STIPPLE); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
212 } |
21333
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
213 |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
214 void set_linecap (const std::string& s) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
215 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
216 opengl_renderer::set_linejoin (s); |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
217 |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
218 #if defined (HAVE_GL2PSLINEJOIN) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
219 if (s == "butt") |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
220 gl2psLineCap (GL2PS_LINE_CAP_BUTT); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
221 else if (s == "square") |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
222 gl2psLineCap (GL2PS_LINE_CAP_SQUARE); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
223 else if (s == "round") |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
224 gl2psLineCap (GL2PS_LINE_CAP_ROUND); |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
225 #endif |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
226 } |
22838
1444a65085ca
Make axes corners join in printout (bug #39643)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22759
diff
changeset
|
227 |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
228 void set_linejoin (const std::string& s) |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
229 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
230 opengl_renderer::set_linejoin (s); |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
231 |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
232 #if defined (HAVE_GL2PSLINEJOIN) |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
233 if (s == "round") |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
234 gl2psLineJoin (GL2PS_LINE_JOIN_ROUND); |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
235 else if (s == "miter") |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
236 gl2psLineJoin (GL2PS_LINE_JOIN_MITER); |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
237 else if (s == "chamfer") |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
238 gl2psLineJoin (GL2PS_LINE_JOIN_BEVEL); |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
239 #endif |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
240 } |
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
241 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
242 void set_polygon_offset (bool on, float offset = 0.0f) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
243 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
244 if (on) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
245 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
246 opengl_renderer::set_polygon_offset (on, offset); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
247 gl2psEnable (GL2PS_POLYGON_OFFSET_FILL); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
248 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
249 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
250 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
251 gl2psDisable (GL2PS_POLYGON_OFFSET_FILL); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
252 opengl_renderer::set_polygon_offset (on, offset); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
253 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
254 } |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
255 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
256 void set_linewidth (float w) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
257 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
258 gl2psLineWidth (w); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
259 } |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
260 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
261 private: |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
262 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
263 // Use xform to compute the coordinates of the string list |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
264 // that have been parsed by freetype. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
265 void fix_strlist_position (double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
266 Matrix box, double rotation, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
267 std::list<text_renderer::string>& lst); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
268 |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
269 // Build an svg text element from a list of parsed strings |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
270 std::string format_svg_element (std::string str, Matrix bbox, |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
271 double rotation, ColumnVector coord_pix, |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
272 Matrix color); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
273 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
274 std::string strlist_to_svg (double x, double y, double z, Matrix box, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
275 double rotation, |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
276 std::list<text_renderer::string>& lst); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
277 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
278 // Build a list of postscript commands from a list of parsed strings. |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
279 std::string strlist_to_ps (double x, double y, double z, Matrix box, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
280 double rotation, |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
281 std::list<text_renderer::string>& lst); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
282 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
283 int alignment_to_mode (int ha, int va) const; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
284 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
285 FILE *m_fp; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
286 caseless_str m_term; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
287 double m_fontsize; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
288 std::string m_fontname; |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
289 bool m_buffer_overflow; |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
290 std::size_t m_svg_def_index; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
291 }; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
292 |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
293 static bool |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
294 has_2D_axes (const graphics_handle& h) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
295 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
296 bool retval = true; |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
297 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30885
diff
changeset
|
298 gh_manager& gh_mgr = __get_gh_manager__ (); |
27335
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
299 |
50216d7a2f6b
eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents:
27277
diff
changeset
|
300 graphics_object go = gh_mgr.get_object (h); |
23863
56b7352fa456
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23859
diff
changeset
|
301 |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
302 if (! go.valid_object ()) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
303 return retval; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
304 |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
305 if (go.isa ("figure") || go.isa ("uipanel")) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
306 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
307 Matrix children = go.get ("children").matrix_value (); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
308 for (octave_idx_type ii = 0; ii < children.numel (); ii++) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
309 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
310 retval = has_2D_axes (graphics_handle (children(ii))); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
311 if (! retval) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
312 break; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
313 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
314 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
315 else if (go.isa ("axes")) |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
316 { |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
317 axes::properties& ap |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
318 = reinterpret_cast<axes::properties&> (go.get_properties ()); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
319 retval = ap.get_is2D (true); |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
320 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
321 |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
322 return retval; |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
323 } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23858
diff
changeset
|
324 |
29938
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
325 static std::string |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
326 get_title (const graphics_handle& h) |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
327 { |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
328 std::string retval; |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
329 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30885
diff
changeset
|
330 gh_manager& gh_mgr = __get_gh_manager__ (); |
29938
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
331 |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
332 graphics_object go = gh_mgr.get_object (h); |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
333 |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
334 if (! go.valid_object ()) |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
335 return retval; |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
336 |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
337 if (go.isa ("figure")) |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
338 { |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
339 figure::properties& fp |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
340 = reinterpret_cast<figure::properties&> (go.get_properties ()); |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
341 |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
342 retval = fp.get_title (); |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
343 } |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
344 |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
345 return retval; |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
346 } |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
347 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
348 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
349 gl2ps_renderer::draw (const graphics_object& go, const std::string& print_cmd) |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
350 { |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
351 static bool in_draw = false; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
352 static std::string old_print_cmd; |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
353 static GLint buffsize; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
354 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
355 if (! in_draw) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
356 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
357 unwind_protect frame; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
358 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
359 frame.protect_var (in_draw); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
360 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
361 in_draw = true; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
362 |
22336
47629df12b79
Fix crash when choosing an inappropriate terminal in drawnow (bug #48782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22331
diff
changeset
|
363 GLint gl2ps_term = GL2PS_PS; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
364 if (m_term.find ("eps") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
365 gl2ps_term = GL2PS_EPS; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
366 else if (m_term.find ("pdf") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
367 gl2ps_term = GL2PS_PDF; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
368 else if (m_term.find ("ps") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
369 gl2ps_term = GL2PS_PS; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
370 else if (m_term.find ("svg") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
371 gl2ps_term = GL2PS_SVG; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
372 else if (m_term.find ("pgf") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
373 gl2ps_term = GL2PS_PGF; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
374 else if (m_term.find ("tex") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
375 gl2ps_term = GL2PS_TEX; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
376 else |
22336
47629df12b79
Fix crash when choosing an inappropriate terminal in drawnow (bug #48782)
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22331
diff
changeset
|
377 warning ("gl2ps_renderer::draw: Unknown terminal %s, using 'ps'", |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
378 m_term.c_str ()); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
379 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
380 GLint gl2ps_text = 0; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
381 if (m_term.find ("notxt") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
382 gl2ps_text = GL2PS_NO_TEXT; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
383 |
29938
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
384 // Find Title for plot |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
385 const graphics_handle& myhandle = go.get ("__myhandle__"); |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
386 std::string plot_title = get_title (myhandle); |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
387 if (plot_title.empty ()) |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
388 plot_title = "Octave plot"; |
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
389 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
390 // Default sort order optimizes for 3D plots |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
391 GLint gl2ps_sort = GL2PS_BSP_SORT; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
392 |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27155
diff
changeset
|
393 // FIXME: gl2ps does not provide a way to change the sorting algorithm |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23457
diff
changeset
|
394 // on a viewport basis, we thus disable sorting only if all axes are 2D |
29938
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
395 if (has_2D_axes (myhandle)) |
23546
06805aabbdd1
Draw 2D axes primitives in the children stack order (bug #50750)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23457
diff
changeset
|
396 gl2ps_sort = GL2PS_NO_SORT; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
397 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
398 // Use a temporary file in case an overflow happens |
30881
1921d9d0e62b
Unify detection of temporary directory (bug #62215).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30565
diff
changeset
|
399 std::string tmpfile (sys::tempnam (sys::env::get_temp_directory (), |
1921d9d0e62b
Unify detection of temporary directory (bug #62215).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30565
diff
changeset
|
400 "oct-")); |
1921d9d0e62b
Unify detection of temporary directory (bug #62215).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30565
diff
changeset
|
401 FILE *tmpf = sys::fopen_tmp (tmpfile, "w+b"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
402 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
403 if (! tmpf) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
404 error ("gl2ps_renderer::draw: couldn't open temporary file for printing"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
405 |
28857
43ad651cf5a0
eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents:
28752
diff
changeset
|
406 frame.add ([=] () { std::fclose (tmpf); }); |
23740
38188d1aaf3f
ensure that temporary file used by gl2ps is closed (bug #50696)
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
407 |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
408 // Reset buffsize, unless this is 2nd pass of a texstandalone print. |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
409 if (m_term.find ("tex") == std::string::npos) |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
410 buffsize = 2*1024*1024; |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
411 else |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
412 buffsize /= 2; |
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
413 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
414 m_buffer_overflow = true; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
415 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
416 while (m_buffer_overflow) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
417 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
418 m_buffer_overflow = false; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
419 buffsize *= 2; |
22753
50fa2d656326
Size gl2ps print buffer just once when printing tex formats (bug #49492).
Rik <rik@octave.org>
parents:
22750
diff
changeset
|
420 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
421 std::fseek (tmpf, 0, SEEK_SET); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
422 octave_ftruncate_wrapper (fileno (tmpf), 0); |
21391
13b6be3cb217
Correctly print figure background when multiple axes present (bug #47315).
Rik <rik@octave.org>
parents:
21353
diff
changeset
|
423 |
22704
b5407b1ab11a
Provide extra info message when gl2ps buffer overflows (bug #49482).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
424 // For LaTeX output the print process uses 2 drawnow() commands. |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
425 // The first one is for the pdf/ps/eps graph to be included. The |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
426 // print_cmd is saved as old_print_cmd. Then the second drawnow() |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
427 // outputs the tex-file and the graphic filename to be included is |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
428 // extracted from old_print_cmd. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
429 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
430 std::string include_graph; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
431 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
432 std::size_t found_redirect = old_print_cmd.find ('>'); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
433 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
434 if (found_redirect != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
435 include_graph = old_print_cmd.substr (found_redirect + 1); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
436 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
437 include_graph = old_print_cmd; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
438 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29470
diff
changeset
|
439 std::size_t n_begin = include_graph.find_first_not_of (R"( "')"); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
440 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
441 if (n_begin != std::string::npos) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
442 { |
28337
8d2f9cfc16bc
Use relative filename in .tex file when printing using -dXXXlatex devices (bug #58374).
Rik <rik@octave.org>
parents:
28293
diff
changeset
|
443 // Strip any quote characters characters around filename |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29470
diff
changeset
|
444 std::size_t n_end = include_graph.find_last_not_of (R"( "')"); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
445 include_graph = include_graph.substr (n_begin, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
446 n_end - n_begin + 1); |
28337
8d2f9cfc16bc
Use relative filename in .tex file when printing using -dXXXlatex devices (bug #58374).
Rik <rik@octave.org>
parents:
28293
diff
changeset
|
447 // Strip path from filename |
28857
43ad651cf5a0
eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents:
28752
diff
changeset
|
448 n_begin = include_graph.find_last_of (sys::file_ops::dir_sep_chars ()); |
28337
8d2f9cfc16bc
Use relative filename in .tex file when printing using -dXXXlatex devices (bug #58374).
Rik <rik@octave.org>
parents:
28293
diff
changeset
|
449 include_graph = include_graph.substr (n_begin + 1); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
450 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
451 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
452 include_graph = "foobar-inc"; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
453 |
24686
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
454 // FIXME: workaround gl2ps drawing 2 background planes, the first |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
455 // eventually being black and producing visual artifacts |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
456 const figure::properties& fprop |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
457 = dynamic_cast<const figure::properties&> (go.get_properties ()); |
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
458 Matrix c = fprop.get_color_rgb (); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
459 m_glfcns.glClearColor (c(0), c(1), c(2), 1); |
24686
21e97b50989d
Workaround the presence two background axes in printout (bug #52975).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
460 |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25862
diff
changeset
|
461 // Allow figures to be printed at arbitrary resolution |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25862
diff
changeset
|
462 set_device_pixel_ratio (fprop.get___device_pixel_ratio__ ()); |
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25862
diff
changeset
|
463 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
464 // GL2PS_SILENT was removed to allow gl2ps to print errors on stderr |
29938
4b25d83d152d
Put title of plot into "Title" property of generated PDFs (bug #60992)
Rik <rik@octave.org>
parents:
29886
diff
changeset
|
465 GLint ret = gl2psBeginPage (plot_title.c_str (), "Octave", |
24179
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
466 nullptr, gl2ps_term, gl2ps_sort, |
8365e584ebd8
Add support for transparent polygons in svg output (bug #39535)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24173
diff
changeset
|
467 (GL2PS_BEST_ROOT |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
468 | gl2ps_text |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
469 | GL2PS_DRAW_BACKGROUND |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
470 | GL2PS_NO_PS3_SHADING |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
471 | GL2PS_USE_CURRENT_VIEWPORT), |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23794
diff
changeset
|
472 GL_RGBA, 0, nullptr, 0, 0, 0, |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
473 buffsize, tmpf, include_graph.c_str ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
474 if (ret == GL2PS_ERROR) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
475 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
476 old_print_cmd.clear (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
477 error ("gl2ps_renderer::draw: gl2psBeginPage returned GL2PS_ERROR"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
478 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
479 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
480 opengl_renderer::draw (go); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
481 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
482 if (m_buffer_overflow) |
22704
b5407b1ab11a
Provide extra info message when gl2ps buffer overflows (bug #49482).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
483 warning ("gl2ps_renderer::draw: retrying with buffer size: %.1E B\n", double (2*buffsize)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
484 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
485 if (! m_buffer_overflow) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
486 old_print_cmd = print_cmd; |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
487 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
488 // Don't check return value of gl2psEndPage, it is not meaningful. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
489 // Errors and warnings are checked after gl2psEndViewport in |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
490 // gl2ps_renderer::draw_axes instead. |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
491 gl2psEndPage (); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
492 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
493 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
494 // Copy temporary file to pipe |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
495 std::fseek (tmpf, 0, SEEK_SET); |
23305
34c75889ed50
Possibly improve performance of OpenGL printing.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
496 char str[8192]; // 8 kB is a common kernel buffersize |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
497 std::size_t nread, nwrite; |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
498 nread = 1; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
499 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
500 // In EPS terminal read the header line by line and insert a |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
501 // new procedure |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
502 const char *fcn = "/SRX { gsave FCT moveto rotate xshow grestore } BD\n"; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
503 bool header_found = ! (m_term.find ("eps") != std::string::npos |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
504 || m_term.find ("svg") != std::string::npos); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
505 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
506 while (! feof (tmpf) && nread) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
507 { |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
508 if (! header_found && std::fgets (str, 8192, tmpf)) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
509 nread = strlen (str); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
510 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
511 nread = std::fread (str, 1, 8192, tmpf); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
512 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
513 if (nread) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
514 { |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
515 if (! header_found && std::strncmp (str, "/SBCR", 5) == 0) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
516 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
517 header_found = true; |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
518 nwrite = std::fwrite (fcn, 1, strlen (fcn), m_fp); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
519 if (nwrite != strlen (fcn)) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
520 { |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
521 // FIXME: is this the best thing to do here? |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
522 respond_to_pending_signals (); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
523 error ("gl2ps_renderer::draw: internal pipe error"); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
524 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
525 } |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
526 else if (m_term.find ("svg") != std::string::npos) |
24809
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
527 { |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
528 // FIXME: gl2ps uses pixel units for SVG format. |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
529 // Modify resulting svg to use points instead. |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
530 // Remove this "else if" block, and |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
531 // make header_found true for SVG if gl2ps is fixed. |
30884
0a1aec50a0c8
avoid possible buffer overflow in string constructor
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
532 |
0a1aec50a0c8
avoid possible buffer overflow in string constructor
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
533 // Specify number of characters because STR may have |
0a1aec50a0c8
avoid possible buffer overflow in string constructor
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
534 // come from std::fread and not end with a NUL |
0a1aec50a0c8
avoid possible buffer overflow in string constructor
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
535 // character. |
0a1aec50a0c8
avoid possible buffer overflow in string constructor
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
536 std::string srchstr (str, nread); |
29704
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
537 std::size_t pos = srchstr.find ("<svg "); |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
538 if (! header_found && pos != std::string::npos) |
24809
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
539 { |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
540 header_found = true; |
29704
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
541 pos = srchstr.find ("px"); |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
542 if (pos != std::string::npos) |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
543 { |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
544 srchstr[pos+1] = 't'; // "px" -> "pt" |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
545 // Assume the second occurrence is at the same line |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
546 pos = srchstr.find ("px", pos); |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
547 srchstr[pos+1] = 't'; // "px" -> "pt" |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
548 std::strcpy (str, srchstr.c_str ()); |
096523ffd20d
print: Fix error when "px" word is present in a figure (bug #60641)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29654
diff
changeset
|
549 } |
24809
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
550 } |
a802e644937a
Workaround gl2ps using pixel units for SVG output (bug #53197).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24722
diff
changeset
|
551 } |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
552 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
553 nwrite = std::fwrite (str, 1, nread, m_fp); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
554 if (nwrite != nread) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
555 { |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
556 // FIXME: is this the best thing to do here? |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24290
diff
changeset
|
557 respond_to_pending_signals (); // Clear SIGPIPE signal |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
558 error ("gl2ps_renderer::draw: internal pipe error"); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
559 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
560 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
561 } |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
562 } |
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
563 else |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
564 opengl_renderer::draw (go); |
21199
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
565 } |
dd6605e1eaea
make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents:
21198
diff
changeset
|
566 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
567 int |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
568 gl2ps_renderer::alignment_to_mode (int ha, int va) const |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
569 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
570 int gl2psa = GL2PS_TEXT_BL; |
19890 | 571 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
572 if (ha == 0) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
573 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
574 if (va == 0 || va == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
575 gl2psa=GL2PS_TEXT_BL; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
576 else if (va == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
577 gl2psa=GL2PS_TEXT_TL; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
578 else if (va == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
579 gl2psa=GL2PS_TEXT_CL; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
580 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
581 else if (ha == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
582 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
583 if (va == 0 || va == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
584 gl2psa=GL2PS_TEXT_BR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
585 else if (va == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
586 gl2psa=GL2PS_TEXT_TR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
587 else if (va == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
588 gl2psa=GL2PS_TEXT_CR; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
589 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
590 else if (ha == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
591 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
592 if (va == 0 || va == 3) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
593 gl2psa=GL2PS_TEXT_B; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
594 else if (va == 2) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
595 gl2psa=GL2PS_TEXT_T; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
596 else if (va == 1) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
597 gl2psa=GL2PS_TEXT_C; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
598 } |
19890 | 599 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
600 return gl2psa; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
601 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
602 |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
603 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
604 gl2ps_renderer::fix_strlist_position (double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
605 Matrix box, double rotation, |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
606 std::list<text_renderer::string>& lst) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
607 { |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
608 for (auto& txtobj : lst) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
609 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
610 // Get pixel coordinates |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
611 ColumnVector coord_pix = get_transform ().transform (x, y, z, false); |
19890 | 612 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
613 // Translate and rotate |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
614 double rot = rotation * 4.0 * atan (1.0) / 180; |
22862
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
615 coord_pix(0) += (txtobj.get_x () + box(0))*cos (rot) |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
616 - (txtobj.get_y () + box(1))*sin (rot); |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
617 coord_pix(1) -= (txtobj.get_y () + box(1))*cos (rot) |
e365e87371a3
maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
Rik <rik@octave.org>
parents:
22838
diff
changeset
|
618 + (txtobj.get_x () + box(0))*sin (rot); |
19890 | 619 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
620 GLint vp[4]; |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
621 m_glfcns.glGetIntegerv (GL_VIEWPORT, vp); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
622 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
623 txtobj.set_x (coord_pix(0)); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
624 txtobj.set_y (vp[3] - coord_pix(1)); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
625 txtobj.set_z (coord_pix(2)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
626 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
627 } |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
628 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
629 static std::string |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
630 code_to_symbol (uint32_t code) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
631 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
632 std::string retval; |
9834
92d8f35ff217
compute bounding boxes for text in opengl graphics backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9798
diff
changeset
|
633 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
634 uint32_t idx = code - 945; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
635 if (idx < 25) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
636 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
637 std::string characters ("abgdezhqiklmnxoprVstufcyw"); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
638 retval = characters[idx]; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
639 return retval; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
640 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
641 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
642 idx = code - 913; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
643 if (idx < 25) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
644 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
645 std::string characters ("ABGDEZHQIKLMNXOPRVSTUFCYW"); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
646 retval = characters[idx]; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
647 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
648 else if (code == 978) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
649 retval = "U"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
650 else if (code == 215) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
651 retval = "\xb4"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
652 else if (code == 177) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
653 retval = "\xb1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
654 else if (code == 8501) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
655 retval = "\xc0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
656 else if (code == 8465) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
657 retval = "\xc1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
658 else if (code == 8242) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
659 retval = "\xa2"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
660 else if (code == 8736) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
661 retval = "\xd0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
662 else if (code == 172) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
663 retval = "\xd8"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
664 else if (code == 9829) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
665 retval = "\xa9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
666 else if (code == 8472) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
667 retval = "\xc3"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
668 else if (code == 8706) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
669 retval = "\xb6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
670 else if (code == 8704) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
671 retval = "\x22"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
672 else if (code == 9827) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
673 retval = "\xa7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
674 else if (code == 9824) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
675 retval = "\xaa"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
676 else if (code == 8476) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
677 retval = "\xc2"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
678 else if (code == 8734) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
679 retval = "\xa5"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
680 else if (code == 8730) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
681 retval = "\xd6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
682 else if (code == 8707) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
683 retval = "\x24"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
684 else if (code == 9830) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
685 retval = "\xa8"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
686 else if (code == 8747) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
687 retval = "\xf2"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
688 else if (code == 8727) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
689 retval = "\x2a"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
690 else if (code == 8744) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
691 retval = "\xda"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
692 else if (code == 8855) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
693 retval = "\xc4"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
694 else if (code == 8901) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
695 retval = "\xd7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
696 else if (code == 8728) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
697 retval = "\xb0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
698 else if (code == 8745) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
699 retval = "\xc7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
700 else if (code == 8743) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
701 retval = "\xd9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
702 else if (code == 8856) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
703 retval = "\xc6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
704 else if (code == 8729) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
705 retval = "\xb7"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
706 else if (code == 8746) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
707 retval = "\xc8"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
708 else if (code == 8853) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
709 retval = "\xc5"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
710 else if (code == 8804) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
711 retval = "\xa3"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
712 else if (code == 8712) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
713 retval = "\xce"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
714 else if (code == 8839) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
715 retval = "\xca"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
716 else if (code == 8801) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
717 retval = "\xba"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
718 else if (code == 8773) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
719 retval = "\x40"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
720 else if (code == 8834) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
721 retval = "\xcc"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
722 else if (code == 8805) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
723 retval = "\xb3"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
724 else if (code == 8715) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
725 retval = "\x27"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
726 else if (code == 8764) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
727 retval = "\x7e"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
728 else if (code == 8733) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
729 retval = "\xb5"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
730 else if (code == 8838) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
731 retval = "\xcd"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
732 else if (code == 8835) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
733 retval = "\xc9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
734 else if (code == 8739) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
735 retval = "\xbd"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
736 else if (code == 8776) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
737 retval = "\xbb"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
738 else if (code == 8869) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
739 retval = "\x5e"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
740 else if (code == 8656) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
741 retval = "\xdc"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
742 else if (code == 8592) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
743 retval = "\xac"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
744 else if (code == 8658) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
745 retval = "\xde"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
746 else if (code == 8594) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
747 retval = "\xae"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
748 else if (code == 8596) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
749 retval = "\xab"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
750 else if (code == 8593) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
751 retval = "\xad"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
752 else if (code == 8595) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
753 retval = "\xaf"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
754 else if (code == 8970) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
755 retval = "\xeb"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
756 else if (code == 8971) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
757 retval = "\xfb"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
758 else if (code == 10216) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
759 retval = "\xe1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
760 else if (code == 10217) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
761 retval = "\xf1"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
762 else if (code == 8968) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
763 retval = "\xe9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
764 else if (code == 8969) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
765 retval = "\xf9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
766 else if (code == 8800) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
767 retval = "\xb9"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
768 else if (code == 8230) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
769 retval = "\xbc"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
770 else if (code == 176) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
771 retval = "\xb0"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
772 else if (code == 8709) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
773 retval = "\xc6"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
774 else if (code == 169) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
775 retval = "\xd3"; |
20020
1929d9218ac0
Fix fontname search, fontweight and fontangle for printing (bug #44668)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19890
diff
changeset
|
776 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
777 if (retval.empty ()) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
778 warning ("print: unhandled symbol %d", code); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
779 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
780 return retval; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
781 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
782 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
783 static std::string |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
784 select_font (caseless_str fn, bool isbold, bool isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
785 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
786 std::transform (fn.begin (), fn.end (), fn.begin (), ::tolower); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
787 std::string fontname; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
788 if (fn == "times" || fn == "times-roman") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
789 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
790 if (isitalic && isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
791 fontname = "Times-BoldItalic"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
792 else if (isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
793 fontname = "Times-Italic"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
794 else if (isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
795 fontname = "Times-Bold"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
796 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
797 fontname = "Times-Roman"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
798 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
799 else if (fn == "courier") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
800 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
801 if (isitalic && isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
802 fontname = "Courier-BoldOblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
803 else if (isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
804 fontname = "Courier-Oblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
805 else if (isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
806 fontname = "Courier-Bold"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
807 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
808 fontname = "Courier"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
809 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
810 else if (fn == "symbol") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
811 fontname = "Symbol"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
812 else if (fn == "zapfdingbats") |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
813 fontname = "ZapfDingbats"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
814 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
815 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
816 if (isitalic && isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
817 fontname = "Helvetica-BoldOblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
818 else if (isitalic) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
819 fontname = "Helvetica-Oblique"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
820 else if (isbold) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
821 fontname = "Helvetica-Bold"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
822 else |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
823 fontname = "Helvetica"; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
824 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
825 return fontname; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
826 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
827 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
828 static void |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
829 escape_character (const std::string chr, std::string& str) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
830 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
831 std::size_t idx = str.find (chr); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
832 while (idx != std::string::npos) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
833 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
834 str.insert (idx, 1, '\\'); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
835 idx = str.find (chr, idx + 2); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
836 } |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24689
diff
changeset
|
837 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
838 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
839 std::string |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
840 gl2ps_renderer::format_svg_element (std::string str, Matrix box, |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
841 double rotation, ColumnVector coord_pix, |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
842 Matrix color) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
843 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
844 // Extract <defs> elements and change their id to avoid conflict with |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
845 // defs coming from another svg string |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
846 std::string::size_type n1 = str.find ("<defs>"); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
847 if (n1 == std::string::npos) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
848 return std::string (); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
849 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
850 std::string id, new_id; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
851 n1 = str.find ("<path", ++n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
852 std::string::size_type n2; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
853 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
854 while (n1 != std::string::npos) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
855 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
856 // Extract the identifier id='identifier' |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
857 n1 = str.find ("id='", n1) + 4; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
858 n2 = str.find ("'", n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
859 id = str.substr (n1, n2-n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
860 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
861 new_id = std::to_string (m_svg_def_index) + "-" + id ; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
862 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
863 str.replace (n1, n2-n1, new_id); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
864 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
865 std::string::size_type n_ref = str.find ("#" + id); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
866 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
867 while (n_ref != std::string::npos) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
868 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
869 str.replace (n_ref + 1, id.length (), new_id); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
870 n_ref = str.find ("#" + id); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
871 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
872 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
873 n1 = str.find ("<path", n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
874 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
875 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
876 m_svg_def_index++; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
877 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
878 n1 = str.find ("<defs>"); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
879 n2 = str.find ("</defs>") + 7; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
880 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
881 std::string defs = str.substr (n1, n2-n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
882 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
883 // Extract the group containing the <use> elements and transform its |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
884 // coordinates using the bbox and coordinates info. |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
885 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
886 // Extract the original viewBox anchor |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
887 n1 = str.find ("viewBox='") + 9; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
888 if (n1 == std::string::npos) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
889 return std::string (); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
890 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
891 n2 = str.find (" ", n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
892 double original_x0 = std::stod (str.substr (n1, n2-n1)); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
893 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
894 n1 = n2+1; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
895 n2 = str.find (" ", n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
896 double original_y0 = std::stod (str.substr (n1, n2-n1)); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
897 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
898 // First look for local transform in the original svg |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
899 std::string orig_trans; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
900 n1 = str.find ("<g id='page1' transform='"); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
901 if (n1 != std::string::npos) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
902 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
903 n1 += 25; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
904 n2 = str.find ("'", n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
905 orig_trans = str.substr (n1, n2-n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
906 n1 = n2 + 1; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
907 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
908 else |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
909 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
910 n1 = str.find ("<g id='page1'"); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
911 n1 += 13; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
912 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
913 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
914 n2 = str.find ("</g>", n1) + 4; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
915 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
916 // The first applied transformation is the right-most |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
917 // 1* Apply original transform |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
918 std::string tform = orig_trans; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
919 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
920 // 2* Move the anchor to the final position |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
921 tform = std::string ("translate") |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
922 + "(" + std::to_string (box(0) - original_x0 + coord_pix(0)) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
923 + "," + std::to_string (-(box(3) + box(1)) - original_y0 + coord_pix(1)) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
924 + ") " + tform; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
925 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
926 // 3* Rotate around the final position |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
927 if (rotation != 0) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
928 tform = std::string ("rotate") |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
929 + "(" + std::to_string (-rotation) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
930 + "," + std::to_string (coord_pix(0)) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
931 + "," + std::to_string (coord_pix(1)) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
932 + ") " + tform; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
933 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
934 // Fill color |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
935 std::string fill = "fill='rgb(" |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
936 + std::to_string (static_cast<uint8_t> (color(0) * 255.0)) + "," |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
937 + std::to_string (static_cast<uint8_t> (color(1) * 255.0)) + "," |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
938 + std::to_string (static_cast<uint8_t> (color(2) * 255.0)) + ")' "; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
939 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
940 std::string use_group = "<g " |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
941 + fill |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
942 + "transform='" + tform + "'" |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
943 + str.substr (n1, n2-n1); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
944 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
945 return defs + "\n" + use_group; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
946 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
947 |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
948 std::string |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
949 gl2ps_renderer::strlist_to_svg (double x, double y, double z, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
950 Matrix box, double rotation, |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
951 std::list<text_renderer::string>& lst) |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
952 { |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
953 //Use pixel coordinates to conform to gl2ps |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
954 ColumnVector coord_pix = get_transform ().transform (x, y, z, false); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
955 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
956 if (lst.empty ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
957 return ""; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
958 |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
959 // This may already be an svg image. |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
960 std::string svg = lst.front ().get_svg_element (); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
961 if (! svg.empty ()) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
962 return format_svg_element (svg, box, rotation, coord_pix, |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
963 lst.front ().get_color ()); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
964 |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
965 // Rotation and translation are applied to the whole group |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
966 std::ostringstream os; |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
967 os << R"(<g xml:space="preserve" )"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
968 os << "transform=\"" |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
969 << "translate(" << coord_pix(0) + box(0) << "," << coord_pix(1) - box(1) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
970 << ") rotate(" << -rotation << "," << -box(0) << "," << box(1) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
971 << ")\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
972 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
973 // Use the first entry for the base text font |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
974 auto p = lst.begin (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
975 std::string name = p->get_family (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
976 std::string weight = p->get_weight (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
977 std::string angle = p->get_angle (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
978 double size = p->get_size (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
979 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
980 os << "font-family=\"" << name << "\" " |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
981 << "font-weight=\"" << weight << "\" " |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
982 << "font-style=\"" << angle << "\" " |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
983 << "font-size=\"" << size << "\">"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
984 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
985 |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
986 // Build a text element for each element in the strlist |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
987 for (p = lst.begin (); p != lst.end (); p++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
988 { |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
989 os << "<text "; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
990 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
991 if (name.compare (p->get_family ())) |
28752
810eb29fc227
maint: Use C++ raw string literals to simplify backlsashing.
Rik <rik@octave.org>
parents:
28337
diff
changeset
|
992 os << "font-family=\"" << p->get_family () << "\" "; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
993 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
994 if (weight.compare (p->get_weight ())) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
995 os << "font-weight=\"" << p->get_weight () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
996 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
997 if (angle.compare (p->get_angle ())) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
998 os << "font-style=\"" << p->get_angle () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
999 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1000 if (size != p->get_size ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1001 os << "font-size=\"" << p->get_size () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1002 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1003 os << "y=\"" << - p->get_y () << "\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1004 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1005 Matrix col = p->get_color (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1006 os << "fill=\"rgb(" << col(0)*255 << "," |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1007 << col(1)*255 << "," << col(2)*255 << ")\" "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1008 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1009 // provide an x coordinate for each character in the string |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1010 os << "x=\""; |
28752
810eb29fc227
maint: Use C++ raw string literals to simplify backlsashing.
Rik <rik@octave.org>
parents:
28337
diff
changeset
|
1011 std::vector<double> xdata = p->get_xdata (); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1012 for (auto q = xdata.begin (); q != xdata.end (); q++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1013 os << (*q) << " "; |
28752
810eb29fc227
maint: Use C++ raw string literals to simplify backlsashing.
Rik <rik@octave.org>
parents:
28337
diff
changeset
|
1014 os << '"'; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1015 |
28752
810eb29fc227
maint: Use C++ raw string literals to simplify backlsashing.
Rik <rik@octave.org>
parents:
28337
diff
changeset
|
1016 os << '>'; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1017 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1018 // translate unicode and special xml characters |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1019 if (p->get_code ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1020 os << "&#" << p->get_code () << ";"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1021 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1022 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1023 const std::string str = p->get_string (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1024 for (auto q = str.begin (); q != str.end (); q++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1025 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1026 std::stringstream chr; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1027 chr << *q; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1028 if (chr.str () == "\"") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1029 os << """; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1030 else if (chr.str () == "'") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1031 os << "'"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1032 else if (chr.str () == "&") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1033 os << "&"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1034 else if (chr.str () == "<") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1035 os << "<"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1036 else if (chr.str () == ">") |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1037 os << ">"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1038 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1039 os << chr.str (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1040 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1041 } |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1042 os << "</text>"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1043 } |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1044 os << "</g>"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1045 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1046 return os.str (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1047 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1048 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1049 std::string |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1050 gl2ps_renderer::strlist_to_ps (double x, double y, double z, |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1051 Matrix box, double rotation, |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
1052 std::list<text_renderer::string>& lst) |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1053 { |
29470
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1054 if (lst.empty ()) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1055 return ""; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1056 else if (lst.size () == 1) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1057 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1058 static bool warned = false; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1059 // This may be an svg image, not handled in native eps format. |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1060 if (! lst.front ().get_svg_element ().empty ()) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1061 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1062 if (! warned) |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1063 { |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1064 warned = true; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1065 warning_with_id ("Octave:print:unhandled-svg-content", |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1066 "print: unhandled LaTeX strings. " |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1067 "Use -svgconvert option or -d*latex* output " |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1068 "device."); |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1069 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1070 return ""; |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1071 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1072 } |
2ae4764180c6
Initial implementation of a LaTeX interpreter (bug #59546).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29359
diff
changeset
|
1073 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1074 // Translate and rotate coordinates in order to use bottom-left alignment |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1075 fix_strlist_position (x, y, z, box, rotation, lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1076 Matrix prev_color (1, 3, -1); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1077 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1078 std::ostringstream ss; |
24084
71a449b29cc7
Save/Restore state of postscript program when dumping text (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24076
diff
changeset
|
1079 ss << "gsave\n"; |
71a449b29cc7
Save/Restore state of postscript program when dumping text (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24076
diff
changeset
|
1080 |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1081 static bool warned = false; |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1082 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1083 for (const auto& txtobj : lst) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1084 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1085 // Color |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1086 if (txtobj.get_color () != prev_color) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1087 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1088 prev_color = txtobj.get_color (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1089 for (int i = 0; i < 3; i++) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1090 ss << prev_color(i) << " "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1091 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1092 ss << "C\n"; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1093 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1094 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1095 // String |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1096 std::string str; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1097 if (txtobj.get_code ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1098 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1099 m_fontname = "Symbol"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1100 str = code_to_symbol (txtobj.get_code ()); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1101 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1102 else |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1103 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1104 m_fontname = select_font (txtobj.get_name (), |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1105 txtobj.get_weight () == "bold", |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1106 txtobj.get_angle () == "italic"); |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1107 |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1108 // Check that the string is composed of single byte characters |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1109 const std::string tmpstr = txtobj.get_string (); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1110 const uint8_t *c |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1111 = reinterpret_cast<const uint8_t *> (tmpstr.c_str ()); |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25862
diff
changeset
|
1112 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1113 for (std::size_t i = 0; i < tmpstr.size ();) |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1114 { |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1115 int mblen = octave_u8_strmblen_wrapper (c + i); |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25862
diff
changeset
|
1116 |
27142
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1117 // Replace multibyte or non ascii characters by a question mark |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1118 if (mblen > 1) |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1119 { |
27142
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1120 str += "?"; |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1121 if (! warned) |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1122 { |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1123 warning_with_id ("Octave:print:unsupported-multibyte", |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1124 "print: only ASCII characters are " |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1125 "supported for EPS and derived " |
29682
f44a60da4926
print.m: Suggest '-svgconvert' option for multi-byte characters
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29655
diff
changeset
|
1126 "formats. Use the '-svgconvert' " |
f44a60da4926
print.m: Suggest '-svgconvert' option for multi-byte characters
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29655
diff
changeset
|
1127 "option for better font support."); |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1128 warned = true; |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1129 } |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1130 } |
27142
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1131 else if (mblen < 1) |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1132 { |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1133 mblen = 1; |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1134 str += "?"; |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1135 if (! warned) |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1136 { |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1137 warning_with_id ("Octave:print:unhandled-character", |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1138 "print: only ASCII characters are " |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1139 "supported for EPS and derived " |
29682
f44a60da4926
print.m: Suggest '-svgconvert' option for multi-byte characters
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29655
diff
changeset
|
1140 "formats. Use the '-svgconvert' " |
f44a60da4926
print.m: Suggest '-svgconvert' option for multi-byte characters
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
29655
diff
changeset
|
1141 "option for better font support."); |
27142
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1142 warned = true; |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1143 } |
8a07083c8cfc
Use replacement characters to display non UTF-8 strings in figures (bug #55974)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1144 } |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1145 else |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1146 str += tmpstr.at (i); |
25889
2da65009cc7f
Fix graphics object selection on high resolution screens (bug #49053)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25862
diff
changeset
|
1147 |
25854
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1148 i += mblen; |
d19dfcc862d4
Remove multibyte characters in EPS printout (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25649
diff
changeset
|
1149 } |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1150 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1151 |
27155
53ae2b0fee3c
Escape backslash characters in EPS output (bug #56448)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27142
diff
changeset
|
1152 escape_character ("\\", str); |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1153 escape_character ("(", str); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1154 escape_character (")", str); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1155 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1156 ss << "(" << str << ") ["; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1157 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1158 std::vector<double> xdata = txtobj.get_xdata (); |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1159 for (std::size_t i = 1; i < xdata.size (); i++) |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1160 ss << xdata[i] - xdata[i-1] << " "; |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1161 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1162 ss << "10] " << rotation << " " << txtobj.get_x () |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1163 << " " << txtobj.get_y () << " " << txtobj.get_size () |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1164 << " /" << m_fontname << " SRX\n"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1165 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1166 |
24084
71a449b29cc7
Save/Restore state of postscript program when dumping text (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24076
diff
changeset
|
1167 ss << "grestore\n"; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1168 |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1169 return ss.str (); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1170 } |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1171 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1172 Matrix |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1173 gl2ps_renderer::render_text (const std::string& txt, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1174 double x, double y, double z, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1175 int ha, int va, double rotation) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1176 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1177 std::string saved_font = m_fontname; |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1178 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1179 if (txt.empty ()) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1180 return Matrix (1, 4, 0.0); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
1181 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1182 Matrix bbox; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1183 std::string str = txt; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1184 std::list<text_renderer::string> lst; |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1185 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1186 text_to_strlist (str, lst, bbox, ha, va, rotation); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
1187 m_glfcns.glRasterPos3d (x, y, z); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1188 |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1189 // For svg/eps directly dump a preformated text element into gl2ps output |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1190 if (m_term.find ("svg") != std::string::npos) |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1191 { |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1192 std::string elt = strlist_to_svg (x, y, z, bbox, rotation, lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1193 if (! elt.empty ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1194 gl2psSpecial (GL2PS_SVG, elt.c_str ()); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1195 } |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1196 else if (m_term.find ("eps") != std::string::npos) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1197 { |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1198 std::string elt = strlist_to_ps (x, y, z, bbox, rotation, lst); |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1199 if (! elt.empty ()) |
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1200 gl2psSpecial (GL2PS_EPS, elt.c_str ()); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
1201 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1202 } |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1203 else |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1204 gl2psTextOpt (str.c_str (), m_fontname.c_str (), m_fontsize, |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1205 alignment_to_mode (ha, va), rotation); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20624
diff
changeset
|
1206 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1207 m_fontname = saved_font; |
24076
1b7e49a72c62
improve text rendering in svg printout (bug #48567)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23863
diff
changeset
|
1208 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1209 return bbox; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1210 } |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1211 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1212 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1213 gl2ps_renderer::set_font (const base_properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1214 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1215 opengl_renderer::set_font (props); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1216 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1217 // Set the interpreter so that text_to_pixels can parse strings properly |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1218 if (props.has_property ("interpreter")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1219 set_interpreter (props.get ("interpreter").string_value ()); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1220 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1221 m_fontsize = props.get ("__fontsize_points__").double_value (); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1222 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1223 caseless_str fn = props.get ("fontname").xtolower ().string_value (); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1224 bool isbold |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1225 =(props.get ("fontweight").xtolower ().string_value () == "bold"); |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1226 bool isitalic |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1227 = (props.get ("fontangle").xtolower ().string_value () == "italic"); |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1228 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1229 m_fontname = select_font (fn, isbold, isitalic); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1230 } |
9798
2d6a5af744b6
printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
1231 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1232 void |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1233 gl2ps_renderer::draw_image (const image::properties& props) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1234 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1235 octave_value cdata = props.get_color_data (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1236 dim_vector dv (cdata.dims ()); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1237 int h = dv(0); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1238 int w = dv(1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1239 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1240 Matrix x = props.get_xdata ().matrix_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1241 Matrix y = props.get_ydata ().matrix_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1242 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1243 // Someone wants us to draw an empty image? No way. |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1244 if (x.isempty () || y.isempty ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1245 return; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1246 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1247 // Sort x/ydata and mark flipped dimensions |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1248 bool xflip = false; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1249 if (x(0) > x(1)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1250 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1251 std::swap (x(0), x(1)); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1252 xflip = true; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1253 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1254 else if (w > 1 && x(1) == x(0)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1255 x(1) = x(1) + (w-1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1256 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1257 bool yflip = false; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1258 if (y(0) > y(1)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1259 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1260 std::swap (y(0), y(1)); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1261 yflip = true; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1262 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1263 else if (h > 1 && y(1) == y(0)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1264 y(1) = y(1) + (h-1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1265 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1266 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1267 const ColumnVector p0 = m_xform.transform (x(0), y(0), 0); |
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1268 const ColumnVector p1 = m_xform.transform (x(1), y(1), 0); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1269 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1270 if (math::isnan (p0(0)) || math::isnan (p0(1)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1271 || math::isnan (p1(0)) || math::isnan (p1(1))) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1272 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1273 warning ("opengl_renderer: image X,Y data too large to draw"); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1274 return; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1275 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1276 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1277 // image pixel size in screen pixel units |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1278 float pix_dx, pix_dy; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1279 // image pixel size in normalized units |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1280 float nor_dx, nor_dy; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1281 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1282 if (w > 1) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1283 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1284 pix_dx = (p1(0) - p0(0)) / (w-1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1285 nor_dx = (x(1) - x(0)) / (w-1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1286 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1287 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1288 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1289 const ColumnVector p1w = m_xform.transform (x(1) + 1, y(1), 0); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1290 pix_dx = p1w(0) - p0(0); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1291 nor_dx = 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1292 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1293 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1294 if (h > 1) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1295 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1296 pix_dy = (p1(1) - p0(1)) / (h-1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1297 nor_dy = (y(1) - y(0)) / (h-1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1298 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1299 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1300 { |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1301 const ColumnVector p1h = m_xform.transform (x(1), y(1) + 1, 0); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1302 pix_dy = p1h(1) - p0(1); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1303 nor_dy = 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1304 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1305 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1306 // OpenGL won't draw any of the image if its origin is outside the |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1307 // viewport/clipping plane so we must do the clipping ourselves. |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1308 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1309 int j0, j1, jj, i0, i1, ii; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1310 j0 = 0, j1 = w; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1311 i0 = 0, i1 = h; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1312 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1313 float im_xmin = x(0) - nor_dx/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1314 float im_xmax = x(1) + nor_dx/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1315 float im_ymin = y(0) - nor_dy/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1316 float im_ymax = y(1) + nor_dy/2; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1317 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1318 // Clip to axes or viewport |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1319 bool do_clip = props.is_clipping (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1320 Matrix vp = get_viewport_scaled (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1321 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1322 ColumnVector vp_lim_min |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1323 = m_xform.untransform (std::numeric_limits <float>::epsilon (), |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1324 std::numeric_limits <float>::epsilon ()); |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1325 ColumnVector vp_lim_max = m_xform.untransform (vp(2), vp(3)); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1326 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1327 if (vp_lim_min(0) > vp_lim_max(0)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1328 std::swap (vp_lim_min(0), vp_lim_max(0)); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1329 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1330 if (vp_lim_min(1) > vp_lim_max(1)) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1331 std::swap (vp_lim_min(1), vp_lim_max(1)); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1332 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1333 float clip_xmin |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1334 = do_clip ? (vp_lim_min(0) > m_xmin ? vp_lim_min(0) : m_xmin) |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1335 : vp_lim_min(0); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1336 |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1337 float clip_ymin |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1338 = do_clip ? (vp_lim_min(1) > m_ymin ? vp_lim_min(1) : m_ymin) |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1339 : vp_lim_min(1); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1340 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1341 float clip_xmax |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1342 = do_clip ? (vp_lim_max(0) < m_xmax ? vp_lim_max(0) : m_xmax) |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1343 : vp_lim_max(0); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1344 |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1345 float clip_ymax |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1346 = do_clip ? (vp_lim_max(1) < m_ymax ? vp_lim_max(1) : m_ymax) |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1347 : vp_lim_max(1); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1348 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1349 if (im_xmin < clip_xmin) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1350 j0 += (clip_xmin - im_xmin)/nor_dx + 1; |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1351 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1352 if (im_xmax > clip_xmax) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1353 j1 -= (im_xmax - clip_xmax)/nor_dx; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1354 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1355 if (im_ymin < clip_ymin) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1356 i0 += (clip_ymin - im_ymin)/nor_dy + 1; |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1357 |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1358 if (im_ymax > clip_ymax) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1359 i1 -= (im_ymax - clip_ymax)/nor_dy; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1360 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1361 if (i0 >= i1 || j0 >= j1) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1362 return; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1363 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1364 float zoom_x; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1365 m_glfcns.glGetFloatv (GL_ZOOM_X, &zoom_x); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1366 float zoom_y; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1367 m_glfcns.glGetFloatv (GL_ZOOM_Y, &zoom_y); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1368 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27156
diff
changeset
|
1369 m_glfcns.glPixelZoom (m_devpixratio * pix_dx, - m_devpixratio * pix_dy); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1370 m_glfcns.glRasterPos3d (im_xmin + nor_dx*j0, im_ymin + nor_dy*i0, 0); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1371 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1372 // Expect RGB data |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1373 if (dv.ndims () == 3 && dv(2) == 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1374 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1375 if (cdata.is_double_type ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1376 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1377 const NDArray xcdata = cdata.array_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1378 |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1379 OCTAVE_LOCAL_BUFFER (GLfloat, a, |
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1380 static_cast<size_t> (3)*(j1-j0)*(i1-i0)); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1381 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1382 for (int i = i0; i < i1; i++) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1383 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1384 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1385 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1386 if (! yflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1387 ii = i; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1388 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1389 ii = h - i - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1390 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1391 if (! xflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1392 jj = j; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1393 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1394 jj = w - j - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1395 |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1396 a[idx] = xcdata(ii, jj, 0); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1397 a[idx+1] = xcdata(ii, jj, 1); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1398 a[idx+2] = xcdata(ii, jj, 2); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1399 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1400 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1401 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1402 draw_pixels (j1-j0, i1-i0, a); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1403 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1404 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1405 else if (cdata.is_single_type ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1406 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1407 const FloatNDArray xcdata = cdata.float_array_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1408 |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1409 OCTAVE_LOCAL_BUFFER (GLfloat, a, |
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1410 static_cast<size_t> (3)*(j1-j0)*(i1-i0)); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1411 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1412 for (int i = i0; i < i1; i++) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1413 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1414 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1415 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1416 if (! yflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1417 ii = i; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1418 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1419 ii = h - i - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1420 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1421 if (! xflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1422 jj = j; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1423 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1424 jj = w - j - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1425 |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1426 a[idx] = xcdata(ii, jj, 0); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1427 a[idx+1] = xcdata(ii, jj, 1); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1428 a[idx+2] = xcdata(ii, jj, 2); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1429 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1430 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1431 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1432 draw_pixels (j1-j0, i1-i0, a); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1433 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1434 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1435 else if (cdata.is_uint8_type ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1436 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1437 const uint8NDArray xcdata = cdata.uint8_array_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1438 |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1439 OCTAVE_LOCAL_BUFFER (GLubyte, a, |
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1440 static_cast<size_t> (3)*(j1-j0)*(i1-i0)); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1441 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1442 for (int i = i0; i < i1; i++) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1443 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1444 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1445 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1446 if (! yflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1447 ii = i; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1448 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1449 ii = h - i - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1450 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1451 if (! xflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1452 jj = j; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1453 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1454 jj = w - j - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1455 |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1456 a[idx] = xcdata(ii, jj, 0); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1457 a[idx+1] = xcdata(ii, jj, 1); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1458 a[idx+2] = xcdata(ii, jj, 2); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1459 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1460 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1461 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1462 draw_pixels (j1-j0, i1-i0, a); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1463 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1464 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1465 else if (cdata.is_uint16_type ()) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1466 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1467 const uint16NDArray xcdata = cdata.uint16_array_value (); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1468 |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1469 OCTAVE_LOCAL_BUFFER (GLushort, a, |
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1470 static_cast<size_t> (3)*(j1-j0)*(i1-i0)); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1471 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1472 for (int i = i0; i < i1; i++) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1473 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1474 for (int j = j0, idx = (i-i0)*(j1-j0)*3; j < j1; j++, idx += 3) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1475 { |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1476 if (! yflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1477 ii = i; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1478 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1479 ii = h - i - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1480 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1481 if (! xflip) |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1482 jj = j; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1483 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1484 jj = w - j - 1; |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1485 |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1486 a[idx] = xcdata(ii, jj, 0); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1487 a[idx+1] = xcdata(ii, jj, 1); |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30262
diff
changeset
|
1488 a[idx+2] = xcdata(ii, jj, 2); |
26728
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1489 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1490 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1491 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1492 draw_pixels (j1-j0, i1-i0, a); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1493 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1494 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1495 else |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1496 warning ("opengl_renderer: invalid image data type (expected double, single, uint8, or uint16)"); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1497 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1498 m_glfcns.glPixelZoom (zoom_x, zoom_y); |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1499 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1500 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1501 } |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1502 |
f034b29320ad
Use OpenGl textures to render image objects (bug #55632).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
1503 void |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1504 gl2ps_renderer::draw_pixels (int w, int h, const float *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1505 { |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
1506 // Clip data between 0 and 1 for float values |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1507 OCTAVE_LOCAL_BUFFER (float, tmp_data, static_cast<size_t> (3)*w*h); |
22392
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1508 |
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1509 for (int i = 0; i < 3*h*w; i++) |
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1510 tmp_data[i] = (data[i] < 0.0f ? 0.0f : (data[i] > 1.0f ? 1.0f : data[i])); |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22396
diff
changeset
|
1511 |
22392
4dfb28724863
Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22336
diff
changeset
|
1512 gl2psDrawPixels (w, h, 0, 0, GL_RGB, GL_FLOAT, tmp_data); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1513 } |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
1514 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1515 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1516 gl2ps_renderer::draw_pixels (int w, int h, const uint8_t *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1517 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1518 // gl2psDrawPixels only supports the GL_FLOAT type. |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1519 |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1520 OCTAVE_LOCAL_BUFFER (float, tmp_data, static_cast<size_t> (3)*w*h); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1521 |
24284
1ad2297f8ece
Fix printing integer type images (bug #51558)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23219
diff
changeset
|
1522 static const float maxval = std::numeric_limits<uint8_t>::max (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1523 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1524 for (int i = 0; i < 3*w*h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1525 tmp_data[i] = data[i] / maxval; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1526 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1527 draw_pixels (w, h, tmp_data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1528 } |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1529 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1530 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1531 gl2ps_renderer::draw_pixels (int w, int h, const uint16_t *data) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1532 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1533 // gl2psDrawPixels only supports the GL_FLOAT type. |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1534 |
30262
f43902a87bf1
gl2ps-print.cc: Avoid integer overflow in multiplication.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29938
diff
changeset
|
1535 OCTAVE_LOCAL_BUFFER (float, tmp_data, static_cast<size_t> (3)*w*h); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1536 |
24284
1ad2297f8ece
Fix printing integer type images (bug #51558)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23219
diff
changeset
|
1537 static const float maxval = std::numeric_limits<uint16_t>::max (); |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1538 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1539 for (int i = 0; i < 3*w*h; i++) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1540 tmp_data[i] = data[i] / maxval; |
21353
e4fc19d8c6c3
remove HAVE_OPENGL from public header file
John W. Eaton <jwe@octave.org>
parents:
21341
diff
changeset
|
1541 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1542 draw_pixels (w, h, tmp_data); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1543 } |
9950
7dedfd70dd9f
image printing for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9834
diff
changeset
|
1544 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1545 void |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1546 gl2ps_renderer::draw_text (const text::properties& props) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1547 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23546
diff
changeset
|
1548 if (props.get_string ().isempty ()) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1549 return; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1550 |
24173
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24084
diff
changeset
|
1551 draw_text_background (props, true); |
730227072acb
Add support for text background area for OpenGL toolkits (bug #39692).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24084
diff
changeset
|
1552 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1553 // First set font properties: freetype will use them to compute |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1554 // coordinates and gl2ps will retrieve the color directly from the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1555 // feedback buffer |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1556 set_font (props); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1557 set_color (props.get_color_rgb ()); |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1558 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1559 std::string saved_font = m_fontname; |
20624
4e47e10d5279
Add basic support for multiline and tex markup in printed figures (bugs #31468, 42320, 45301)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20610
diff
changeset
|
1560 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1561 // Alignment |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1562 int halign = 0; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1563 int valign = 0; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1564 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1565 if (props.horizontalalignment_is ("center")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1566 halign = 1; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1567 else if (props.horizontalalignment_is ("right")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1568 halign = 2; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1569 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1570 if (props.verticalalignment_is ("top")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1571 valign = 2; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1572 else if (props.verticalalignment_is ("baseline")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1573 valign = 3; |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1574 else if (props.verticalalignment_is ("middle")) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1575 valign = 1; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1576 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1577 // FIXME: handle margin and surrounding box |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1578 // Matrix bbox; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
10955
diff
changeset
|
1579 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1580 const Matrix pos = get_transform ().scale (props.get_data_position ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1581 std::string str = props.get_string ().string_vector_value ().join ("\n"); |
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
|
1582 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1583 render_text (str, pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0, |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1584 halign, valign, props.get_rotation ()); |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1585 } |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1586 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1587 OCTAVE_END_NAMESPACE(octave) |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1588 |
21207
945695cafd2b
allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
1589 #endif |
945695cafd2b
allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
1590 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1591 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1592 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1593 // If the name of the stream begins with '|', open a pipe to the command |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1594 // named by the rest of the string. Otherwise, write to the named file. |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1595 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1596 void |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
1597 gl2ps_print (opengl_functions& glfcns, const graphics_object& fig, |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
1598 const std::string& stream, const std::string& term) |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1599 { |
22750
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1600 #if defined (HAVE_GL2PS_H) && defined (HAVE_OPENGL) |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1601 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1602 // FIXME: should we have a way to create a file that begins with the |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1603 // character '|'? |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1604 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1605 bool have_cmd = stream.length () > 1 && stream[0] == '|'; |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1606 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1607 FILE *m_fp = nullptr; |
19709
5cfb3ccbf24a
style fixes for resource management
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
1608 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23577
diff
changeset
|
1609 unwind_protect frame; |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1610 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1611 if (have_cmd) |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1612 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1613 // Create process and pipe gl2ps output to it. |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1614 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1615 std::string cmd = stream.substr (1); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1616 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1617 m_fp = popen (cmd.c_str (), "w"); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1618 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1619 if (! m_fp) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1620 error (R"(print: failed to open pipe "%s")", stream.c_str ()); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1621 |
28857
43ad651cf5a0
eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents:
28752
diff
changeset
|
1622 // Need octave:: qualifier here to avoid ambiguity. |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1623 frame.add ([=] () { octave::pclose (m_fp); }); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1624 } |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1625 else |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1626 { |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1627 // Write gl2ps output directly to file. |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1628 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1629 m_fp = sys::fopen (stream.c_str (), "w"); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1630 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1631 if (! m_fp) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1632 error (R"(gl2ps_print: failed to create file "%s")", stream.c_str ()); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1633 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1634 frame.add ([=] () { std::fclose (m_fp); }); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1635 } |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1636 |
29886
ebd1ac75e99f
use m_ prefix for data members in gl-render classes
John W. Eaton <jwe@octave.org>
parents:
29706
diff
changeset
|
1637 gl2ps_renderer rend (glfcns, m_fp, term); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
1638 |
24638
a3031d4967ce
Supply the OpenGL viewport setting for gl2ps_print context (bug #52940).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24534
diff
changeset
|
1639 Matrix pos = fig.get ("position").matrix_value (); |
a3031d4967ce
Supply the OpenGL viewport setting for gl2ps_print context (bug #52940).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24534
diff
changeset
|
1640 rend.set_viewport (pos(2), pos(3)); |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1641 rend.draw (fig, stream); |
21197
9a5bb6996b16
write to pipe or file in gl2ps_print
John W. Eaton <jwe@octave.org>
parents:
21196
diff
changeset
|
1642 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1643 // Make sure buffered commands are finished!!! |
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1644 rend.finish (); |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1645 |
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1646 #else |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
1647 |
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
1648 octave_unused_parameter (glfcns); |
22750
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1649 octave_unused_parameter (fig); |
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1650 octave_unused_parameter (stream); |
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1651 octave_unused_parameter (term); |
dc828d9a7f3a
Fix building gl2ps when --without-opengl is used (bug #47886).
Rik <rik@octave.org>
parents:
22704
diff
changeset
|
1652 |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1653 err_disabled_feature ("gl2ps_print", "gl2ps"); |
25862
e5a73a8c116c
use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents:
25854
diff
changeset
|
1654 |
19639
61cc00ebac60
move opengl printing code from __init_fltk__.cc to gl2ps-renderer.cc
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1655 #endif |
22331
b81b08cc4c83
maint: Indent namespaces in more files.
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1656 } |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1657 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1658 OCTAVE_END_NAMESPACE(octave) |