manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.6 Export to file (Pure C)

These functions export current view to a graphic file. The filename fname should have appropriate extension. Parameter descr gives the short description of the picture. Just now the transparency in EPS files are not supported.

C function: void mgl_write_png (HMGL gr, const char *fname, const char *descr)
C function: void mgl_write_png_solid (HMGL gr, const char *fname, const char *descr)

Exports current frame to PNG file with transparent background. Parameter fname specifies the file name, descr adds description to file (can be NULL).

C function: void mgl_write_jpg (HMGL gr, const char *fname, const char *descr)

Exports current frame to JPEG file with non-transparent background (usually white). Parameter fname specifies the file name, descr adds description to file (can be NULL).

C function: void mgl_write_bmp (HMGL gr, const char *fname, const char *descr)

Exports current frame to BMP file. Parameter fname specifies the file name, descr adds description to file (can be NULL). There is no compression used.

C function: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)

Exports current frame to EPS file. The vector representation is used if possible. So it is not recommended for the export of large data plot. It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (can be NULL).

C function: void mgl_write_svg (HMGL gr, const char *fname, const char *descr)

Exports current frame to SVG (Scalable Vector Graphics) file. The vector representation is used. In difference of EPS format, SVG format support transparency that allows to correctly draw half-transparent plot (like SurfA(), Surf3A(), Cloud()). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name).

C function: void mgl_write_idtf (HMGL gr, const char *fname, const char *descr)

Exports current frame to IDTF file. Later this file can be converted to U3D format. The vector representation is used. So, the output file may be too large for graphic of large data array (especially for surfaces). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name).

C function: void mgl_show_image (const char *viewer, int nowait)

Displays the current picture using external program viewer for viewing. The function save the picture to temporary file and call viewer to display it. If nowait=true then the function return immediately (it will not wait while window will be closed).

C function: void mgl_set_size (HMGL gr, int width, int height)

Sets size of picture in pixels. This function must be called before any other plotting because it completely remove picture contents.

C function: void mgl_flush (HMGL gr)

Flushes the plotting commands to frame. This function may be useful if one wants to remove array before the finishing of the plot (i.e. before calling Finish()). Also call of this function separate the objects in mglGraphIDTF. Most of plots call this function internally.

C function: int mgl_get_width (HMGL gr)
C function: int mgl_get_height (HMGL gr)

Gets width or height of the image.

C function: const unsigned char * mgl_get_rgb (HMGL gr)

Gets RGB bitmap of the current state of the image. Format of each element of bits is: {red, green, blue}. Number of elements is Width*Height. Position of element {i,j} is [3*i + 3*Width*j].

C function: const unsigned char * mgl_get_rgba (HMGL gr)

Gets RGBA bitmap of the current state of the image. Format of each element of bits is: {red, green, blue, alpha}. Number of elements is Width*Height. Position of element {i,j} is [4*i + 4*Width*j].


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2026
Individual documents may contain additional copyright information.