From e2658addf306f729945c184e46f98df39dd7026c Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Wed, 29 May 2019 21:10:47 +0200
Subject: 2019-05-29 19:20:00

---
 .../sources/general/leaflets/leaflet-common.tex    | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 doc/context/sources/general/leaflets/leaflet-common.tex

(limited to 'doc/context/sources/general/leaflets/leaflet-common.tex')

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
-- 
cgit v1.2.3

