From 85b7bc695629926641c7cb752fd478adfdf374f3 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 4 Jul 2010 15:32:09 +0300 Subject: stable 2010-05-24 13:10 --- tex/context/base/grph-u3d.lua | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tex/context/base/grph-u3d.lua (limited to 'tex/context/base/grph-u3d.lua') diff --git a/tex/context/base/grph-u3d.lua b/tex/context/base/grph-u3d.lua new file mode 100644 index 000000000..f3bf17631 --- /dev/null +++ b/tex/context/base/grph-u3d.lua @@ -0,0 +1,49 @@ +if not modules then modules = { } end modules ['grph-u3d'] = { + version = 1.001, + comment = "companion to grph-inc.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- see lpdf-u3d.lua for comment + +local trace_inclusion = false trackers.register("figures.inclusion", function(v) trace_inclusion = v end) + +local pdfannotation = nodes.pdfannotation +local todimen = string.todimen + +-- maybe todo: backends.codeinjections.insertu3d + +function figures.checkers.u3d(data) + local dr, du, ds = data.request, data.used, data.status + local width = todimen(dr.width or figures.defaultwidth) + local height = todimen(dr.height or figures.defaultheight) + local foundname = du.fullname + dr.width, dr.height = width, height + du.width, du.height, du.foundname = width, height, foundname + if trace_inclusion then + logs.report("figures","including u3d '%s': width %s, height %s",foundname,width,height) + end + context.startfoundexternalfigure(width .. "sp",height .. "sp") + context(function() + local annotation, preview, ref = backends.pdf.helpers.insert3d { + foundname = foundname, + width = width, + height = height, + factor = number.dimenfactors.bp, + display = dr.display, + controls = dr.controls, + label = dr.label, + } +--~ print(annotation, preview, ref) + node.write(pdfannotation(width,height,0,annotation())) + end) + context.stopfoundexternalfigure() + return data +end + +figures.includers.u3d = figures.includers.nongeneric + +figures.registersuffix("u3d","u3d") +figures.registersuffix("prc","u3d") -- cgit v1.2.3