Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
SbPainterPS Class Reference

#include <SbPainterPS.h>

Inheritance diagram for SbPainterPS:

Public Types

typedef int(* GetRGB_Function) (unsigned int, unsigned int, double &, double &, double &)

Public Member Functions

 SbPainterPS ()
 ~SbPainterPS ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void beginTraversal ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void clearColorBuffer (float, float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void endTraversal ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setColorScheme (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setOrientation (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setBackgroundDrawn (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setBitsPerPixel (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setLineWidth (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void * getStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setFileName (const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
const char * getFileName () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void openFileForWriting (const char *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void closeStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putPageScaleInStream (float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putSaveStateInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putRestoreStateInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putTranslationInStream (float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putScaleInStream (float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putBeginPageInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putEndPageInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putRGB_InStream (float, float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putMarkerSizeInStream (float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putBackgroundInStream (float, float, float, float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putFrameInStream (float, float, float, float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putRotateInStream (float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putNewPathInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putStrokeInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putFillInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putClosePathInStream ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putCapInStream (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putLineToInStream (float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putMoveInStream (float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putCircleInStream (float, float, float)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putLineWidthInStream (int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putImageInStream (unsigned int, unsigned int, GetRGB_Function)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Public Member Functions inherited from SbPainter
 SbPainter ()
virtual ~SbPainter ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setWindowSize (int, int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void enableEdges (SbBool)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Additional Inherited Members

Protected Attributes inherited from SbPainter
int fWindowWidth
int fWindowHeight
float fRed
float fGreen
float fBlue
SbBool fEdges

Detailed Description

Definition at line 41 of file SbPainterPS.h.

Member Typedef Documentation

◆ GetRGB_Function

typedef int(* SbPainterPS::GetRGB_Function) (unsigned int, unsigned int, double &, double &, double &)

Definition at line 85 of file SbPainterPS.h.

Constructor & Destructor Documentation

◆ SbPainterPS()

SbPainterPS::SbPainterPS ( )

Definition at line 53 of file SbPainterPS.cc.

55:fDeviceWidth((8.5-1.) * 72. * METAFILE_SCALE) /* 540. * METAFILE_SCALE */
56,fDeviceHeight(11. * 72. * METAFILE_SCALE) /* 792. * METAFILE_SCALE */
57,fPageNumber(0)
58,fMarkerSize(2.)
59,fFile(NULL)
60,fFileName(NULL)
61,fGSave(0)
62,fBufferCount(0)
63,fBufferString(NULL)
64//////////////////////////////////////////////////////////////////////////////
65//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
66{
67 fParams.shade = Color;
68 fParams.portrait = 1;
69 fParams.nbit = 2;
70 fParams.doBack = 1;
71 fParams.lineWidth = -1.;
72 fBufferPointer[0] = '\0';
73#ifdef WIN32
74 ::setlocale(LC_NUMERIC,"USA");
75#endif
76}
#define METAFILE_SCALE

Referenced by SbPainterPS().

◆ ~SbPainterPS()

SbPainterPS::~SbPainterPS ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 78 of file SbPainterPS.cc.

82{
83 if(fFile!=NULL) closeStream ();
84 if(fBufferString!=NULL) ::free(fBufferString);
85 fBufferString = NULL;
86 if(fGSave!=0) {
87 ::printf("SbPainterPS : bad gsave/grestore balance : %d.\n",fGSave);
88 }
89}
void closeStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void free(voidpf ptr)

Referenced by ~SbPainterPS().

Member Function Documentation

◆ beginTraversal()

void SbPainterPS::beginTraversal ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Implements SbPainter.

Definition at line 93 of file SbPainterPS.cc.

97{
98 if(fFile==NULL) openFileForWriting(NULL);
99 if(fFile==NULL) return;
101 putPageScaleInStream((float)fWindowWidth,(float)fWindowHeight);
103}
void putBeginPageInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putSaveStateInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putPageScaleInStream(float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void openFileForWriting(const char *)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by beginTraversal(), and SoImageWriter::GLRender().

◆ clearColorBuffer()

void SbPainterPS::clearColorBuffer ( float aRed,
float aGreen,
float aBlue )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Implements SbPainter.

Definition at line 116 of file SbPainterPS.cc.

123{
124 if(fFile==NULL) return;
125 putBackgroundInStream(aRed,aGreen,aBlue,
126 (float)fWindowWidth,(float)fWindowHeight);
127}
void putBackgroundInStream(float, float, float, float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by clearColorBuffer(), and SoImageWriter::GLRender().

◆ closeStream()

void SbPainterPS::closeStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 440 of file SbPainterPS.cc.

444{
445 if(fFile==NULL) return;
447 printFLN("%%%%Trailer");
448 printFLN("%%%%Pages: %d",fPageNumber);
449 printFLN("%%%%EOF");
450 if(fFile!=NULL) ::fclose(fFile);
451 fFile = NULL;
452 STRDEL(fFileName);
453 fFileName = NULL;
454}
#define STRDEL(str)
void putRestoreStateInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by closeStream(), SoImageWriter::GLRender(), openFileForWriting(), and ~SbPainterPS().

◆ endTraversal()

void SbPainterPS::endTraversal ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Implements SbPainter.

Definition at line 105 of file SbPainterPS.cc.

109{
110 if(fFile==NULL) return;
111 putFrameInStream(0.0,0.0,0.0,(float)fWindowWidth,(float)fWindowHeight);
114}
void putEndPageInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putFrameInStream(float, float, float, float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by endTraversal(), and SoImageWriter::GLRender().

◆ getFileName()

const char * SbPainterPS::getFileName ( ) const

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 350 of file SbPainterPS.cc.

354{
355 return fFileName;
356}

Referenced by getFileName().

◆ getStream()

void * SbPainterPS::getStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 358 of file SbPainterPS.cc.

362{
363 return fFile;
364}

Referenced by getStream(), and SoImageWriter::GLRender().

◆ openFileForWriting()

void SbPainterPS::openFileForWriting ( const char * aString)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 366 of file SbPainterPS.cc.

371{
372 if(fFile!=NULL) closeStream ();
373 if( (aString==NULL) || (*aString=='\0') ) {
374 if( (fFileName==NULL) || (*fFileName=='\0') ) { // Take default name :
375 fFile = ::fopen(METAFILE_DEFAULT,"wb");
376 STRDEL(fFileName);
377 fFileName = STRDUP(METAFILE_DEFAULT);
378 } else {
379 fFile = ::fopen(fFileName,"wb");
380 }
381 } else {
382 fFile = ::fopen(aString,"wb");
383 STRDEL(fFileName);
384 fFileName = STRDUP(aString);
385 }
386 if(fFile==NULL) return;
387
388 fBufferCount = 0;
389 fBufferPointer[METAFILE_RECORD_LENGTH] = '\0';
390 fPageNumber = 0;
391 // Header :
392 printFLN ("%%!PS-Adobe-2.0");
393 printFLN ("%%%%Creator: HEPVis::SbPainterPS.");
394 printFLN("%%%%CreationDate: %s",GetDate());
395 printFLN("%%%%Title: %s",fFileName);
396 printFLN("%%%%Pages: (atend)");
397 printFLN("%%%%BoundingBox: 0 0 %d %d",
398 (int)fDeviceWidth,(int)fDeviceHeight);
399 printFLN("%%%%DocumentFonts: Courier-Bold");
400 printFLN("%%%%DocumentPaperSizes: a4");
401 printFLN("%%%%EndComments");
402 // PostScript :
404 // General :
405 putInStreamF("/n {newpath} def ");
406 putInStreamF("/cl {closepath} def ");
407 putInStreamF("/s {stroke} def ");
408 putInStreamF("/f {fill} def ");
409 // Move :
410 putInStreamF("/m {moveto} def ");
411 putInStreamF("/rm {rmoveto} def ");
412 putInStreamF("/rl {rlineto} def ");
413 // Line :
414 putInStreamF("/lc {setlinecap} def ");
415 putInStreamF("/lw {setlinewidth} def ");
416 putInStreamF("/rgb {setrgbcolor} def ");
417 putInStreamF("/ss {[] 0 setdash} def ") ; /* style solid */
418 putInStreamF("/sd {[12 6] 0 setdash} def "); /* style dashed */
419 putInStreamF("/so {[6 12] 0 setdash} def "); /* style dotted */
420 putInStreamF("/sdo {[18 12 6 12] 0 setdash} def "); /* style dash dotted */
421 // Mark :
422 fMarkerSize = 2.;
423 putInStreamF("/ms 2. def /msi .5 def "); /* mark size */
424 putInStreamF("/cross {ms ms scale -1. -1. rm ");
425 putInStreamF("2. 2. rl 0. -2. rm -2. 2. rl msi msi scale} def ");
426 putInStreamF("/plus {ms ms scale -1. 0. rm 2. 0. rl ");
427 putInStreamF("-1. 1. rm 0. -2. rl msi msi scale} def ");
428 putInStreamF("/asterisk {ms ms scale -1. 0. rm 2. 0. rl -1. 1. rm ");
429 putInStreamF("0. -2. rl 0. 1. rm -0.707 -0.707 rm 1.414 1.414 rl ");
430 putInStreamF("0. -1.414 rm -1.414 1.414 rl msi msi scale} def ");
431 putInStreamF("/triangle {ms ms scale 0. 1. rm -0.6 -1.5 rl ");
432 putInStreamF("1.2 0. rl -0.6 1.5 rl msi msi scale} def ");
433 // Text :
434 putInStreamF("/sh {show} def ");
435 putInStreamF("/df {/Courier-Bold findfont} def ");
436 putInStreamF("/mf {makefont setfont} def ");
437 printFLN("%%%%EndProlog");
438}
#define STRDUP(str)
#define METAFILE_DEFAULT
#define METAFILE_RECORD_LENGTH

Referenced by beginTraversal(), SoImageWriter::GLRender(), and openFileForWriting().

◆ putBackgroundInStream()

void SbPainterPS::putBackgroundInStream ( float aR,
float aG,
float aB,
float aWidth,
float aHeight )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 705 of file SbPainterPS.cc.

714{
716 putMoveInStream(0.,0.);
717 putLineToInStream(aWidth,0.);
718 putLineToInStream(0.,aHeight);
719 putLineToInStream(-aWidth,0.);
720 putLineToInStream(0.,-aHeight);
722 if(fParams.doBack==1) {
723 // Back :
725 putRGB_InStream(aR,aG,aB);
728 }
729 // Clip :
730 putInStreamF("clip ");
731}
void putMoveInStream(float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putClosePathInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putNewPathInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putLineToInStream(float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putRGB_InStream(float, float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putFillInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by clearColorBuffer(), and putBackgroundInStream().

◆ putBeginPageInStream()

void SbPainterPS::putBeginPageInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 614 of file SbPainterPS.cc.

618{
619 fPageNumber++;
620 printFLN("%%%%Page: %d %d",fPageNumber,fPageNumber);
622}

Referenced by beginTraversal(), and putBeginPageInStream().

◆ putCapInStream()

void SbPainterPS::putCapInStream ( int aX)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 809 of file SbPainterPS.cc.

814{
815 putInStreamF("%1d lc ",aX);
816}

Referenced by putCapInStream(), and putFrameInStream().

◆ putCircleInStream()

void SbPainterPS::putCircleInStream ( float aX,
float aY,
float aR )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 838 of file SbPainterPS.cc.

845{
846 putInStreamF("%.2f %.2f %.2f 0 360 arc s ",aX,aY,aR);
847}

Referenced by putCircleInStream().

◆ putClosePathInStream()

void SbPainterPS::putClosePathInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 801 of file SbPainterPS.cc.

805{
806 putInStreamF("cl ");
807}

Referenced by putBackgroundInStream(), putClosePathInStream(), and putFrameInStream().

◆ putEndPageInStream()

void SbPainterPS::putEndPageInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 624 of file SbPainterPS.cc.

628{
629 putInStreamF("showpage ");
631}

Referenced by endTraversal(), and putEndPageInStream().

◆ putFillInStream()

void SbPainterPS::putFillInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 793 of file SbPainterPS.cc.

797{
798 putInStreamF("f ");
799}

Referenced by putBackgroundInStream(), and putFillInStream().

◆ putFrameInStream()

void SbPainterPS::putFrameInStream ( float aR,
float aG,
float aB,
float aWidth,
float aHeight )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 733 of file SbPainterPS.cc.

742{
744 putMoveInStream(0.,0.);
745 putLineToInStream(aWidth,0.);
746 putLineToInStream(0.,aHeight);
747 putLineToInStream(-aWidth,0.);
748 putLineToInStream(0.,-aHeight);
750 putRGB_InStream(aR,aG,aB);
753 putInStreamF("ss ");
755}
void putStrokeInStream()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putCapInStream(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putLineWidthInStream(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by endTraversal(), and putFrameInStream().

◆ putImageInStream()

void SbPainterPS::putImageInStream ( unsigned int aWidth,
unsigned int aHeight,
GetRGB_Function aProc )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 869 of file SbPainterPS.cc.

876{
877 if((aWidth<=0)||(aHeight<=0)) return;
878 if(!aProc) return;
879
881 putInStreamF ("%d %d scale ", aWidth, aHeight );
882 int status = 1;
883 int nbhex;
884 unsigned int row,col,col_max;
885 double dr,dg,db;
886 typedef unsigned char Uchar;
887 Uchar red,green,blue,b;
888 if(fParams.shade!=0) { /*grey*/
889 putInStreamF ("/picstr %d string def ",aWidth);
890 putInStreamF ("%d %d %d ",aWidth,aHeight,8);
891 putInStreamF ("[ %d 0 0 -%d 0 %d ] ",aWidth,aHeight,aHeight);
892 putInStreamF ("{ currentfile picstr readhexstring pop } " );
893 printFLN ("image " );
894 for ( row = 0; row < aHeight; row++ ){
895 for ( col = 0; col < aWidth; col++){
896 double fgrey;
897 Uchar grey;
898 status = aProc(col,row,dr,dg,db)==0 ? 0 : status;
899 fgrey = ConvertRGB_ToGrey(dr,dg,db);
900 grey = (Uchar) ( 255. * fgrey);
901 writeByte (grey);
902 }
903 }
904 nbhex = aWidth * aHeight * 2;
905 printFLN ("%%%% nbhex digit :%d ",nbhex);
906 printFLN ("%%%% nbhex/record_length :%d ",nbhex/METAFILE_RECORD_LENGTH);
907 printFLN ("%%%% nbhex%%record_length :%d ",nbhex%METAFILE_RECORD_LENGTH);
908 }else if(fParams.nbit==2){
909 int nbyte2;
910 nbyte2 = (aWidth * 3)/4;
911 nbyte2 /=3;
912 nbyte2 *=3;
913 col_max = (nbyte2 * 4)/3;
914 /* 2 bit for r and g and b */
915 /* rgbs following each other */
916 putInStreamF ("/rgbstr %d string def ",nbyte2);
917 putInStreamF ("%d %d %d ",col_max,aHeight,2);
918 putInStreamF ("[ %d 0 0 -%d 0 %d ] ",col_max,aHeight,aHeight);
919 putInStreamF ("{ currentfile rgbstr readhexstring pop } " );
920 putInStreamF ("false 3 " );
921 printFLN ("colorimage " );
922 for ( row = 0; row < aHeight; row++ ){
923 for ( col = 0; col < col_max; col+=4){
924 status = aProc(col,row,dr,dg,db)==0 ? 0 : status;
925 red = (Uchar) ( 3. * dr);
926 green = (Uchar) ( 3. * dg);
927 blue = (Uchar) ( 3. * db);
928 b = red;
929 b = (b<<2)+green;
930 b = (b<<2)+blue;
931 status = aProc(col+1,row,dr,dg,db)==0 ? 0 : status;
932 red = (Uchar) ( 3. * dr);
933 green = (Uchar) ( 3. * dg);
934 blue = (Uchar) ( 3. * db);
935 b = (b<<2)+red;
936 writeByte (b);
937
938 b = green;
939 b = (b<<2)+blue;
940 status = aProc(col+2,row,dr,dg,db)==0 ? 0 : status;
941 red = (Uchar) ( 3. * dr);
942 green = (Uchar) ( 3. * dg);
943 blue = (Uchar) ( 3. * db);
944 b = (b<<2)+red;
945 b = (b<<2)+green;
946 writeByte (b);
947
948 b = blue;
949 status = aProc(col+3,row,dr,dg,db)==0 ? 0 : status;
950 red = (Uchar) ( 3. * dr);
951 green = (Uchar) ( 3. * dg);
952 blue = (Uchar) ( 3. * db);
953 b = (b<<2)+red;
954 b = (b<<2)+green;
955 b = (b<<2)+blue;
956 writeByte (b);
957 }
958 }
959 }else if(fParams.nbit==4){
960 int nbyte4;
961 nbyte4 = (aWidth * 3)/2;
962 nbyte4 /=3;
963 nbyte4 *=3;
964 col_max = (nbyte4 * 2)/3;
965 /* 4 bit for r and g and b */
966 /* rgbs following each other */
967 putInStreamF ("/rgbstr %d string def ",nbyte4);
968 putInStreamF ("%d %d %d ",col_max,aHeight,4);
969 putInStreamF ("[ %d 0 0 -%d 0 %d ] ",col_max,aHeight,aHeight);
970 putInStreamF ("{ currentfile rgbstr readhexstring pop } " );
971 putInStreamF ("false 3 " );
972 printFLN ("colorimage " );
973 for ( row = 0; row < aHeight; row++ ){
974 for ( col = 0; col < col_max; col+=2){
975 status = aProc(col,row,dr,dg,db)==0 ? 0 : status;
976 red = (Uchar) ( 15. * dr);
977 green = (Uchar) ( 15. * dg);
978 putInStreamF ("%x%x",red,green);
979 blue = (Uchar) ( 15. * db);
980
981 status = aProc(col+1,row,dr,dg,db)==0 ? 0 : status;
982 red = (Uchar) ( 15. * dr);
983 putInStreamF ("%x%x",blue,red);
984 green = (Uchar) ( 15. * dg);
985 blue = (Uchar) ( 15. * db);
986 putInStreamF ("%x%x",green,blue);
987 }
988 }
989 }else{
990 int nbyte8;
991 nbyte8 = aWidth * 3;
992 /* 8 bit for r and g and b */
993 putInStreamF ("/rgbstr %d string def ",nbyte8);
994 putInStreamF ("%d %d %d ",aWidth,aHeight,8);
995 putInStreamF ("[ %d 0 0 -%d 0 %d ] ",aWidth,aHeight,aHeight);
996 putInStreamF ("{ currentfile rgbstr readhexstring pop } " );
997 putInStreamF ("false 3 " );
998 printFLN ("colorimage " );
999 for ( row = 0; row < aHeight; row++ ){
1000 for ( col = 0; col < aWidth; col++){
1001 status = aProc(col,row,dr,dg,db)==0 ? 0 : status;
1002 red = (Uchar) ( 255. * dr);
1003 writeByte (red);
1004 green = (Uchar) ( 255. * dg);
1005 writeByte (green);
1006 blue = (Uchar) ( 255. * db);
1007 writeByte (blue);
1008 }
1009 }
1010 }
1011 if(status==0)
1012 ::printf("SbPainterPS::putImageInStream: problem to retrieve some pixel rgb.\n");
1014}
unsigned char Uchar

Referenced by SoImageWriter::GLRender(), and putImageInStream().

◆ putLineToInStream()

void SbPainterPS::putLineToInStream ( float aX,
float aY )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 818 of file SbPainterPS.cc.

824{
825 putInStreamF ("%.2f %.2f rl ",aX,aY);
826}

Referenced by putBackgroundInStream(), putFrameInStream(), and putLineToInStream().

◆ putLineWidthInStream()

void SbPainterPS::putLineWidthInStream ( int aWidth)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 649 of file SbPainterPS.cc.

654{
655 if(fParams.lineWidth<0.) {
656 if(aWidth==1) {
657 putInStreamF("%.1f lw ",0.5); // For a better rendering.
658 } else {
659 putInStreamF("%.1f lw ",(float)(aWidth));
660 }
661 } else {
662 putInStreamF("%.1f lw ",fParams.lineWidth);
663 }
664}

Referenced by putFrameInStream(), and putLineWidthInStream().

◆ putMarkerSizeInStream()

void SbPainterPS::putMarkerSizeInStream ( float aSize)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 666 of file SbPainterPS.cc.

671{
672 if(aSize==fMarkerSize) return;
673 fMarkerSize = aSize;
674 putInStreamF("/ms %g def /msi %g def ",aSize,1./aSize);
675}

Referenced by putMarkerSizeInStream().

◆ putMoveInStream()

void SbPainterPS::putMoveInStream ( float aX,
float aY )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 828 of file SbPainterPS.cc.

834{
835 putInStreamF ("%.2f %.2f m ",aX,aY);
836}

Referenced by putBackgroundInStream(), putFrameInStream(), and putMoveInStream().

◆ putNewPathInStream()

void SbPainterPS::putNewPathInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 777 of file SbPainterPS.cc.

781{
782 putInStreamF("n ");
783}

Referenced by putBackgroundInStream(), putFrameInStream(), and putNewPathInStream().

◆ putPageScaleInStream()

void SbPainterPS::putPageScaleInStream ( float aWidth,
float aHeight )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 536 of file SbPainterPS.cc.

542{
543 if(aWidth <=0.) aWidth = 100.;
544 if(aHeight<=0.) aHeight = 100.;
545
547 putTranslationInStream ((float)(fDeviceWidth/20.),
548 (float)(fDeviceHeight/30.));
549
550 float scale;
551 if(fDeviceWidth<=fDeviceHeight)
552 scale = (aHeight<=aWidth ?
553 fDeviceWidth /aWidth : fDeviceWidth /aHeight );
554 else
555 scale = (aHeight<=aWidth ?
556 fDeviceHeight /aWidth : fDeviceHeight /aHeight );
557
558 float xtra,ytra;
559 if(fParams.portrait==1) {
560 xtra = (fDeviceWidth - scale * aWidth)/2;
561 ytra = (fDeviceHeight - scale * aHeight)/2;
562 } else {
563 putTranslationInStream(fDeviceWidth,0.);
565 xtra = (fDeviceHeight - scale * aWidth)/2;
566 ytra = (fDeviceWidth - scale * aHeight)/2;
567 }
568 putTranslationInStream (xtra,ytra);
569
570 putScaleInStream (scale,scale);
571}
void putRotateInStream(float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putScaleInStream(float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void putTranslationInStream(float, float)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Referenced by beginTraversal(), and putPageScaleInStream().

◆ putRestoreStateInStream()

void SbPainterPS::putRestoreStateInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 585 of file SbPainterPS.cc.

589{
590 putInStreamF("grestore ");
591 fGSave--;
592}

Referenced by closeStream(), endTraversal(), putBackgroundInStream(), putEndPageInStream(), putImageInStream(), and putRestoreStateInStream().

◆ putRGB_InStream()

void SbPainterPS::putRGB_InStream ( float aR,
float aG,
float aB )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 633 of file SbPainterPS.cc.

640{
641 if(fParams.shade==Color)
642 putInStreamF("%.2f %.2f %.2f rgb ",aR,aG,aB);
643 else if(fParams.shade==Grey)
644 putInStreamF("%.2f setgray ",convertRGB_ToGrey(aR,aG,aB));
645 else if(fParams.shade==BlackWhite)
646 putInStreamF("0. setgray ",convertRGB_ToGrey(aR,aG,aB));
647}

Referenced by putBackgroundInStream(), putFrameInStream(), and putRGB_InStream().

◆ putRotateInStream()

void SbPainterPS::putRotateInStream ( float aX)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 768 of file SbPainterPS.cc.

773{
774 putInStreamF("%.2f rotate ",aX);
775}

Referenced by putPageScaleInStream(), and putRotateInStream().

◆ putSaveStateInStream()

void SbPainterPS::putSaveStateInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 576 of file SbPainterPS.cc.

580{
581 putInStreamF("gsave ");
582 fGSave++;
583}

Referenced by beginTraversal(), openFileForWriting(), putBackgroundInStream(), putBeginPageInStream(), putImageInStream(), and putSaveStateInStream().

◆ putScaleInStream()

void SbPainterPS::putScaleInStream ( float aX,
float aY )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 604 of file SbPainterPS.cc.

610{
611 putInStreamF("%.2f %.2f scale ",aX,aY);
612}

Referenced by putPageScaleInStream(), and putScaleInStream().

◆ putStrokeInStream()

void SbPainterPS::putStrokeInStream ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 785 of file SbPainterPS.cc.

789{
790 putInStreamF("s ");
791}

Referenced by putFrameInStream(), and putStrokeInStream().

◆ putTranslationInStream()

void SbPainterPS::putTranslationInStream ( float aX,
float aY )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 594 of file SbPainterPS.cc.

600{
601 putInStreamF("%.2f %.2f translate ",aX,aY);
602}

Referenced by putPageScaleInStream(), and putTranslationInStream().

◆ setBackgroundDrawn()

void SbPainterPS::setBackgroundDrawn ( int aDoback)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 308 of file SbPainterPS.cc.

313{
314 fParams.doBack = aDoback;
315}

Referenced by setBackgroundDrawn().

◆ setBitsPerPixel()

void SbPainterPS::setBitsPerPixel ( int aNbit)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 317 of file SbPainterPS.cc.

322{
323 if( (aNbit==2) || (aNbit==4) || (aNbit==8) )
324 fParams.nbit = aNbit;
325 else
326 fParams.nbit = 2;
327}

Referenced by SoImageWriter::GLRender(), and setBitsPerPixel().

◆ setColorScheme()

void SbPainterPS::setColorScheme ( int aShade)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 290 of file SbPainterPS.cc.

295{
296 fParams.shade = aShade;
297}

Referenced by setColorScheme().

◆ setFileName()

void SbPainterPS::setFileName ( const char * aString)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 340 of file SbPainterPS.cc.

345{
346 STRDEL(fFileName);
347 fFileName = STRDUP(aString);
348}

Referenced by setFileName().

◆ setLineWidth()

void SbPainterPS::setLineWidth ( int aWidth)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 329 of file SbPainterPS.cc.

334{
335 fParams.lineWidth = (float)aWidth;
336}

Referenced by setLineWidth().

◆ setOrientation()

void SbPainterPS::setOrientation ( int aPortrait)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 299 of file SbPainterPS.cc.

304{
305 fParams.portrait = aPortrait;
306}

Referenced by setOrientation().

Member Data Documentation

◆ doBack

int SbPainterPS::doBack

Definition at line 102 of file SbPainterPS.h.

◆ lineWidth

float SbPainterPS::lineWidth

Definition at line 103 of file SbPainterPS.h.

◆ nbit

int SbPainterPS::nbit

Definition at line 101 of file SbPainterPS.h.

◆ portrait

int SbPainterPS::portrait

Definition at line 100 of file SbPainterPS.h.

◆ shade

int SbPainterPS::shade

Definition at line 99 of file SbPainterPS.h.


The documentation for this class was generated from the following files: