2 function addShadow(func
)
4 local isz
= math
.floor( size
*100/(100+shadow_grow
) + 0.5)
5 local offx
= shadow_offset_x
*isz
/200
6 local offy
= shadow_offset_y
*isz
/200
8 local s
= i
:create_shadow( shadow
*isz
/100, shadow_color
,
9 Point(size
-isz
, size
-isz
),
11 s
:draw_image(Rect((size
-isz
)/2-offx
, (size
-isz
)/2-offy
,isz
,isz
), i
, Rect(0,0,isz
,isz
))
16 function fromSVG_Direct(file
)
18 local i
= Image(size
,size
)
20 i
:draw_svg(Rect(0,0,size
,size
), file
)
25 function fromSVG(file
)
27 return addShadow(fromSVG_Direct(file
))
29 return fromSVG_Direct(file
)
33 function fromFontGlyph_Direct(...)
34 local t
= (function(...) return ... end):partial(...)
36 local i
= Image(size
,size
)
38 i
:draw_glyph(Rect(0,0,size
,size
), t())
43 -- function fromFontGlyph_Direct(file, glyph, fg, bg, border, draw_inner_bg)
44 -- return function(size)
45 -- local i = Image(size,size)
47 -- i:draw_glyph(Rect(0,0,size,size), file, glyph, fg, bg, border, draw_inner_bg)
52 function fromFontGlyph(...)
54 return addShadow(fromFontGlyph_Direct(...))
56 return fromFontGlyph_Direct(...)
60 function fromPixmap(file
)
62 local i
= Image(size
,size
)
63 i
:set_paint_over(false)
64 i
:draw_image(Rect(0,0,size
,size
), file
)
69 function fromColor(color
)
71 local i
= Image(size
,size
)