%% %% %% To generate the output, we're using: %% %% gs -dNOPAUSE -sDEVICE=png16m -dASCII -g50x50 -sOutputFile=pdpc-ascii.png pdpc.ps %% gs -dNOPAUSE -sDEVICE=png16m -g75x75 -sOutputFile=pdpc-small.png pdpc.ps %% gs -dNOPAUSE -sDEVICE=png16m -g250x250 -sOutputFile=pdpc-large.png pdpc.ps %% %% Then ran this command, which uses aalib: %% %% asciiview -driver stdout pdpc-ascii.png %% %% (we're still using the original script, found on http://freenode.net/images/pdpc-ascii.ps.txt , %% for the ASCII script; it just seems to look better in ASCII.) %% %% ======================================================================== %% %% Originally written by Dossy Shiobara, this version is written by Karl Y. Pradene %% %% Add a -dASCII param to set Alternatives colors for asciiview %% Add Anti Aliasing %% Add Device dimension management, no more need to specify %% Add HexaColor Func to simply enter color in hexadecimal format %% Rewrite wedge Func %% . %% Copyright (c) 2005, Dossy Shiobara and Karl Y. Pradene %% All rights reserved. %% %% The following terms apply to all files associated with the software %% unless explicitly disclaimed in individual files. %% %% The authors hereby grant permission to use, copy, modify, distribute, %% and license this software and its documentation for any purpose, provided %% that existing copyright notices are retained in all copies and that this %% notice is included verbatim in any distributions. No written agreement, %% license, or royalty fee is required for any of the authorized uses. %% Modifications to this software may be copyrighted by their authors %% and need not follow the licensing terms described here, provided that %% the new terms are clearly indicated on the first page of each file where %% they apply. %% %% IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY %% FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES %% ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY %% DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE %% POSSIBILITY OF SUCH DAMAGE. %% %% THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, %% INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, %% FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE %% IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE %% NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR %% MODIFICATIONS. %% %% GOVERNMENT USE: If you are acquiring this software on behalf of the %% U.S. government, the Government shall have only "Restricted Rights" %% in the software and related documentation as defined in the Federal %% Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you %% are acquiring the software on behalf of the Department of Defense, the %% software shall be classified as "Commercial Computer Software" and the %% Government shall have only "Restricted Rights" as defined in Clause %% 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the %% authors grant the U.S. Government and others acting in its behalf %% permission to use and distribute the software in accordance with the %% terms specified in this license. %% << /GraphicsAlphaBits 4 >> setpagedevice currentpagedevice /PageSize get aload pop /height exch def /width exch def /border width 100 gt { 20 } { 5 } ifelse def /center width 2 div def /radius width border sub 2 div def /remaining_wedge 0.0001 def /pdpc_wedge 78.9432 def /unicef_wedge 17.8195 def /fees_wedge 3.2371 def /line_width 1 def /line_color { 0.5 setgray } bind def /curdeg { 90.0 } def /HexaColor { % Convert String of Hexa into 3 real numbers 0 1 2 { 2 mul 1 index exch 2 getinterval { dup 97 ge { 32 sub } if dup 65 ge { 7 sub } if 48 sub }forall exch 16 mul add 255 div exch }for pop }bind def /ASCII where { % If ASCII is defined generating the ASCII pie chart pop /bg_color { 0 0 0 } def % black background /pdpc_color { 0.4 0.4 0.4 } def % gray /unicef_color { 0.6 0.6 0.6 } def % lighter gray /fees_color { 0.8 0.8 0.8 } def % lighter gray still /remaining_color { 0.05 0.05 0.05 } def % dark gray }{ /bg_color { (E6E6E6) HexaColor } def % { 0.9 0.9 0.9 } /pdpc_color { (97ACDA) HexaColor } def % { 0.5921 0.6745 0.8549 } /unicef_color { (74E76E) HexaColor } def % { 0.4549 0.9058 0.4313 } /fees_color { (E35B5B) HexaColor } def % { 0.8901 0.3568 0.3568 } /remaining_color { (F0CB5C) HexaColor } def % { 0.9411 0.7960 0.3607 } } ifelse /wedge { % proc to draw wedges 100 div 360 mul curdeg exch sub /nextdeg exch def setrgbcolor newpath center dup 2 copy moveto radius curdeg nextdeg arcn closepath gsave fill grestore line_color stroke /curdeg nextdeg def }bind def % fill background bg_color setrgbcolor 0 0 width height rectfill % draw wedges line_width setlinewidth pdpc_color pdpc_wedge wedge unicef_color unicef_wedge wedge fees_color fees_wedge wedge remaining_color remaining_wedge wedge % all done showpage quit %% %% http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html %% http://www.physics.emory.edu/~weeks/graphics/colorps.html %% http://www.cs.usfca.edu/~parrt/course/652/labs/postscript.html %% http://www.math.ubc.ca/~cass/courses/ps.html %%