LIBTIMG.py - ThomasTheSpaceFox/T-IMG GitHub Wiki

LIBTIMG.py

The T-IMG python library

Note: items in "code" strings within "< >" brackets in this wiki page are describing a single item of data.

functions:

  • TIMGfiledraw:
    Draw the specified TIMG image file.
    LIBTIMG.TIMGfiledraw(<filetodraw>)

  • gettitle:
    return the title of the specified TIMG image file. v
    LIBTIMG.gettitle(file-to-get-title-from)

  • getcharmode:
    return the character mode of the specified TIMG image file.
    LIBTIMG.getcharmode(<file-to-get-charmode-from>)

  • inline:
    interpret TIMG graphics, in-line, straight from your python program!
    no .TIMG files needed. it does honor real newlines as well as newlines specified by a "-"
    note that this function returns the interpeted form of the data. it does NOT print it.
    LIBTIMG.inline("AACI-53SA")

  • charcodedump:
    returns the raw TIMG character codes from the specified TIMG image.
    LIBTIMG.charcodedump(<file-to-get-charcodes-from>)

  • TIMGprep:
    returns a properly formatted TIMG image file structure. ready to be saved into a .TIMG file.
    LIBTIMG.TIMGprep(<timg charcacter code data>, <character mode>, <picture title>)

  • TIMGmode2expand:
    returns mode 1 equivalents of directly provided mode 2 TIMG data, (needed to avoid squash distortion for displaying mode 2 data with inline function)
    LIBTIMG.TIMGmode2expand(<timg charcacter code data>)

  • coderep
    Replace a specified character code with another.
    LIBTIMG.coderep(<timg charcacter code data>, <code to replace>, <code to replace other code with>)

note: that in coordinate based functions Y always refers to lines and X always refers to columns, also note that the "grid" starts as X:1,Y:1 in the upper left corner for example:

ABC
XYZ
123
in this data set 1,1 would be "A".

  • getpoint
    get a specified point in a set of timg data LIBTIMG.getpoint(<timg charcacter code data>, <line y>, <col x>)

  • hlinedraw
    draw a horizontal line
    LIBTIMG.hlinedraw(<timg charcacter code data>, <timg character code to use>, Y1, X1, X2) `

  • vlinedraw
    draw a vertical line
    LIBTIMG.vlinedraw(<timg charcacter code data>, <timg character code to use>, Y1, Y2, X1)

  • linedraw
    draw a line between two specified points, will call hlinedraw or vlinedraw if appropriate
    LIBTIMG.linedraw(<timg charcacter code data>, <timg character code to use>, Y1, X1, Y2, X2)

  • reppoint
    Replace a specified point in a set of timg data
    LIBTIMG.reppoint(<timg charcacter code data>, <timg character code to use>, liney, colx)

  • overlay
    overlay one set of timg data over another with the local coordinate 1,1 of the data being overlaid, matching up with the specified coordinate of the base timg data. this specified coordinate can be below "1,1" to have the image cut off at the left or top of the base image, you can also specify a coordinate close to the bottom of the right of the base image. overlay will not place a point that is not in the base image, (much like reppoint).
    LIBTIMG.overlay(<base-timg-data>, <data-to-overlay>, <line-Y>, <col-X>)

  • imggen
    generate a plain timg image data set at the specified size, line(Y) and columns (X), using the specified timg color code.
    LIBTIMG.imggen(<col-code>, <size-Y>, <size-X>)

⚠️ **GitHub.com Fallback** ⚠️