11.9 Sample ‘background

Load background from an image file.

MGL code:

define $f udav_new.png
#background '$f' 's'
subplot 2 2 0 '':box
background '$f' 'a'
text 0.5 0.1 'Default' 'a'
subplot 2 2 1 '':box
background '$f' 'ca'
text 0.5 0.1 'Centering' 'a'
subplot 2 2 2 '':box
background '$f' 'ma'
text 0.5 0.1 'Mosaic' 'a'
subplot 2 2 3 '':box
background '$f' 'sa'
text 0.5 0.1 'Scaling' 'a'

C++ code:

void smgl_background(mglGraph *gr)
{
	const char *fname = "udav_new.png";
	gr->SubPlot(2,2,0,"");	gr->Box();	gr->LoadBackground(fname,"a");	gr->Puts(0.5,0.1,"Default","a");
	gr->SubPlot(2,2,1,"");	gr->Box();	gr->LoadBackground(fname,"ca");	gr->Puts(0.5,0.1,"Centering","a");
	gr->SubPlot(2,2,2,"");	gr->Box();	gr->LoadBackground(fname,"ma");	gr->Puts(0.5,0.1,"Mosaic","a");
	gr->SubPlot(2,2,3,"");	gr->Box();	gr->LoadBackground(fname,"sa");	gr->Puts(0.5,0.1,"Scaling","a");
	//gr->LoadBackground(fname,"s");
}
Sample background