1if not modules then modules = { } end modules ['grph-raw'] = {
2 version = 1.001,
3 comment = "companion to grph-raw.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9
10
11
12
13local tonumber = tonumber
14
15local report_bitmap = logs.reporter("graphics","bitmaps")
16
17local context = context
18local texsp = tex.sp
19
20function figures.bitmapimage(t)
21 local data = t.data
22 local xresolution = t.xresolution
23 local yresolution = t.yresolution
24 if data and xresolution and yresolution then
25 local n = backends.nodeinjections.injectbitmap {
26 xresolution = xresolution,
27 yresolution = yresolution,
28 width = t.width,
29 height = t.height,
30 data = data,
31 colorspace = t.colorspace,
32 format = t.format,
33 }
34 if n then
35
36 context(nodes.hpack(n))
37 else
38 report_bitmap("format not supported by backend")
39 end
40 else
41 report_bitmap("invalid specification")
42 end
43end
44
45interfaces.implement {
46 name = "bitmapimage",
47 actions = figures.bitmapimage,
48 arguments = {
49 {
50 { "data" },
51 { "colorspace" },
52 { "width", "dimen" },
53 { "height", "dimen" },
54 { "xresolution", "integer" },
55 { "yresolution", "integer" },
56 }
57 }
58}
59 |