summaryrefslogtreecommitdiff
path: root/tex/context/base/grph-raw.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-02-14 20:00:14 +0200
committerMarius <mariausol@gmail.com>2011-02-14 20:00:14 +0200
commit1d534cdaf5a15ab7191504b5b82d78d8f54435b9 (patch)
treeb18b7f9fa25fd28ccded25e10e166d02aa9ddd18 /tex/context/base/grph-raw.mkiv
parentab20b3338556714d8be0ae8fbf8d79a7cfe70e21 (diff)
downloadcontext-1d534cdaf5a15ab7191504b5b82d78d8f54435b9.tar.gz
beta 2011.02.14 18:50
Diffstat (limited to 'tex/context/base/grph-raw.mkiv')
-rw-r--r--tex/context/base/grph-raw.mkiv64
1 files changed, 64 insertions, 0 deletions
diff --git a/tex/context/base/grph-raw.mkiv b/tex/context/base/grph-raw.mkiv
new file mode 100644
index 000000000..426262b4f
--- /dev/null
+++ b/tex/context/base/grph-raw.mkiv
@@ -0,0 +1,64 @@
+%D \module
+%D [ file=grph-raw,
+%D version=2006.08.26, % overhaul of 1997.03.31
+%D title=\CONTEXT\ Graphic Macros,
+%D subtitle=Raw Bitmaps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Graphic Macros / Raw Bitmaps}
+
+%D \startluacode
+%D function document.TestBitmap(nx,ny)
+%D local random = math.random
+%D local maxbit = 2^24
+%D for i=1,nx do
+%D for i=1,ny do
+%D context("%06x",random(0,maxbit))
+%D end
+%D end
+%D end
+%D \stopluacode
+%D
+%D \def\TestBitmap#1#2{\ctxlua{document.TestBitmap(#1,#2)}}
+%D
+%D \blank
+%D
+%D \startMPcode
+%D draw textext("\bitmapimage[x=100,y=100]{\TestBitmap{100}{100}}") xsized 10cm ;
+%D \stopMPcode
+%D
+%D \blank
+%D
+%D \startMPcode
+%D draw textext("\bitmapimage[x=200,y=50]{\TestBitmap{50}{200}}") xsized 10cm ;
+%D \stopMPcode
+
+\registerctxluafile{grph-raw}{1.001}
+
+\unprotect
+
+\unexpanded\def\bitmapimage[#1]#2%
+ {\hbox\bgroup
+ \getparameters[@@im][\c!color=rgb,\c!width=,\c!height=,\c!x=,\c!y=,#1]%
+ \ctxlua{figures.bitmapimage {
+ data = \!!bs#2\!!es,
+ xresolution = "\@@imx",
+ yresolution = "\@@imy",
+ colorspace = "\@@imcolor",
+ width = "\@@imwidth",
+ height = "\@@imheight"
+ }}%
+ \egroup}
+
+\unexpanded\def\startbitmapimage[#1]#2\stopbitmapimage
+ {\bitmapimage[#1]{#2}}
+
+\let\stopbitmapimage\relax
+
+\protect \endinput