Graphics

GR_HEIGHT DefineStr #define GR_HEIGHT 480 GR_WIDTH DefineStr #define GR_WIDTH 640 Gr2BSpline Funct 2nd order. Clipping but no transform or thick. Gr2BSpline3 Funct 2nd order. Clipping and transform and thick. Gr2Bezier Funct 2nd order. Clipping but no transform or thick. Gr2Bezier3 Funct 2nd order. Clipping and transform and thick. Gr3BSpline Funct 3rd order. Clipping but no transform or thick. Gr3BSpline3 Funct 3rd order. Clipping and transform and thick. Gr3Bezier Funct 3rd order. Clipping but no transform or thick. Gr3Bezier3 Funct 3rd order. Clipping and transform and thick. GrArrow3 Funct 3D. Transformation with thick. GrBlot Funct 2D. Clipping but not transformation.. GrBlot3 Funct 3D. Clipping and transformation. GrBorder Funct 2D. Transformation with thick. GrCircle Funct 2D. Clipping but not transformation. GrCircle3 Funct 3D. Transformation with thick. GrClamp Funct Returns scrn, not window coordinates. GrEllipse Funct 2D. Clipping but not transformation. GrEllipse3 Funct 3D. Transformation with thick. GrFillCircle Funct 2D. Clipping but not transformation. GrFillPoly3 Funct 3D. Must be convex. GrFillTri0 Funct 3D. Returns cnt of pixs changed GrFloodFill Funct 2D. Ignore z and db. GrFloodFill3 Funct 3D. Transformation. GrHLine Funct 3D. No transformation or thick. GrLine Funct 2D. Clipping but not transformation. GrLine3 Funct 3D. Transformation with thick. GrPeek Funct 2D. Clipping but no transformation. GrPeek0 Funct 2D. No clipping or transformation. GrPlot Funct 2D. Clipping but No transformation or thick. GrPlot0 Funct 2D. No clipping or transformation or thick. GrPlot3 Funct 3D. Clipping and transformation and thick. GrPlot3B Funct 3D. Clipping and transformation but no thick. GrRect Funct 2D. Width Height. Clipping but not transformation. GrRect3 Funct 3D. Width Height. Clipping and transformation. GrRectB Funct 2D. Two point. Clipping but not transformation. GrRegPoly Funct 2D. Clipping but no transform or thick. GrRegPoly3 Funct 3D. Clipping and transform and thick. GrVLine Funct 3D. No transformation or thick. SetAltScrn Funct Sets CDC to use as alternate source writing to framebuffer TextBorder Funct Plot border square. 30fps in Fs->draw_it() callback. TextChar Funct Plot char. 30fps in Fs->draw_it() callback. TextLenAttr Funct Plot attrs with len. 30fps in Fs->draw_it() callback. TextLenAttrStr Funct Plot attr str with len. 30fps in Fs->draw_it() callback. TextLenStr Funct Plot str with len. 30fps in Fs->draw_it() callback. TextPrint Funct Plot chars. 30fps in Fs->draw_it() callback. TextRect Funct Fill text rect. 30fps in Fs->draw_it() callback. gr_alt_scrn GlbVar CDC *gr_alt_scrn=NULL; gr_palette GlbVar CBGR24 gr_palette[PAL_COLORS_NUM]; sys_frame_buffer GlbVar sys_vbe_mode_pitch GlbVar #help_index "Task;Processor" vbe_vid_modes GlbVar FS seg reg points to the current CTask.

Graphics/Char

GrPrint Funct 2D. Clipping but not transformation. GrPrint3 Funct 3D. Transformation. DCF_SYMMETRY is silly. GrPutChar Funct 2D. Clipping but not transformation. GrPutChar3 Funct 3D. Transformation. DCF_SYMMETRY is silly. GrTextBox3 Funct 3D. Transformation. DCF_SYMMETRY is silly. GrTextDiamond3 Funct 3D. Transformation. DCF_SYMMETRY is silly. GrVPrint Funct 2D. Vertical text. Clipping but not transformation. GrVPrint3 Funct 3D. Vertical text. Transformation. DCF_SYMMETRY is silly.

Graphics/Color

CBGR24 Class U32 class CBGR24 CBGR48 Class I64 class CBGR48 CColorROPU16 Class Don't use this, use CColorROPU32 CColorROPU32 Class U32 class CColorROPU32 Color2Str Funct CColorROPU32 with flags to DCLighting str. DCBlotColor4 Funct U8 *dst,I64 *img,I64 *img_cache,I64 cnt); GrFixZoomScale Funct { GrPaletteColorGet Funct { GrPaletteColorSet Funct { GrPaletteGet Funct 16 colors GrPaletteGet32 Funct 16 colors GrPaletteSet Funct 16 colors GrPaletteSet32 Funct 16 colors GrRopEquU8NoClippingFunct U8 *dst,I64 width_internal); GrScaleZoom Funct Multiply zoom factor larger or smaller. GrZoomInScrn Funct { IsPixCovered0 Funct No clipping PaletteSetGray Funct Activate gray palette. PaletteSetStd Funct Activate std palette. SetBrightness Funct Sets default 16 colors scaled by p/100 Str2ColorU16 Funct DCLighting color str with flags to CColorROPU16. Str2ColorU32 Funct DCLighting color str with flags to CColorROPU32. gr32_palette_std GlbVar CBGR24 gr32_palette_std[COLORS_NUM]= gr_palette_gray GlbVar CBGR24 gr_palette_gray[COLORS_NUM] = gr_palette_gray GlbVar CBGR48 gr_palette_gray[COLORS_NUM]= gr_palette_std GlbVar CBGR48 gr_palette_std[COLORS_NUM]= gr_rainbow_10 GlbVar U8 gr_rainbow_10[10]=

Graphics/Data Types/D3I32

CD3I32 Class Three dimensional I32 pt CQueD3I32 Class Que of three dimensional I32 pts D3I32Dist Funct Distance D3I32DistSqr Funct Distance Squared D3I32Norm Funct Norm D3I32NormSqr Funct Norm Squared

Graphics/Device Contexts

CDC Class class CDC DCAlias Funct Create alias of dc, so can change pen, color, etc. DCClear Funct Set entire device context image body to 0 (BLACK). DCColorChg Funct Find and replace src color with dst in device context. DCCopy Funct Alloc copy of dc, including image body, rot mat and depth buf. DCDel Funct Free dc, image body, rot mat and depth buf. DCDepthBufAlloc Funct Alloc a 32-bit depth buffer for device context. DCDepthBufRst Funct Reset device context depth buf to far away. DCDiff Funct Trim to win of what has chged. DCExt Funct Extract new device context rect from device context. DCExtentsInit Funct Init markers for extent of next newly drawn graphics. DCFill Funct Fill entire device context with color. DCLoad Funct Loads device context from mem. DCMono Funct Set entire device context to one of two colors. DCNew Funct Create new width x height device context. DCRst Funct Reset CDC structure members but not image body, itself. DCSave Funct Stores device context to mem, perhaps, with compression. DCScrnCapture Funct Capture scrn to a device context. DCSize Funct Mem size of header, image body and depth buffer. GR2MV Funct { GRRead Funct TempleOS GR File. GRWrite Funct TempleOS GR File. GrBlot Funct 2D. Clipping but not transformation.. GrBlot3 Funct 3D. Clipping and transformation.

Graphics/GR Files

GR graphics files are 8-bits-per-pixels but only 4-bits of color, with transparency and no palette. Compression is the standard TempleOS LZW compression. #define DCF_COMPRESSED 1 //This is the only saved flag. #define DCF_PALETTE 2 #define TRANSPARENT 0xFF #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define PURPLE 5 #define BROWN 6 #define LTGRAY 7 #define DKGRAY 8 #define LTBLUE 9 #define LTGREEN 10 #define LTCYAN 11 #define LTRED 12 #define LTPURPLE 13 #define YELLOW 14 #define WHITE 15 class CBGR48 { U16 r,g,b,pad; }; CBGR48 gr_palette_std[16]={ 0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA, 0xAAAA00000000,0xAAAA0000AAAA,0xAAAA55550000,0xAAAAAAAAAAAA, 0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF, 0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF}; class GRFile { I32 width; I32 width_internal; //Rounded-up to multiple of 8. I32 height; I32 flags; //DCF_COMPRESSED? See ::/Kernel/Compress.HC. CBGR48 palette[16]; //Included if DCF_PALETTE. U8 body[]; }; See DCSave(), GRWrite(), DCLoad(), and GRRead(). DocGR Funct Put a GR file into a document as asprite. DocType Funct Output txt or graphic file to document. GR2MV Funct { GRRead Funct TempleOS GR File. GRScrnCaptureRead Funct GrBlot TempleOS GR File to dc,x,y. GRScrnCaptureWrite Funct Capture scrn to a TempleOS GR File. GRWrite Funct TempleOS GR File. Type Funct Output txt or graphic file to command line.

Graphics/Input

PopUpColor Funct Chooser for 16-color, default or transparent. PopUpColorDither Funct Chooser for 2 x 16 colors or transparent. PopUpColorLighting Funct Chooser for std TempleOS DCLighting() color. PopUpTransform Funct Prompt for Mat4x4 transform.

Graphics/Math

BSpline2 Funct Go in 2nd order spline calling callback. BSpline3 Funct Go in 3rd order spline calling callback. Bezier2 Funct Go in 2nd order bezier calling callback. Bezier3 Funct Go in 3rd order bezier calling callback. Circle Funct Step through circle arc calling callback. ClipLine Funct Clip x1,y1 x2,y2 with left,top,right,bottom. Ellipse Funct Step through ellipse arc calling callback. Line Funct Step through line segment calling callback. RegPoly Funct Step through regular polygon calling callback. gr_x_offsets GlbVar I64 gr_x_offsets[8]= {-1, 0, 1,-1,1,-1,0,1}, gr_x_offsets2 GlbVar gr_x_offsets2[4]= { 0,-1, 1, 0}, gr_y_offsets GlbVar gr_y_offsets[8]= {-1,-1,-1, 0,0, 1,1,1}, gr_y_offsets2 GlbVar gr_y_offsets2[4]= {-1, 0, 0, 1};

Graphics/Math/3D Transformation

CDC's have a 4x4 matrix for rotating, scaling, skewing and shifting in 3 dimensions. To make the graphics routines use the transform, you must set the DCF_TRANSFORMATION flag. The matrix consists of ints that have been scaled 32 bits (GR_SCALE). See ::/Demo/Lectures/FixedPoint.HC to learn why. See Mat4x4IdentEqu(), Mat4x4IdentNew(), Mat4x4Equ() and Mat4x4New(). See Mat4x4RotX(), Mat4x4RotY(), Mat4x4RotZ() and Mat4x4Scale() to rotate about axes and scale. Combine them with Mat4x4MulMat4x4Equ()/Mat4x4MulMat4x4New() and assign them to the CDC.dc with DCMat4x4Set(). See ::/Demo/Graphics/Box.HC. You can rotate single points using Mat4x4MulXYZ(). The 4th dimension allows a neat trick where you can place pos shifts (translations), into the matrix and Mat4x4MulMat4x4Equ/Mat4x4MulMat4x4New them to combine rotation/shift operations. Normally, you can't combine pos shift operations. See Mat4x4TranslationEqu() and ::/Demo/Graphics/Transform.HC. Finally, CDC's have an x, y and z which is an additional shift (translation). The transformation is implemented as a callback on the CDC's transform() member. The default transform() callback is DCTransform(). See ::/Demo/Games/Talons.HC or ::/Demo/Games/CastleFrankenstein.HC to see how to change the transform() callback for foreshortening. DCMat4x4Set Funct Set device context rot matrix. Will be Free in DCDel.Uses fixed-point. DCReflect Funct Reflect 3D point about device context's symmetry. Uses fixed-point. DCReflectOld Funct Reflect 3D point about device context's symmetry. Uses fixed-point. DCSymmetry3Set Funct 3D. Set device context's symmetry. DCSymmetrySet Funct 2D. Set device context's symmetry. DCThickScale Funct Scale device context's thick by norm of transformation. DCTransform Funct This is the dft dc->transform() callback. DCTransformOld Funct This is the dft dc->transform() callback. Mat4x4Equ Funct Copy 4x4 Rot matrix. Mat4x4IdentEqu Funct Set matrix to identity. Uses fixed-point. Mat4x4IdentNew Funct MAlloc an identity matrix. Uses fixed-point. Mat4x4MulMat4x4Equ Funct Multiply 4x4 matrices and store in dst. Uses fixed-point. Mat4x4MulMat4x4New Funct Multiply 4x4 matrices. Return MAlloced matrix. Uses fixed-point. Mat4x4MulXYZ Funct Rotate 3D point using 4x4 matrix. Uses fixed-point. Mat4x4New Funct Return MAlloced copy of 4x4 Rot matrix. Mat4x4NormSqr65536 Funct Norm Squared of r. Mat4x4Print Funct Print a 4x4 matrix Mat4x4RotX Funct Rot matrix about X axis. Uses fixed-point. Mat4x4RotXOld Funct Rot matrix about X axis. Uses fixed-point. Mat4x4RotY Funct Rot matrix about Y axis. Uses fixed-point. Mat4x4RotZ Funct Rot matrix about Z axis. Uses fixed-point. Mat4x4RotZOld Funct Rot matrix about Z axis. Uses fixed-point. Mat4x4Scale Funct Scale 4x4 matrix by value. Mat4x4TranslationAddFunct Add translation to 4x4 matrix. Uses fixed-point. Mat4x4TranslationEquFunct Set translation values in 4x4 matrix. Uses fixed-point. PopUpTransform Funct Prompt for Mat4x4 transform. SpriteTransform Funct Rotate Sprite using 4x4 matrix. Uses fixed-point.

Graphics/Mesh

DCLighting Funct This is the dft dc->lighting() callback. Gr3Mesh Funct Returns cnt of pixs changed.

Graphics/Misc

DrawGrabMs Funct This is a callback. See ::/Demo/Graphics/Grid.HC. DrawStdMs Funct This is a callback. See ::/Demo/Graphics/Grid.HC. DrawWaitMs Funct This is a callback. See ::/Demo/Graphics/Grid.HC.

Graphics/Scrn

BMPScrnCapture Funct Capture scrn as BMP file. DCScrnCapture Funct Capture scrn to a device context. GRScrnCaptureRead Funct GrBlot TempleOS GR File to dc,x,y. GRScrnCaptureWrite Funct Capture scrn to a TempleOS GR File. ToggleBlink Funct Toggles blinking ToggleScroll Funct Toggles scrolling WinZBufUpdate Funct Might have to call if doing graphics outside winmgr callback routines.

Graphics/Sprite

A CSprite is an ordered list of these elements, created with <CTRL-r>. Normally, they are packed together in a list and the address of the first is passed to routines. See ::/Demo/Graphics/SpritePlot.HC, ::/Demo/Graphics/SpritePlot3D.HC, ::/Demo/Graphics/SpritePut.HC, ::/Demo/Graphics/SpriteRaw.HC and SpriteMeshEd(). Be aware that copying SP, IB, or IS entries with the clip results in duplicate entries with different nums. You can manually remove dups by editing with <CTRL -t> and setting to the original num. See ::/Adam/Gr/GrSpritePlot.HC for how CSprite are stored. CSprite Class class CSprite Code2Sprite Funct Text to sprite. DC2Sprite Funct Convert device context to sprite. DocBMP Funct Put a BMP file into a document as a sprite. DocGR Funct Put a GR file into a document as asprite. DocSprite Funct Put a sprite into a document. You can, optionally, supply a fmt string GodDoodleSprite Funct Draw a random sprite. Sprite Funct Put sprite to the command-line, DocPut. Sprite2Code Funct Sprite to text. Sprite2DC Funct Convert sprite to device context. Sprite3 Funct Plot a sprite into a CDC. Sprite3B Funct Plot a sprite into a CDC, post transform xyz translation. Sprite3Mat4x4B Funct Plot rotated by matrix. Sprite3XB Funct Plot rotated around X axis. Sprite3YB Funct Plot rotated around Y axis. Sprite3ZB Funct Plot rotated around Z axis. SpriteElem2Summary Funct Study ::/Demo/Graphics/SpriteText.HC. SpriteExtents Funct Ignores flood fills. SpriteInterpolate Funct The two CSprite should be ident except for points shifted around. SpriteSize Funct Walk sprite elements and return size of sprite as binary data. SpriteTransform Funct Rotate Sprite using 4x4 matrix. Uses fixed-point. UpdateSpriteDC Funct Update sprite from device context.

Graphics/Windows BMP Files

BMP24To Funct To Windows 24-bit BMP. BMP4To Funct To Windows 4-bit BMP. BMPRLE4To Funct To Windows RLE4 bit BMP. BMPRead Funct Window's BMP Files. BMPScrnCapture Funct Capture scrn as BMP file. BMPWrite Funct Window's BMP Files. DocBMP Funct Put a BMP file into a document as a sprite. DocType Funct Output txt or graphic file to document. Type Funct Output txt or graphic file to command line.