HowTo:BackgroundImg

From S2PLOT

Jump to: navigation, search

How to run an S2PLOT program over a background image

It is simple to run an existing S2PLOT program over the top of a background image. This behaviour is completely controlled by runtime environment variables, so no modification to program code is required. An example use case for this is to have a background image created in eg. Powerpoint with description dot-points, and a space left for S2PLOT graphics to "embedded" as an "interactive figure".

You will need a background image in TGA format. You can use the ImageMagick "convert" utility to write a TGA file from almost any bitmap format file.

Prior to running your S2PLOT program, simply set the following environment variables:

variable meaning sample value
S2PLOT_BGIMG filename of background TGA image "universe.tga"
S2PLOT_X1 X coord of bottom left corner for S2PLOT graphics 0.2
S2PLOT_Y1 Y coord of bottom left corner for S2PLOT graphics 0.1
S2PLOT_X2 X coord of top right corner for S2PLOT graphics 0.7
S2PLOT_Y2 Y coord of top right corner for S2PLOT graphics 0.9

The coordinates are given in the range [0,1], and define the sub-window of the S2PLOT window which is used for the S2PLOT 3-d graphics. The background image covers the entire window, even if it must be stretched to do so.

Once running, the S2PLOT graphics can be toggled back and forth between the defined window (with uncovered parts of the background image visible) and using the full window (not to be confused with fullscreen). Currently the standard keypress for this toggle is the exclamation mark "!".

Personal tools