File:Eps32x22ringRoster.jpg

From TORI
Jump to navigation Jump to search

Eps32x22ringRoster.jpg(322 × 222 pixels, file size: 13 KB, MIME type: image/jpeg)

Example of the roster graphics in EPS.

The black-gray-white rectangles are plotted with the EPS command image.

The red cross is drawn with the EPS commands moveto, lineto, stroke (simplified to M, L, S in the definitions in the beginning of the file).

The image is generated from with simple C++ program and converted to jpg format by the system command convert with the default options.


EPS version of the file

Two empty lines and the leading spacabars were added in the code below to improve the view and simplify the loading; they do not affect to the conversion of this EPS file to other formats.

%!PS-Adobe-2.0 EPSF-2.0

%%BoundingBox: 0 0 322 222

/RGB {setrgbcolor} bind def
/W {setlinewidth} bind def
/M {moveto} bind def
/L {lineto} bind def
/S {stroke} bind def
1 1 translate
10 10 scale
gsave
32 22 scale
32 22 4 [32 0 0 -22 0 22]
<
fffffffffffd73100137dfffffffffff
fffffffffe500000000005efffffffff
ffffffffc20026acca62002cffffffff
fffffffc1018effffffe8101cfffffff
ffffffe202cffffffffffc202effffff
ffffff501cffffffffffffc105ffffff
fffffd008ffffffffffffff800dfffff
fffff702effffffffffffffe207fffff
fffff306ffffffffffffffff603fffff
fffff10affffffffffffffffa01fffff
ffffe00cffffffffffffffffc00effff
ffffe00cffffffffffffffffc00effff
fffff10affffffffffffffffa01fffff
fffff306ffffffffffffffff603fffff
fffff702effffffffffffffe207fffff
fffffd008ffffffffffffff800dfffff
ffffff501cffffffffffffc105ffffff
ffffffe202cffffffffffc202effffff
fffffffc1018effffffe8101cfffffff
ffffffffc20026acca62002cffffffff
fffffffffe500000000005efffffffff
fffffffffffd73100137dfffffffffff
>
image
grestore
16.000 -1.000 M
16.000 23.000 L
-1.000 11.000 M
33.000 11.000 L
1 0 0 RGB .3 W S
showpage
%%Trailer

C++ generator

//The image above is generated with the code below. All the routines are included, no additional files should be loaded for the compilation.

#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#define DB double
void ado(FILE *O, int X, int Y)
{ fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%');
  fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y);
  fprintf(O,"/RGB {setrgbcolor} bind def\n");
  fprintf(O,"/W {setlinewidth} bind def\n");
  fprintf(O,"/M {moveto} bind def\n");
  fprintf(O,"/L {lineto} bind def\n");
  fprintf(O,"/S {stroke} bind def\n"); }
#define DO(x,y) for(x=0;x<y;x++)
//#define D1(x,y) for(x=1;x<y;x++)
main(){ int m,M=32,n,N=22; DB x,y, u,v; FILE *o;
o=fopen("eps32x22ringRoster.eps","w"); ado(o, 10*M+2, 10*N+2);
fprintf(o,"1 1 translate\n");
fprintf(o,"10 10 scale\n");
DB *a; a=(DB *)malloc((size_t)((M*N)*sizeof(DB)));
DO(m,M) DO(n,N){x=.1*(m-M/2.+.5);y=.1*(n-N/2.+.5);
               u=x*x+y*y; v=u-1.; v*=v;
               a[n*M+m]=1.-exp(-256.*v*v);}
fprintf(o,"gsave\n");
fprintf(o,"%2d %2d scale\n",M,N);
fprintf(o,"%2d %2d 4 [%2d 0 0 %2d 0 %2d]\n<", M,N,M,-N,N);
for(n=N-1;n>=0;n--)
      { fprintf(o,"\n");
DO(m,M){ fprintf(o,"%1x",int(15.*a[n*M+m]+.5) );
      }}
fprintf(o,"\n>\n");
fprintf(o,"image\n");
free(a);
fprintf(o,"grestore\n");
#define M(x,y) fprintf(o,"%6.3f %6.3f M\n",0.+x,0.+y);
#define L(x,y) fprintf(o,"%6.3f %6.3f L\n",0.+x,0.+y);
M(M/2.,-1); L(M/2.,N+1);
M(-1,N/2.); L(M+1,N/2.);
fprintf(o,"1 0 0 RGB .3 W S\n");
fprintf(o,"showpage\n%c%cTrailer\n",'%','%'); fclose(o);
system("epstopdf eps32x22ringRoster.eps");
//system(    "open eps32x22ringRoster.pdf");
system( "convert eps32x22ringRoster.eps eps32x22ringRoster.jpg ");
system(    "open eps32x22ringRoster.jpg");
}


Keywords

Some of the following commands of C++ and EPS are listed below:

EPS, roster graphics, C++,

BoundingBox, gsave, grestore,

fopen, fclose, fprintf, malloc, free, system

epstopdf, convert

Refrerences

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:50, 20 June 2013Thumbnail for version as of 17:50, 20 June 2013322 × 222 (13 KB)Maintenance script (talk | contribs)Importing image file

The following 2 pages use this file: