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).
mglGraph
: const unsigned char *
GetRGB ()
¶mglGraph
: void
GetRGB (char *
buf, int
size)
¶mglGraph
: void
GetBGRN (char *
buf, int
size)
¶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));
mglGraph
: const unsigned char *
GetRGBA ()
¶mglGraph
: void
GetRGBA (char *
buf, int
size)
¶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].
mglGraph
: int
GetWidth ()
¶mglGraph
: int
GetHeight ()
¶int
mgl_get_width (HMGL
gr)
¶int
mgl_get_height (HMGL
gr)
¶Gets width and height of the image.
mglGraph
: mglPoint
CalcXYZ (int
xs, int
ys)
¶void
mgl_calc_xyz (HMGL
gr, int
xs, int
ys, mreal *
x, mreal *
y, mreal *
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).
mglGraph
: mglPoint
CalcScr (mglPoint
p)
¶void
mgl_calc_scr (HMGL
gr, mreal
x, mreal
y, mreal
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).
mglGraph
: void
SetObjId (int
id)
¶void
mgl_set_obj_id (HMGL
gr, int
id)
¶Set the numeric id for object or subplot/inplot.
mglGraph
: int
GetObjId (int
xs, int
ys)
¶int
mgl_get_obj_id (HMGL
gr, int
xs, int
ys)
¶Get the numeric id for most upper object at pixel {xs, ys} of the picture. Note, that all plots in the same line of MGL script have the same id.
mglGraph
: int
GetSplId (int
xs, int
ys)
¶int
mgl_get_spl_id (HMGL
gr, int
xs, int
ys)
¶Get the numeric id for most subplot/inplot at pixel {xs, ys} of the picture.
mglGraph
: void
Highlight (int
id)
¶void
mgl_highlight (HMGL
gr, int
id)
¶Highlight the object with given id.
mglGraph
: long
IsActive (int
xs, int
ys, int
d=1
)
¶long
mgl_is_active (HMGL
gr, int
xs, int
ys, int
d)
¶Checks if point {xs, ys} is close to one of active point (i.e. mglBase::Act) with accuracy d and return its index or -1
if not found. Active points are special points which characterize primitives (like edges and so on). This function for advanced users only.
mglGraph
: long
SetDrawReg (int
nx=1
, int
ny=1
, int
m=0
)
¶long
mgl_set_draw_reg (HMGL
gr, int
nx, int
ny, int
m)
¶Limits drawing region by rectangular area of m-th cell of matrix with sizes nx*ny (like in subplot). This function can be used to update only small region of the image for purposes of higher speed. This function for advanced users only.