home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
vrac
/
multikit.zip
/
XMODE.DOC
< prev
next >
Wrap
Text File
|
1996-03-01
|
12KB
|
288 lines
Documentation ─────────────────────────────────────────────────────────────┐
│ XMODE Graphics Library │
└───────────────────────────────────────────────────────────── MULTIKIT v1.0
MULTIKITs' graphics library XMODE.TPU gives you the opportunity to do pro-
fessional displaying actions on your computers' screen. All you have ever
dreamt of comes true with XMODE.TPU: scrolling, palette operations, sprite
action and more. Easy to handle but very fast though (100% ASM).
Global types, constants and variables:
──────────────────────────────────────
The following types, constants and variables are exported. It's not recom-
mended to change them unless you really do know what your're doing.
Type
PalType = ^TPalBuf; palette type
TPalBuf = Array[0..0] Of Byte; - pointer to an array of bytes
FntType = Record font type
CharFirst, - first char of font
CharWidth, - width of a single char
CharHeight: Byte; - height of a single char
FontSize: Word; - size in bytes (for loading proc)
FontAddr: Pointer; - memory address
End;
SprType = Record sprite type
BWidth, - width of sprite in bytes
Height: Byte; - height of sprite in pixels
Address: Pointer; - memory address
End;
Var
ActualPage, current page for any graphic actions
VisualPage, page which is now visible
LastPage, number of last available page
RetrFlag: Byte; reserved for the vsync handler
RetrFreq, vertical retrace frequency (70 Hz)
ActualOffs, VRAM offset of the current page
ScrnLogicalPixelWidth, logical screen width in pixels
ScrnLogicalByteWidth, logical screen width in bytes
ScrnLogicalHeight, logical screen height in pixels
PhysicalStartPixelX, start of physical screen within
PhysicalStartByteX, the logical screen (s.a.)
PhysicalStartY,
MaxScrollX, max value for vertical scrolling
MaxScrollY, max value for horizontal scrolling
RightClip, clipping rectangle: right border
LeftClip, left border
TopClip, top border
BottomClip: Word; bottom border
ROM8x8_Fnt, ROM font 8x8
ROM8x14_Fnt: FntType; ROM font 8x14
Public procedures and functions
───────────────────────────────
General
-------
Function XInitGraphics(LogicalX, LogicalY: Word): Byte;
Initialises the graphic system and sets logical screen size to
LogicalX x LogicalY. The number of available video pages is re-
turned or zero if an error occured.
Due to the limitation of VRAM the size of the virtual screen is
restricted to 320x800 or 1280x200 or 640x400. You see: LogicalX
multiplied by LogicalY must be equal or below 256000. The mini-
mum size is 320x200. LogicalX, the logical screen width, is
rounded to the nearest multiple of 8. The function calculates
the number of available video pages and sets up all global va-
riables to it's default values. Because the hardware timer must
be accessed directly in order to calculate the vertical retrace
frequency you first should init the graphics system and then
the clock.
Procedure XDoneGraphics;
This procedure switches your program back to textmode 80x25x16.
Procedure XWaitRetrace;
Wait until the electronic beam is in the refresh period.
You can use this procedure to synchronize onscreen graphic ac-
tions with the vertical retrace so that your screen will not
flicker. The function XSETVISUALPAGE and all palette operations
are already syncronized to the vertical retrace.
Procedure XSetClipRect(X1, Y1, X2, Y2: Word);
Set the clipping borders.
You should not access the variables directly but use this pro-
cedure instead to set the borders for clipping.
Procedure XSetActualPage(Page: Byte);
Set the default page for drawing actions.
If you've more than one video page you can perform drawing ac-
tions in the invisible background by using this function. Valid
values for PAGE are from 0 to LASTPAGE.
Procedure XSetVisualPage(X, Y: Word; Page: Byte);
Set the visible page and/or scroll over a page.
X and Y are coordinates containing the start of the physical
screen within the logical screen. Valid values are from zero to
MAXSCROLLX or MAXSCROLLY. PAGE is the number of the video page
you want to make visible.
Procedure XClearPage;
Fills the actual video page with color zero.
Procedure XCopyPage(PSrc, PDst: Byte);
Copies the contents of page PSRC to page PDST.
This should be used instead of XCOPYRECT because it's much fa-
ster when you copy the whole page.
Procedure XShiftRect(X1, Y1, X2, Y2, X, Y: Word);
Copies the contents of the rectangle X1, Y1, X2, Y2 to another
position X, Y on the actual video page.
Procedure XCopyRect(X1,Y1,X2,Y2,X,Y: Word; Src,Dst: Byte; SWi,DWi: Word);
Copies the contents of the rectangle X1, Y1, X2, Y2 in page SRC
to the position X, Y in page DST. SWI and DWI are the widths of
the rectangles within the logical screen.
Drawing
-------
All drawing functions are operating on the actual video page.
Procedure XPutPixel(X, Y: Word; Color: Byte);
Set a pixel with color COLOR at position X, Y.
Function XGetPixel(X, Y: Word): Byte;
Returns the color of the pixel at position X, Y.
Procedure XLine(X1, Y1, X2, Y2: Word; Color: Byte);
Draw a line from X1, Y1 to X2, Y2 with color COLOR.
Procedure XRect(X1, Y1, X2, Y2: Word; Color: Byte);
Draw a filled rectangle with upper left corner X1, Y1 and lower
right corner X2, Y2 with color COLOR.
Procedure XCircleEmpty(X, Y, Dia: Word; Color: Byte);
Put an empty circle with upper left corner X, Y onscreen, which
diameter is DIA pixels and color is COLOR.
Procedure XCircleFilled(X, Y, Dia: Word; Color: Byte);
Draw a filled circle.
Procedure XTriangle(X1,Y1,X2,Y2,X3,Y3: Integer; Color: Byte);
Draw a filled triangle.
This is the only drawing function which allows clipping! It is
useful for creating vector objects. You are allowed to use sig-
ned values for X1,Y1,X2,Y2,X3,Y3 which are the edges of the fi-
gure.
Procedure XFloodFill(X, Y: Word; Color: Byte);
Fills an area of pixels which have the same color like the dot
at position X, Y with color COLOR starting at X, Y.
Palette
-------
No palette function will change the contents of the palette data array.
Procedure XSetRGB(Color, R, G, B: Byte);
Set the DAC values of a single color.
Procedure XSetPal(Min, Max: Byte; Var Palette: PalType);
Set the DAC values given in PALETTE from color MIN to color MAX
Procedure XGetPal(Min, Max: Byte; Var Palette: PalType);
Read the palette data. PALETTE must be allocated.
Procedure XFadeIn(Min, Max: Byte; Var Palette: PalType);
Fades the palette from black to the given values.
Procedure XFadeOut(Min, Max: Byte; Var Palette: PalType);
Fades the palette from the given values to black.
Procedure XBrightIn(Min, Max: Byte; Var Palette: PalType);
Fade the palette from bright white to the given values.
Procedure XBrightOut(Min, Max: Byte; Var Palette: PalType);
Fade the palette from the given values to bright white.
Procedure XRotatePal(Min, Max, Disp:Byte; Var Palette:PalType);
Rotates the palette by factor DISP.
Procedure XMorphPal(Min, Max: Byte; Var SrcPal,DstPal:PalType);
Morphs SRCPAL palette data into DSTPAL.
Font
----
Procedure XSetFont(Var Font: FntType);
Set the default font to FONT.
Procedure XWriteChr(X, Y: Word; Chr: Char; Color: Byte);
Put a single char CHR at position X, Y in color COLOR onscreen,
using the current font.
Procedure XWriteStr(X, Y: Word; Str: String; Color: Byte);
Write an entire string STR at position X, Y in color COLOR.
Sprite
------
Because of speed optimization lots of sprite functions are offered to you.
Speed decreases as follows: XPUTSPRITE (fastest) -XPUTMASKED-XPUTSPRCLIPY-
XPUTMSKCLIPY-XPUTSPRCLIPX-XPUTMSKCLIPX-XPUTSPRCLIPXY - XPUTMSKCLIPXY (slo-
west). You're allowed to use signed values. All sprite functions are per-
formed on the actual video page.
Function XSpriteSize(X1, Y1, X2, Y2: Word): Word;
Returns the required memory for saving a sprite with the ex-
tends X1,Y1,X2,Y2.
Procedure XPutSprite(X, Y: Word; Var Sprite: SprType);
Puts a sprite SPRITE at position X,Y onscreen.
Procedure XPutMasked(X, Y: Word; Var Sprite: SprType);
Puts a masked sprite onscreen. Pixel with color 0 won't appear.
Procedure XPutSprClipX(X, Y: Integer; Var Sprite: SprType);
Clip a sprite at right or left and put it onscreen.
Procedure XPutSprClipY(X, Y: Integer; Var Sprite: SprType);
Clip a sprite at top or bottom and put it onscreen.
Procedure XPutSprClipXY(X,Y: Integer; Var Sprite: SprType);
Clip a sprite at right or left and top or bottom and put it on-
screen.
Procedure XPutMskClipX(X, Y: Integer; Var Sprite: SprType);
Clip masked sprite at right or left.
Procedure XPutMskClipY(X, Y: Integer; Var Sprite: SprType);
Clip masked sprite at top or bottom.
Procedure XPutMskClipXY(X,Y: Integer; Var Sprite: SprType);
Clip masked sprite at right or left and top or bottom.
Procedure XGetSprite(X1, Y1, X2, Y2: Word; Var Sprite: SprType);
Read a sprite from VRAM to memory. SPRITE must be allocated.
Data i/o
--------
These loading functions are designed for loading data files created by the
MULTIKIT tool programs.
Function XLoadPal(FName: String; FSeek: LongInt; Var Pal: PalType): Byte;
Loads a 768 byte palette data file saved by XMDETOOL.
Function XLoadFnt(FName: String; FSeek: LongInt; Var Fnt: FntType): Byte;
Loads a font edited with FONTEDIT.
Function XLoadSpr(FName: String; FSeek: LongInt; Var Spr: SprType): Byte;
Loads a sprite saved within XMDETOOL. A 8129 byte temporary buf-
fer is needed to extract the packed data - assure that it will
be available beneath the needed memory for the sprite data.
Procedure XFreePal(Var Pal: PalType);
Release palette data from memory.
Procedure XFreeFnt(Var Fnt: FntType);
Release font data from memory.
Procedure XFreeSpr(Var Spr: SprType);
Release sprite data from memory.
This unit is part of MULTIKIT.
(C) Copyright by TSC-Software, 1995.