Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BoundingBox or not?

Status
Not open for further replies.

Hemo

Programmer
Apr 9, 2003
190
US
I have a program that will output postscript data. In a section of my program, I will draw some shapes and diagrams based on data that is read, and this data can vary in such a degree that the diagrams may extend far enough to over-write other data on the page. This other data may have already been placed on the page or will be placed on the page after the images.

Since these graphics are generated by my program, and not imported EPS files, I am either having no luck with the BoundingBox comment or am not using it properly. I am inserting a %%BoundingBox:0 62 150 139 just before outputting code that draws the boxes, then I do a gsave. After this I will output the postscript code to draw the diagrams, followed by a grestore. After this, more postscript code drawing on other portions of the page and outputting text.

I desire to create an area on my page, a 'window' where when drawing graphics, and drawing outside that 'window' are not visible, thereby not over-writing other data on the page.

Anyone here know if there a command or method in Postscript code that will accomplish this?
 
I found what I needed to do to restrict printing to a 'window'.

The below code works well for me, I'm not sure if there is better way to do this or not.

This create an rectangular area on the page that acts like a 'window', any later commands will check to see if any portion prints outside the windows and suppresses it from drawing outside the 'window'.


Code:
%% Postscript code, no window

gsave
0 62 moveto
0 140 lineto
170 140 lineto
170 62 lineto
0 62 lineto
clip newpath

%% Postscript restricted to print inside the window

grestore

%% Postscript output continues, no window
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top