Triangle factory...

David Kastrup <[email protected]> Thu, 17 Feb 2005 17:12:07 +0100
Newsgroups gmane.emacs.auc-tex,gmane.emacs.latex.preview.devel
Message-ID <[email protected]>
--=-=-=


Ok, here is my present to Ralf (or whoever else):


--=-=-=
Content-Disposition: inline; filename=danger2.mp

beginfig(0);
u := 1in;
v := 0.1u;
pickup pencircle scaled v;
filldraw (0.5v,0.5v)--(0.5u,u-0.5v)--(u-0.5v,0.5v)--cycle withcolor white;
draw (0.5v,0.5v)--(0.5u,u-0.5v)--(u-0.5v,0.5v)--cycle withcolor 0.6[white,red];
endfig;
end


--=-=-=


Change the ratio for v to change the line thickness.  And change the
"0.6" to change the saturation of the red (though I think 0.6 looks
more or less ok).  Then run this through METAPOST (simply with mpost
danger2).  Then you can just say

gs -q -dNOPAUSE -dBATCH -r24x24 -g24x24 -dGraphicsAlphaBits=2 -sDEVICE=pngalpha -sOutputFile=danger24.png danger2.0

Use other numbers than 24 for other resolutions.  You can get more
antialiasing by using a 4 for GraphicsAlphaBits, but that has a larger
impact on the palette, and leads to more smudged out borders (and we
are short of space, anyway).  The resulting png has full alpha
transparency: after the final save to xpm this will be replaced by
normal transparency.

I don't think that the lack of full alpha transparency would warrant
delivering an _additional_ set of png icons together with the
_required_ xpm icons.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

--=-=-=--