5.6 Background

These functions change background image.

MGL command: clf ['col']
MGL command: clf r g b
Method on mglGraph: void Clf ()
Method on mglGraph: void Clf (const char * col)
Method on mglGraph: void Clf (char col)
Method on mglGraph: void Clf (mreal r, mreal g, mreal b)
C function: void mgl_clf (HMGL gr)
C function: void mgl_clf_str (HMGL gr, const char * col)
C function: void mgl_clf_chr (HMGL gr, char col)
C function: void mgl_clf_rgb (HMGL gr, mreal r, mreal g, mreal b)
C function: void mgl_clf_rgba (HMGL gr, mreal r, mreal g, mreal b, mreal a)

Clear the picture and fill background by specified color.

MGL command: rasterize
Method on mglGraph: void Rasterize ()
C function: void mgl_rasterize (HMGL gr)

Force drawing the plot and use it as background. After it, function clear the list of primitives, like clf. This function is useful if you want save part of plot as bitmap one (for example, large surfaces, isosurfaces or vector fields) and keep some parts as vector one (like annotation, curves, axis and so on). Often, you need to manually call subplot command after rasterize to avoid extra space allocation or plot rotation.

MGL command: background 'fname' [alpha=1]
MGL command: background 'fname' 'how' [alpha=1]
Method on mglGraph: void LoadBackground (const char * fname, double alpha=1)
C function: void mgl_load_background (HMGL gr, const char * fname, double alpha)
Method on mglGraph: void LoadBackground (const char * fname, const char * how, double alpha=1)
C function: void mgl_load_background_ext (HMGL gr, const char * fname, const char * how, double alpha)

Load PNG or JPEG file fname as background for the plot. Parameter alpha manually set transparency of the background. Parameter how can be: ‘a’ for filling current subplot only, ‘s’ for scaling (resizing) image to whole area, ‘c’ for centering image, ‘m’ for tessellate image as mosaic.

MGL command: background r g b
Method on mglGraph: void FillBackground (const mglColor &rgb)
C function: void mgl_fill_background (HMGL gr, double r, double g, double b, double a)

Fill background by the specified color. Values should be in range [0,1].