MGL 2.0

Help file

List of functions

  • mgl.circle
  • mgl.copyrect
  • mgl.drawtext
  • mgl.ellipse
  • mgl.fillellipse
  • mgl.fillrect
  • mgl.floodfillin
  • mgl.floodfillout
  • mgl.getpixel
  • mgl.line
  • mgl.loadfont
  • mgl.pasterect
  • mgl.putpixel
  • mgl.rectangle
  • mgl.scanhorz
  • mgl.scanvert
  • mgl.setcliprect
  • mgl.styledline
  • mgl.textwidth
  • mgl.uni

    mgl.circle(x,y,radius,type)

    Draws a circle at coordinates (x,y) with specified radius and type
    Uses midpoint circle algoritm

    mgl.copyrect(x1,y1,x2,y2,f)

    Copies a rectangle between points (x1,y1) and (x2,y2)
    It will copy ALL properties of particles if f is nonzero
    returns data, which can be pasted by mgl.pasterect

    mgl.drawtext(x,y,text,type,font,param)

    Draws specified text at coordinates (x,y)
    Uses 2-byte encoding, should be coded with mgl.uni
    Uses specified type and font (loaded with mgl.loadfont)
    param is binary coded this way:
  • alignment: 0=left, 1=center, 2=right
  • if italic, add 4
  • if bold, add 8
  • if underlined, add 16
  • if striked, add 32

    mgl.ellipse(x,y,xradius,yradius,type)

    Draws an ellipse at (x,y) with specified horizontal and vertical radiuses and type
    Uses modified midpoint circle algoritm

    mgl.fillellipse(x,y,xradius,yradius,type)

    Draws a filled ellipse at (x,y) with specified horizontal and vertical radiuses and type

    mgl.fillrect(x1,y1,x2,y2,type)

    Draws a filled rectangle between points (x1,y1) and (x2,y2) using specified type

    mgl.floodfillin(x,y,type)

    Starts filling a shape from coordinates (x,y) until reaches a border colored other way

    mgl.floodfillout(x,y,type,border)

    Starts filling a shape from coordinates (x,y) until reaches a border with specified color
    border color should be specified as numeric

    mgl.getpixel(x,y)

    gets color of pixel at (x,y)
    returns number

    mgl.line(x1,y1,x2,y2,type)

    Draws a line between coordinates (x1,y1) and (x2,y2) using specified type

    mgl.loadfont(filename)

    Loads a font from file with specified filename.
    TODO: write font file format here

    mgl.pasterect(x,y,data)

    Pastes a rectangle copied with mgl.copyrect at coordinates (x,y)
    Data is an array returned by mgl.copyrect

    mgl.putpixel(x,y,type)

    Draws a pixel at coordinates (x,y)
    Replaces if there is something

    mgl.rectangle(x1,y1,x2,y2,type)

    Draws a rectangle between points (x1,y1) and (x2,y2) using specified type

    mgl.scanhorz(data,y,array)

    Edits a horizontal line of rectangle stored in data
    Replaces yth line of it with array

    mgl.scanvert(data,x,array)

    Edits a vertical line of rectangle stored in data
    Replaces xth column of it with array

    mgl.setcliprect(x1,x2,y1,y2)

    Sets clipping rectangle
    Any pixel outside of it wont be drawn

    mgl.styledline(x1,y1,x2,y2,type,style)

    Draws styled line between (x1,y1) and (x2,y2) with specified type
    style is just an array of ones and zeros which is used as pattern
    style.length should contain length of pattern

    mgl.textwidth(text,font,param)

    Returns width of specified text if drawn with specified font and params
    For more info see mgl.drawtext

    mgl.uni(text)

    Returns 2-byte encoded string based on specified text
    Used for mgl.drawtext
    Done in academic SGML style
    Используются технологии uCoz