summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/leaflets/leaflet-common.tex
diff options
context:
space:
mode:
Diffstat (limited to 'doc/context/sources/general/leaflets/leaflet-common.tex')
-rw-r--r--doc/context/sources/general/leaflets/leaflet-common.tex80
1 files changed, 80 insertions, 0 deletions
diff --git a/doc/context/sources/general/leaflets/leaflet-common.tex b/doc/context/sources/general/leaflets/leaflet-common.tex
new file mode 100644
index 000000000..52cc31797
--- /dev/null
+++ b/doc/context/sources/general/leaflets/leaflet-common.tex
@@ -0,0 +1,80 @@
+\startenvironment leaflet-common
+
+%D Please don't abuse this style for your own purpose as the look and feel
+%D is reserved for our own purpose. Be creative instead.
+
+\usemodule
+ [abbreviations-logos]
+
+\setupbodyfont
+ [plex,12pt]
+
+\setuplayout
+ [page]
+
+\setupalign
+ [verytolerant,stretch]
+
+\startluacode
+ function document.graphic()
+ local min, max, random, round = math.min, math.max, math.random, math.round
+
+ local width = 210
+ local height = 297
+ local r, g, b = 3, 3, 3
+
+ local bitmap = graphics.bitmaps.new(width,height,"rgb",1)
+ local data = bitmap.data
+
+ local graphic = tonumber(documentdata.variable("graphic"))
+
+ if graphic == 1 then
+ r, g, b = 4, 3, 2
+ elseif graphic == 2 then
+ r, g, b = 2, 3, 4
+ end
+
+ for i=1,height do
+ local d = data[i]
+ for j=1,width do
+ local c = random(128,255)
+ -- d[j] = { 0, 0, c }
+ d[j] = { c//r, c//g, c//b }
+ end
+ end
+
+ graphics.bitmaps.tocontext(bitmap,"210bp","297bp")
+ end
+\stopluacode
+
+\definelayer
+ [page]
+ [width=\paperwidth,
+ height=\paperheight]
+
+\setupcolors
+ [textcolor=white]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\setupmakeup
+ [page]
+ [style=\bf,
+ top=,
+ bottom=]
+
+\startsetups document:start
+
+ \setlayerframed
+ [page]
+ [offset=overlay]
+ {\scale
+ [width=\textwidth,
+ height=\textheight]
+ {\ctxlua{document.graphic()}}}
+
+\stopsetups
+
+\stopenvironment