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

4.5.3 Bitmap in memory

These functions return the created picture (bitmap), its width and height. You may display it by yourself in any graphical library (see also, Widget classes) or save in file (see also, Export to file).

Method on mglGraph: const unsigned char * GetRGB ()
Method on mglGraph: void GetRGB (char *buf, int size)
Method on mglGraph: void GetBGRN (char *buf, int size)
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] (or is [4*i + 4*Width*j] for GetBGRN()). You have to provide the proper size of the buffer, buf, i.e. the code for Python should look like

from mathgl import *
gr = mglGraph();
bits='\t';
bits=bits.expandtabs(4*gr.GetWidth()*gr.GetHeight());
gr.GetBGRN(bits, len(bits));
Method on mglGraph: const unsigned char * GetRGBA ()
Method on mglGraph: void GetRGBA (char *buf, int size)
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].

Method on mglGraph: int GetWidth ()
Method on mglGraph: int GetHeight ()
C function: int mgl_get_width (HMGL gr)
C function: int mgl_get_height (HMGL gr)

Gets width and height of the image.

Method on mglGraph: mglPoint CalcXYZ (int xs, int ys)
C function: void mgl_calc_xyz (HMGL gr, int xs, int ys, float *x, float *y, float *z)

Calculate 3D coordinate {x,y,z} for screen point {xs,ys}. At this moment it ignore perspective and transformation formulas (curvilinear coordinates). The calculation are done for the last used InPlot (see Subplots and rotation).

Method on mglGraph: mglPoint CalcScr (mglPoint p)
C function: void mgl_calc_scr (HMGL gr, float x, float y, float z, int *xs, int *ys)

Calculate screen point {xs,ys} for 3D coordinate {x,y,z}. The calculation are done for the last used InPlot (see Subplots and rotation).

Method on mglGraph: void SetObjId (int id)
C function: void mgl_set_obj_id (HMGL gr, int id)

Set the numeric id for object or subplot/inplot.

Method on mglGraph: int GetObjId (long xs, long ys)
C function: int mgl_get_obj_id (HMGL gr, long xs, long ys)

Get the numeric id for most upper object at pixel {xs, ys} of the picture.

Method on mglGraph: int GetSplId (long xs, long ys)
C function: int mgl_get_spl_id (HMGL gr, long xs, long ys)

Get the numeric id for most subplot/inplot at pixel {xs, ys} of the picture.

Method on mglGraph: void Highlight (int id)
C function: void mgl_highlight (HMGL gr, int id)

Highlight the object with given id.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 13, 2012 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.