5.5.2 Frames/Animation

These functions provide ability to create several pictures simultaneously. For most of cases it is useless but for widget classes (see Widget classes) they can provide a way to show animation. Also you can write several frames into animated GIF file.

Method on mglGraph: void NewFrame ()
C function: void mgl_new_frame (HMGL gr)

Creates new frame. Function returns current frame id. This is not thread safe function in OpenGL mode! Use direct list creation in multi-threading drawing. The function EndFrame() must be call after the finishing of the frame drawing for each call of this function.

Method on mglGraph: void EndFrame ()
C function: void mgl_end_frame (HMGL gr)

Finishes the frame drawing.

Method on mglGraph: int GetNumFrame ()
C function: int mgl_get_num_frame (HMGL gr)

Gets the number of created frames.

Method on mglGraph: void SetFrame (int i)
C function: void mgl_set_frame (HMGL gr, int i)

Finishes the frame drawing and sets drawing data to frame i, which should be in range [0, GetNumFrame()-1]. This function is similar to EndFrame() but don’t add frame to the GIF image.

Method on mglGraph: void GetFrame (int i)
C function: void mgl_get_frame (HMGL gr, int i)

Replaces drawing data by one from frame i. Function work if MGL_VECT_FRAME is set on (by default).

Method on mglGraph: void ShowFrame (int i)
C function: void mgl_show_frame (HMGL gr, int i)

Appends drawing data from frame i to current one. Function work if MGL_VECT_FRAME is set on (by default).

Method on mglGraph: void DelFrame (int i)
C function: void mgl_del_frame (HMGL gr, int i)

Deletes drawing data for frame i and shift all later frame indexes. Function work if MGL_VECT_FRAME is set on (by default). Do nothing in OpenGL mode.

Method on mglGraph: void ResetFrames ()
C function: void mgl_reset_frames (HMGL gr)

Reset frames counter (start it from zero).

Method on mglGraph: void ClearFrame (int i)
C function: void mgl_clear_frame (HMGL gr, int i)

Clear list of primitives for current drawing.

Method on mglGraph: void StartGIF (const char *fname, int ms=100)
C function: void mgl_start_gif (HMGL gr, const char *fname, int ms)

Start writing frames into animated GIF file fname. Parameter ms set the delay between frames in milliseconds. You should not change the picture size during writing the cinema. Use CloseGIF() to finalize writing. Note, that this function is disabled in OpenGL mode.

Method on mglGraph: void CloseGIF ()
C function: void mgl_close_gif (HMGL gr)

Finish writing animated GIF and close connected pointers.