home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
program
/
graphx11
/
graphx11.doc
< prev
next >
Wrap
Text File
|
1993-10-23
|
80KB
|
1,747 lines
066030303030000132006006006006000
1Graphics Library v1.0Turbo C v2.0 Compatible0
2Copyright (c) 1992Page #0
F0110030001
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....]0110
Ç
GraphicsLibraryv1.1
=====================
for
LatticeCv5.06,SozobonCv2.0and
Heat&ServeSozobonCv1.33i
ü**FREEWARE**
Ç
Copyright(c)1992
by
KennethW.Hartlen
Box37,Site6,RR#3,Armdale,NovaScotia
B3L4J3Canada
Internetaddress:hartlenk@newton.ccs.tuns.ca
August6,1992
TurboCv2.0isaregisteredtrademarkofBorlandInternational,
Inc.Copyright(c)1988.
LatticeCv5.06isatrademarkorregisteredtrademarkofHiSoft
andLattice,Inc.Copyright(c)1990-91.
SozobonCversionmadepossiblewiththeuseof:
IanLepore's .......GEMFASTVDI&AESLibrary
DavidW.Brooks'...FloatingPointLibraryforSozobonC
Ç__________________________________________________________________
üPurpose
Ç__________________________________________________________________
DoyouhaveanyTurboCcodethatyou'dliketorunonyour
ST/STe/TT,butitusesthegraphicslibrary?Wouldyouliketobe
abletodisplaygraphicswithoutexploringGEM'sVDIfunctions?If
yousaid"Yes!!!"toeitherofthesequestions,thenmygraphics
libraryisforyou.
ThisisagraphicslibraryforLatticeCv5.06,SozobonC
v2.0andIanLepore'sHeat&ServeSozobonCcompilersthat
providesgraphicfunctionswithouthavingtodelveintotheVDI
functionsofGEM.Ratherthancomeupwithmyowngraphicfunction
names,IusedthesamenamesasinTurboCv2.0andprovidedthe
samefunctionality.ThiswaytheCcodeyouwriteonyour
ST/STe/TTcanbeeasilyportedtothePCandcompiledwithTurboC
withlittleornomodification.Andofcourse,portingTurboC
codetoyourST/STe/TTwillbemucheasier.
Althoughthelibraryisnot100%compatiblewithTurboC's
library,itstillprovidesavaluablestartingpointinthetask
ofportinggraphicintensiveTurboCcodebetweentheST/STe/TT
andPC.Ofthe93graphicsfunctionsinTurboCv2.0,notallhave
beenimplemented.Functionsnotimplementedarestilldocumented
andhaveanbriefexplanationofwhyitisnotprovided.
Ifthelibrarydoesn'tprovideallthefunctionalitydesired
itisbecauseIdidn'tthinkitwasawidelyusedfunctionorit
wasnotapplicabletotheSTorIdidn'thavethetechnical
informationtoimplementit.Feelfreetosendanycommentsor
suggestionsyouhaveforimprovingthelibrary.Mymailingaddress
ande-mailaddressareonthetitlepage.I'mnotsurehowlong
I'llhavetheInternetaddress,butitwon'thurttotryInternet.
__________________________________________________________________
üFREEWARENotice
Ç__________________________________________________________________
Ihadoriginallystartedbuildingthegraphicslibraryformy
ownusesinceIhadalotofTurboCcodearoundthatwouldbe
usefulonmyMEGAST2.SoIcreatedthislibrarytohelpportthe
sourcecodetomyMEGAST2.Ifoundthegraphicslibrarysouseful
thatIthoughtotherswouldbeinterestedanddecidedtorefine
thelibraryandincludesomedetaileddocumentation.
GraphicsLibraryv1.1isprovideasëFREEWAREÇ!!Youshouldnot
havepaidmoney,withtheexceptionofmediacost,forthis
graphicslibrary.
GraphicsLibraryv1.1canbedistributedandusedëfreeof
chargeÇandmayüNOTÇbesold,orusedin,ordistributedwith,a
Çcommercialproductwithoutpriorwrittenconsentfromme.
__________________________________________________________________
üDisclaimer
Ç__________________________________________________________________
AlthoughI'vetestedthelibraryonmyexistingTurboCcode
andwrittennumeroustestcasesthatexercisedallthefunctions,I
can'tguaranteethatthisgraphicslibraryisbugfree.Therefore:
GraphicsLibraryv1.1isprovidedüASISÇ.Imakeno
warranties,eitherexpressedorimplied,withrespecttothe
software,documentation,itslevelofcompatibility,quality,
performance,orfitness.Iwillnotbeliablefordirect,
indirect,orconsequentialdamagesresultingfromanydefectsin
ormisuseofthesoftware.
Havingsaidthat,IhopeyoufindGraphicsLibraryv1.1as
usefulasIdo.
__________________________________________________________________
üManifest
Ç__________________________________________________________________
Thearchivefileügraphx11.zooÇcontainsseveralfilesin
directoriesasfollows:
übgidemo\
bgidemo.prgÇTurboC'sBGIdemoprogramcompiledwith
LatticeCv5.0andGraphicsLibraryv1.1.
Itcanberuninallresolutions.
üdemos\
Çü lines.cÇasmalldemoprogramthatproducesaQix
likeobjectonthescreen.Thisfilecan
becompiledbyLattice,SozobonandTurbo
C.
ü
sort.cÇasmalldemoprogramthatsortsalistof
randomnumberusingshell,insertion,
selectionandquicksortmethods.The
processofsortingisshowngraphically.
ThisfilecanbecompiledbyLattice,
SozobonandTurboC.
üdocs\Ç
ügraphx11.docÇa1ÉSTÇWordPlusdocumentfilecontaining
thegraphicslibrarymanual.
ü graphx11.txtÇapureASCIIversionoftheabove.This
isprovidedsothemanualcanbeprinted
withyourfavouritehardcopyutility.
Ç
ülc_lib\Ç
ügraphics.libÇtheLatticeCobjectmodulelibraryfile,
builtwithLattice'süoml.ttpÇ,thatmust
belinkedwithyourobjectfiles.
ügraphics.hdrÇacompressedgraphicsheaderfileusedby
LatticeCandcreatedusingLattice's
ülcompact.ttpÇutilityprovidedwith
LatticeC.
ügraphics.hlcÇthegraphicslibraryheaderfileusedby
LatticeCinpureASCII.
üsoz_lib\ Ç
ügraphics.aÇtheHeat&ServeSozobonCv1.33iand
SozobonCv2.0objectmodulelibrary
file,builtwithüar.ttpÇ,thatmustbe
linkedwithyourobjectfiles.
ügraphics.hszÇthegraphicslibraryheaderfileusedby
SozobonCandHeat&ServeSozobonC.
üextras\Ç
ügemfst17.lzhÇSozobonCv2.0userswillhavetoinstall
IanLepore'sGEMFASTVDI&AESlibraries
beforemygraphicslibrarycanbeused.
IfusingHeat&ServeSozobonCv1.33i
youalreadyhavethislibrary.
üfplib10b.arcÇSozobonCv2.0userswillhavetoinstall
DavidW.Brooks'replacementfloating
pointlibrarybeforemygraphicslibrary
canbeused.IfusingHeat&Serve
SozobonCv1.33iyoudon'tneedthis
libray.
Ifanyofthesefilesaremissing,theoriginalügraphx11.zooÇ
filehasbeentamperedwith.Pleaselocateacompleteügraphx11.zooÇ
file.Ifyougiveacopytosomeoneelse,pleasedistributethe
completearchiveandnotbitsandpieces.Thanks.
__________________________________________________________________
üInstallation
Ç__________________________________________________________________
Theinstallationprocedureisreallyquitesimple.There
are twowaysthatthegraphicslibrarycanbeutilizedbyyourC
compiler.Youcanplacethefilesintheappropriatedirectories
usedbyCyourcompilerorsimplycopythemtoyourworking
directorywhereyourCsourcecoderesides.Personally,Iprefer
thefilestobeinthecompiler'sdirectoriessoyoudon'thaveto
Çcopythefilesallovertheplacebeforeusingit.
InstallationforLatticeCv5.06
Fromülc_lib\Çofügraphx11.zooÇ
1) copyügraphics.libÇ to \lc\lib\graphics.lib
2) copyügraphics.hlcÇ to \lc\headers\graphics.h
3) copyügraphics.hdrÇ to \lc\h\graphics.h
InstallationforSozobonCv2.0
Fromüsoz_lib\Çofügraphx11.zooÇ
1) copyügraphics.aÇ to \sozo_20\lib\graphics.a
2) copyügraphics.hszÇ to \sozo_20\include\graphics.h
3)InstalltheGEMFASTlibrariesasoutlinedintheGEMFAST
documentation.
4)Installthereplacementfloatingpointlibrariesas
outlinedinthedocumentation.
InstallationforHeat&ServeSozobonCv1.33i
Fromüsoz_lib\Çofügraphx11.zooÇ
1) copyügraphics.aÇ üÇto \sozo_133i\lib\graphics.a
2) copyügraphics.hszÇ to \sozo_133i\include\graphics.h
Pleaseensurethatthecorrectobjectfileiscopiedintothe
\libdirectorybecausetheyarenotinterchangeable.The
ügraphics.libÇfileisaLatticeCspecificobjectmodulelibrary
fileandtheügraphics.aÇfileisaDRIobjectmodulelibraryfile
usedbySozobonC.
__________________________________________________________________
üUsingtheGraphicsLibrary
Ç__________________________________________________________________
Tousethegraphicslibrary,allonemustdoisplacethe
appropriateü#includeÇstatementinyourCcodesourcecodethat
willusegraphicfunctions.Ifyouhaveinstalledthegraphics
libraryintheCcompiler'sdirectoriesthensimplyinsertthe
ü#include<graphics.h>Çstatementinyoursourcefile.
Ifhowever,youdecidednottoinstallthegraphicslibrary
inthecompiler'sdirectories,thenuseü#include"graphics.h"Ç
(notethedoublequotes).Thiscausesthepreprocessortolookin
thecurrentdirectoryfortheheaderfile.Ifnotfound,the
compiler'sdirectory(\lc\hor\sozobon\include)issearched.
êSozobonCuserspleasenote:ÇDuetoaproblemIencountered
whencreatingthelibraryforSozobonC,youwillalsohavetoadd
aü#defineÇtoyoursourcefile.ü#define__MAIN_SRC__Çmustbeplaced
Çinthesourcefile,beforeü#include<graphics.h>Ç,thatcontains
theümain()Çfunction.Thisisnecessarysothatthefourfunctions
intheheaderfilearecompiledwithyoursourcecode.Forsome
strangereasonthesefunctionscauseasystemcrashincludedin
ügraphics.aÇ.Itriedseveralwaystoovercomethisproblemandthis
isthesolutionIcameupwith.Itseemsabitmessy,butitworks
fine.I'lltrytofindasolutiontothisproblem.
êLatticeCuserspleasenote:ÇThegraphics.hfiledefines
enumeratedtypesthatcontainduplicatevalues.LatticeC
generateswarning#79whenduplicatevaluesareencounteredin
enumeratedtypes.Toeliminatethesemessagessimplyincludethe
argument-j79iwhenusinglc.ttp,asshownbelow,oraddittothe
LC_OPTenvironmentvariable.
Onceyoursourcecodehasbeencompiledintoobjectfiles,
thegraphicslibrarymustbelinkedwithyourobjectfilesas
follows:
CompilingandlinkingwithLatticeC
1)lc.ttp-fm-j79imyprog.c
2)clinkc.o+myprog.o
LIBgraphics.lib+lcm.lib+lcg.lib+lc.lib
TOmyprog.prg
3) runmyprog.prg
CompilingandlinkingwithSozobonCv2.0
1)cc-omyprog.prg-rmyprog.cgraphics.avdifast.a
aesfast.a
2) runmyprog.prg
CompilingandlinkingwithHeat&ServerSozobonCv1.33i
1)cc-omyprog.prgmyprog.cgraphics.alibm.avdifast.a
aesfast.a
2) runmyprog.prg
IfyoudecidetoüfreelyÇdistributeaprogramofyoursthat
wascreatedwiththehelpofthislibraryhowaboutmentioning
KennethW.Hartlen,IanLeporeandDavidW.Brooksinthecredits.
Wearen'treceivinganymoneyforoureffortssoitwouldbenice
toatleastseeournamesinlights!Thanks.
ü**WARNING!!**ÇIfprogramsareabortedbeforeüclosegraph()Ç
iscalledunpredicableresultswilloccurwhenyoutriedtorun
anotherprogram.Makesurethataüclosegraph()Çisperformedbefore
theprogramendsotherwiseyoushouldre-bootyoursystem.
__________________________________________________________________
Ç
üFutureEnhancements
Ç__________________________________________________________________
Atthemomentthisgraphicslibrarysuitsmyneedsquite
well.IwasabletocompileandrunallmyTurboCv2.0graphics
code,writtenwhileinuniversity,onmyMEGAST2!Theonlyreal
deviationfromTurboCisthefontcapabilitywiththe
üinstalluserfontÇfunction.Thisgraphicslibrarysimplyuses
variationsofthesystemfontusingüsettextstyleÇratherthan
loadingdifferenttypefaces.Ihadconsideredallowingtheuseof
GDOS,butI'munsureifitisreallynecessaryanditwouldlimit
theuseofthelibrary.
Ifyou'dliketoseesomethingadded,orchanged,toenhance
compatiblitywithTurboC'sgraphicslibraryjustletmeknow.
__________________________________________________________________
üWhat'sChanged?
Ç__________________________________________________________________
July 16/92
Version1.0:UnleashedGraphicsLibraryonthemasses.
August 6/92
Version 1.1:ü#defineÇswereaddedtoügraphics.hszÇtoprevent
'doubledefine'duringlinking.Thisproblemwas
encounteredwhenM.A.Rahinattemptedtousethe
librarywithHeat&ServeSozobonCv1.33i.Turbo
C'sgraphicfunctionshaveverylongnamesandwhen
truncatedto8characterscausedsomeduplicate
functionnames.Forexample,üsettextjustifyÇand
üsettextstyleÇtruncatedtoü_settextÇ.Someinternal
variableswerealsorenamedtoavoidthe'double
define'.
__________________________________________________________________
üTheGraphicFunctions
Ç__________________________________________________________________
Asmentionedearlier,thegraphicslibraryisTurboCv2.0
compatible,butnot100%compatibleandsomeminorvariations
exist.
êAside:ÇForthosefamiliarwithTurboC,IhadtheBGIDEMO.C
filecompiledandrunningwithLatticeCinlessthananhour!
Onlyminormodificationsusingü#ifdefÇswereneededtothe45K
sourcefilesoitcouldbecompiledinLatticeorTurboC!
Whatfollowsisacompletedescriptionofeachgraphic
functionavailableinthelibrary.Functionsnotimplementedwill
stillhaveabriefdescriptionandareasonwhyitwasnot
Çimplemented.Ifyoudon'tagreewithmyreasoning,letmeknowwhy
andI'llseewhatIcandoaboutimplementingitinafuture
release.
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....]0110
__________________________________________________________________
üarcÇ Draws a circular arc
__________________________________________________________________
üSyntaxÇ voidfar arc(int äxÇ,int äyÇ,int ästangleÇ,int äendangleÇ,
int äradiusÇ);
üPurposearcÇdrawsanarcat(äxÇ,äyÇ)withthegivenäradiusÇ.
ThearcisdrawnfromästangleÇtoäendangleÇ.If
ästangleÇequalsäendangleÇacompletecircleisdrawn.
ästangleÇandäendangleÇareanglesmeasuredindegrees
goingcounterclockwise,with0degreesbeingat3
o'clock,90degreesat12o'clock,andsoon.The
arcisdrawninthecurrentcolour,linestyleand
thickness.
__________________________________________________________________
übarÇ Draws a two-dimensional bar
__________________________________________________________________
üSyntaxÇ void far bar(int äleftÇ, int ätopÇ, int ärightÇ,
int äbottomÇ);
üPurposebarÇdrawsafilled-inrectangular,two-dimensional
barusingthecurrentfillstyleandfillcolour.
Thebarisnotoutlined,anoutlinedbarcanbe
drawnusingtheübar3DÇfunctionswithaädepthÇof
zero.
Theupperleftcornerisdefinedby(äleftÇ,ätopÇ)and
thelowerrightcornerby(ärightÇ,äbottomÇ).
__________________________________________________________________
übar3dÇ Draws a 3-D bar
__________________________________________________________________
üSyntaxÇ void far bar3d(int äleftÇ, int ätopÇ, int ärightÇ,
int äbottomÇ,int ädepthÇ, int ätopflagÇ);
üPurposeÇübar3dÇdrawsathree-dimensionalrectangularbar
usingthecurrentfillstyleandfillcolour,then
outlinesitwiththecurrentcolour,linestyleand
thickness.The3DeffectisgovernedbyädepthÇand
iftheätopflagÇisnonzero,the3Dbarwithbedrawn
withatop.
Theupperleftcornerisdefinedby(äleftÇ,ätopÇ)and
thelowerrightcornerby(ärightÇ,äbottomÇ).
Ç__________________________________________________________________
ücircleÇ Draws a circle
__________________________________________________________________
üSyntaxÇ void circle(int äxÇ, int äyÇ, int äradiusÇ);
üPurposecircleÇdrawsacircleusingthecurrentcolour,
linestyleandthicknessat(äxÇ,äyÇ)witharadius
givenbyäradiusÇ.Thecircledrawnwillbeatrue
circleinanyresolution,unlikethePCwherethe
aspectratiohastobeadjustedappropriately.
__________________________________________________________________
ücleardeviceÇ Clears the graphics screen
__________________________________________________________________
üSyntaxÇ void far cleardevice(void);
üPurposecleardeviceÇerasestheentiregraphicsscreenand
setsthecurrentposition(CP)to(0,0).
__________________________________________________________________
üclearviewportÇ Clears the current viewport
__________________________________________________________________
üSyntaxÇ void far clearviewport(void);
üPurposeÇüclearviewportÇerasestheviewportandsetscurrent
position(CP)to(0,0)relativetotheviewport.
__________________________________________________________________
üclosegraphÇ Shuts down the graphics system
__________________________________________________________________
üSyntaxÇ void far closegraph(void);
üPurposeclosegraphÇrestorestheoriginalcolourpalette,
andclearsthescreen.
__________________________________________________________________
üdetectgraphÇ Determinesgraphicsdriverandmodetouseby
checkingthehardware
__________________________________________________________________
üSyntaxÇ void far detectgraph(int far *ägraphdriverÇ,
int far *ägraphmodeÇ);
üPurposedetectgraphÇreturnsthemonitortypeinägraphdriverÇ
andthegraphicsmodeinägraphmodeÇwhichindicates
thehighestresolutionpossible.Ifnographics
hardwareisdetected,ä*graphdriverÇissetto
ägrNotDetectedÇandügraphresultÇwillreturn
ägrNotDetectedÇ.
Çä*graphdriverÇisanintegerthatindicatesthe
drivertobeused.Youcanuseconstantsdefinedby
theägraphics_driverÇenumerationtypeasshown
below.
ägraphics_driver
Ç constant Numericvalue
--------------------------------------
DETECT 0(autodetection)
... ..(CGA,EGA,VGA,etc)
SC1224 11
SM124 12
TTC1432 13
TTM194 14
UNKNOWN_DRIVER 15
ä*graphmodeÇisanintegerthatindicatesthescreen
modetobeused.Youcanuseconstantsdefinedby
theägraphics_modeÇenumerationtypeasshownbelow.
ägraphics_mode
Ç constant Numericvalue
--------------------------------------
CGAC0 0
... ..(CGA,EGA,VGA,etc)
SC1224LO 0
SC1224MED 1
SM124HI 0
TTC1434LO 0
TTC1434MED 1
TTM194HI 1
UNKNOWN_MODE 0
__________________________________________________________________
üdrawpolyÇ Draws the outline of a polygon
__________________________________________________________________
üSyntaxÇ voidfar drawpoly(int änumpointsÇ,
int far ä*polypointsÇ);
üPurposeÇüdrawpolyÇdrawsapolygonhavingänumpointsÇpoints
usingthecurrentcolour,linestyleandthickness.
äpolypointsÇseriesofänumpointsÇx2integers
definingtheverticesforthepolygon.Eachpairof
integersrepresentsan(x,y)coordinateofa
vertex.Inordertodrawanenclosedpolygonhaving
nverticesyoumustusepassn+1coordinates,
wherethenÉthÇcoordinateequalsthe0ÉthÇ.
ügraphresultÇwillreturnägrNoScanMemÇifanerror
occursdrawingthepolygon.
Ç__________________________________________________________________
üellipseÇ Draws an elliptical arc
__________________________________________________________________
üSyntax Çvoid far ellipse(int äxÇ, int äyÇ,
int ästangleÇ, int äendangleÇ,
int äxradiusÇ, int äyradiusÇ);
üPurposeÇüellipseÇdrawsanellipticalarccenteredat(äxÇ,äyÇ)
withahorizontalandverticalradiigivenby
äxradiusÇandäyradiusÇusingthecurrentcolour,line
styleandthickness.Theellipseisdrawnfrom
ästangleÇtoäendangleÇ.IfästangleÇequalsäendangleÇa
completeellipseisdrawn.
ästangleÇandäendangleÇareanglesmeasuredindegrees
goingcounterclockwise,with0degreesbeingat3
o'clock,90degreesat12o'clock,andsoon.
__________________________________________________________________
üfillellipseÇ Draws and fills an ellipse
__________________________________________________________________
üSyntaxÇvoid far fillellipse(int äxÇ, int äyÇ,
int äxradiusÇ, int äyradiusÇ);
üPurposeÇüfillellipseÇdrawsanellipsecenteredat(äxÇ,äyÇ)with
ahorizontalandverticalradiigivenbyäxradiusÇ
andäyradiusÇ.Theellipseisfilledwiththecurrent
fillstyleandcolour,thenoutlinedwiththe
currentcolour,linestyleandthickness.
__________________________________________________________________
üfillpolyÇ Draw and fill a polygon
__________________________________________________________________
üSyntaxÇ void far fillpoly(int änumpointsÇ,
int far ä*polypointsÇ);
üPurposefillpolyÇdrawsapolygonhavingänumpointsÇpoints,
fillsitwiththecurrentfillstyleandcolourand
outlinesitusingthecurrentcolour,linestyle
andthickness.
äpolypointsÇisseriesofänumpointsÇx2integers
definingtheverticesforthepolygon.Eachpairof
integersrepresentsan(x,y)coordinateofa
vertex.UnlikeüdrawpolyÇ,onlynverticesareneeded
andüfillpolyÇtakescareofcreatinganadditional
vertextoclosethepolygon.
ügraphresultÇwillreturnägrNoScanMemÇifanerror
occursdrawingthepolygon.
Ç__________________________________________________________________
üfloodfillÇ Flood-fills a bounded region
__________________________________________________________________
üSyntaxÇ void far floodfill(int äxÇ, int äyÇ, int äborderÇ);
üPurposefloodfillÇfillsaboundedregiononthescreen
startingfrom(äxÇ,äyÇ).Theboundedregionisdefined
bythecolourspecifiedbyäborderÇ.Theregionis
filledwiththecurrentfillstyleandcolour.
__________________________________________________________________
ügetarccoordsÇ Gets coordinates of the last call to arc
__________________________________________________________________
üSyntaxÇ void far getarccoords(struct arccoordstype
far ä*arccoordsÇ);
üPurposegetarccoordsÇfillsintheüarccoordstypeÇstructure
pointedtobyäarccoordsÇwiththeinformationabout
thelastcalltoüarcÇ.üarccoordstypeÇisdefinedin
graphics.handhasthefollowingstructure:
structarccoordstype{
intx,y;
intxstart,ystart,xend,yend;
};
Thisinformationisespeciallyusefulifwanta
linetomeetattheendofthearcortoconnect
theendpointsofthearcwithastraightline.
__________________________________________________________________
ügetaspectratioÇ Retrieves the current graphic mode's aspect ratio
__________________________________________________________________
üSyntaxÇ void far getaspectratio(int far ä*xaspÇ,
int far ä*yaspÇ);
üPurposegetaspectratioÇplacesthewidthofascreenpixel
inäxaspÇandtheheightofascreenpixelinäyaspÇ.
Usingthesevaluesyoucancalculatethescreen's
aspectratiobyäxaspÇ/äyaspÇ.Theaspectratiocan
thenbeusedtodrawtruesquaresinany
resolution.
ägraphics_mode xasp yasp
Ç----------------------------------
SC1224LO 338 372
SC1224MED 169 372
SM124HI 372 372
TTC1434LO ??? ???
TTC1434MED ??? ???
TTM194HI ??? ???
Ç
__________________________________________________________________
ügetbkcolorÇ Returns the current background colour
__________________________________________________________________
üSyntaxÇ int far getbkcolor(void);
üPurposegetbkcolorÇreturnsthecurrentbackgroundcolourof
thescreen.(SeeüsetbkcolorÇformoreinformation.)
__________________________________________________________________
ügetcolorÇ Returns the current drawing colour
__________________________________________________________________
üSyntaxÇ int far getcolor(void);
üPurposegetcolorÇreturnthecurrentlinedrawingcolour.
__________________________________________________________________
ügetdefaultpalette
ÇReturns the palette definition structure
__________________________________________________________________
üSyntaxÇ struct palettetype *far getdefaultpalette(void);
üPurposegetdefaultpaletteÇreturnsapointertoüpalettetypeÇ
structurethatcontainsthedefaultcolours.
__________________________________________________________________
ügetdrivernameÇReturnsapointertoastringcontainingthename
ofthecurrentgraphicsdriver
__________________________________________________________________
üSyntaxÇ char *far getdrivername(void);
üPurposegetdrivernameÇreturnsapointertoastringthat
containsthenameofthegraphicsdriverbeing
used.
__________________________________________________________________
ügetfillpatternÇCopies a user-defined fill pattern into memory
__________________________________________________________________
üSyntaxÇ void far getfillpattern(charfar ä*patternÇ);
üPurposegetfillpatternÇcopiesthecurrentlyusedfill
patternintomemorypointedtobyäpatternÇ.
äpatternÇpointstoasequenceof8byteswitheach
bytedefiningthepatternforalineinthe
pattern.A1bitindicateswhichpixelsaretobe
drawn.
byte# charcontents patterntodraw
Ç ---------------------------------------------
0 0xF0 11110000
1 0x8E 10001110
2 0xF4 11110100
3 0x14 00010100
4 0xF4 11110100
5 0x04 00000100
6 0x04 00000100
7 0x00 00000000
__________________________________________________________________
ügetfillsettings
ÇGetsinformationaboutthecurrentfillpatternand
colour
__________________________________________________________________
üSyntaxÇ void far getfillsettings(struct fillsettingstype
far ä*fillinfoÇ);
üPurposegetfillsettingsÇfillsintheüfillsettingstypeÇ
structurepointedtobyäfillinfoÇwiththe
informationaboutthecurrentfillstyleand
colour.üfillsettingstypeÇisdefinedingraphics.h
andhasthefollowingstructure:
structfillsettingstype{
intpattern;
intcolor;
};
Thereare39fillpatternsavailableforuse.Some
arepredefinedintheenumeratedtypeäfill_patternsÇ
andcorrespondascloselyaspossiblewithTurboC.
äfill_patternsÇNumeric
constant value
--------------------------------------------------
EMPTY_FILL 0 fills with background colour
SOLID_FILL 1 fills with fill colour
LINE_FILL 2 --- fill
LTSLASH_FILL 3 /// fill
SLASH_FILL 4 /// fill with thick lines
BKSLASH_FILL 5 \\\ fill with thick lines
LTBKSLASH_FILL 6 \\\ fill
HATCH_FILL 7 light hatch fill
XHATCH_FILL 8 heavy cross hatch fill
INTERLEAVE_FILL 9 interleaving line fill
WIDE_DOT_FILL 10 widely spaced dot fill
CLOSE_DOT_FILL 11 closely spaced dot fill
USER_FILL 12 use user defined fill
__________________________________________________________________
ügetgraphmodeÇ Returns the current graphics mode
Ç__________________________________________________________________
üSyntaxÇ int fargetgraphmode(void);
üPurposegetgraphmodeÇreturnsthecurrentgraphicsmode.
Namesforthevaluesaredefinedingraphics.hin
theenumerationtypeägraph_modesÇ.
__________________________________________________________________
ügetimageÇSavesabitimageofthespecifiedregioninto
memory
__________________________________________________________________
üSyntaxÇ void far getimage(int äleftÇ, int ätopÇ,
int ärightÇ, int äbottomÇ,
void far ä*bitmapÇ);
üPurposegetimageÇsavesarectangularportionofthescreen,
definedby(äleftÇ,ätopÇ)to(ärightÇ,äbottomÇ),tomemory
pointedtobyäbitmapÇ.
Thisfunctionisparticularlyusefulincombination
whichüputimageÇtoanimatesomethingonthescreen.
__________________________________________________________________
ügetlinesettings
ÇGetsthecurrentlinestyle,patternandthickness
__________________________________________________________________
üSyntaxÇ void far getlinesettings(struct linesettingstype
far ä*lineinfoÇ);
üPurposegetlinesettingsÇfillsintheülinesettingstypeÇ
structurepointedtobyälineinfoÇwiththe
informationaboutthecurrentlinestyle,user
definedpatternandthickness.ülinesettingstypeÇis
definedingraphics.handhasthefollowing
structure:
structlinesettingstype{
intlinestyle;
unsignedupattern;
intthickness;
};
Thelinestylesnamesarepredefinedinthe
enumeratedtypeäline_stylesÇandcorrespondas
closelyaspossiblewithTurboC.
äline_stylesÇ Numeric
constant value
-----------------------
SOLID_LINE 0
DOTTED_LINE 1
CENTER_LINE 2
Ç DASHED_LINE 3
USERBIT_LINE 4
__________________________________________________________________
ügetmaxcolorÇReturnsmaximumcolourvaluethatcanbepassedto
setcolor
__________________________________________________________________
üSyntaxÇ int far getmaxcolor(void);
üPurposegetmaxcolorÇsimplyreturnsthehighestvalidpen
numberthatcanbepassedtoüsetcolorÇ.
Thereturnedvaluesare:1forSM124HI,3for
SC1224MEDand15forSC1224LO,255forTTC1434LO,
15forTTC1434MEDand2forTTM194HI.
__________________________________________________________________
ügetmaxmodeÇ Returnsthemaximummodenumberforthecurrent
driver
__________________________________________________________________
üSyntaxÇ int far getmaxmode(void);
üPurposegetmaxmodeÇreturnsthemaximummodenumberforthe
currentdriver.
__________________________________________________________________
ügetmaxxÇ Returns maximum x screen coordinate
__________________________________________________________________
üSyntaxÇ int far getmaxx(void);
üPurposegetmaxxÇreturnsthemaximumxcoordinateforthe
currentgraphicsmode.Forexample,theresolution
forSM124HIis640x400soügetmaxxÇreturns639.
__________________________________________________________________
ügetmaxyÇ Returns maximum y screen coordinate
__________________________________________________________________
üSyntaxÇ int far getmaxy(void);
üPurposegetmaxyÇreturnsthemaximumycoordinateforthe
currentgraphicsmode.Forexample,theresolution
forSM124HIis640x400soügetmaxyÇreturns399.
__________________________________________________________________
ügetmodenameÇReturnsapointertoastringcontainingthename
ofaspecifiedgraphicsmode
__________________________________________________________________
üSyntaxÇ char *far getmodename(int ämode_numberÇ);
üPurposegetmodenameÇreturnsapointertoastringthat
containsthename,specifiedbyämode_numberÇ,ofthe
graphicsmodebeingused.
__________________________________________________________________
ügetmoderange ÇGetstherangeofmodesforagivengraphicsdriver
__________________________________________________________________
üSyntaxÇ void far getmoderange(int ägraphdriverÇ,
int far ä*lomodeÇ,
int far ä*himodeÇ);
üPurposegetmoderangeÇreturnstherangeofvalidmodesfor
thespecifieddriver.IfägraphdriverÇisinvalid
thenä*lomodeÇandä*himodeÇaresetto-1.If
ägraphdriverÇis-1thenthecurrentmodeisreturned
inä*lomodeÇandä*himodeÇ.
__________________________________________________________________
ügetpaletteÇ Gets information about the current palette
__________________________________________________________________
üSyntaxÇ void far getpalette(struct palettetype
far ü*paletteÇ);
üPurposegetpaletteÇfillsintheüpalettetypeÇstructure
pointedtobyäpaletteÇwiththeinformationabout
thecurrentcolourpalettebeingused.üpalettetypeÇ
isdefinedingraphics.handhasthefollowing
structure:
#defineMAXCOLORS15;
structpalettetype{
unsignedsize;
charcolors[MAXCOLORS+1];
};
äsizeÇcontainsthenumberofentriesbeingusedin
äcolorsÇ.EachentryinäcolorsÇstoresthecolorfor
thatdrawingpen.
__________________________________________________________________
ügetpalettesizeÇ Returns size of palette colour lookup table
__________________________________________________________________
üSyntaxÇ int far getpalettesize(void);
üPurposegetpalettesizeÇreturnsthenumberofpalette
entriesforthecurrentgraphicsmode.
__________________________________________________________________
ügetpixelÇ Gets the colour of a specified pixel
__________________________________________________________________
üSyntaxÇ unsigned far getpixel(int äxÇ, int äyÇ);
üPurposegetpixelÇreturnsthepennumberthatwasusedto
drawthepixelonthescreenatthe(äxÇ,äyÇ)
coordinate.
__________________________________________________________________
ügettextsettings
ÇGetsinformationaboutthecurrentgraphicstext
font
__________________________________________________________________
üSyntaxÇ void far gettextsettings(struct textsettingstype
far ä*texttypeinfoÇ);
üPurposegettextinfoÇfillsintheütextsettingstypeÇstructure
pointedtobyätexttypeinfoÇwiththeinformation
aboutthecurrenttextfont,direction,size,
effectsandjustification.ütextsettingstypeÇis
definedingraphics.handhasthefollowing
structure:
struct textsettingstype {
int font;
int direction;
int charsize;
int horiz;
int vert;
};
__________________________________________________________________
ügetviewportsettings
ÇGets information about the current viewport
__________________________________________________________________
üSyntaxÇ void far getviewsettings(struct viewporttype
far ä*viewportÇ);
üPurposegetviewportsettingsÇfillsintheüviewporttypeÇ
structurepointedtobyäviewportÇwiththe
informationaboutthecurrentviewport.ü
viewporttypeÇisdefinedingraphics.handhasthe
followingstructure:
struct viewporttype {
int left, top, right, bottom;
int clip;
};
__________________________________________________________________
ügetxÇ Returnsthecurrentgraphicsposition'sx
Ç coordinate
__________________________________________________________________
üSyntax Çint far getx(void);
üPurposegetxÇreturnsthecurrentposition's(CP)äxÇ
coordinate.Thisvalueisviewportrelative.
__________________________________________________________________
ügetyÇ Returnsthecurrentgraphicsposition'sy
coordinate
__________________________________________________________________
üSyntax Çint far gety(void);
üPurposegetyÇreturnsthecurrentposition's(CP)äyÇ
coordinate.Thisvalueisviewportrelative.
__________________________________________________________________
ügraphdefaultsÇ Resets all graphics settings to their defaults
__________________________________________________________________
üSyntaxÇ void far graphdefaults(void);
üPurposegraphdefaultÇresetsallgraphicssettingsthe
appropriatedefaults:
setsdefaultpalettecoloursanddrawingcolour.
setsdefaultfillstyleandcolour.
setsdefaultlinestyle.
setsdefaulttextstyleandjustification.
setsviewporttoentirescreenwithclippingon.
__________________________________________________________________
ügrapherrormsgÇ Returns a pointer to an error message string
__________________________________________________________________
üSyntaxÇ char * far grapherrormsg(int äerrorcodeÇ);
üPurposegrapherrormsgÇreturnsapointertotheerror
messagetextassociatedwithäerrorcodeÇvalue
returnedbyügraphresultÇ.
__________________________________________________________________
ü_graphfreememÇ User hook into graphics memory allocation
__________________________________________________________________
üSyntaxÇ void far _graphfreemem(void far ä*ptrÇ,
unsigned äsizeÇ);
üPurpose_graphfreememÇisamemorymanagementroutineused
ÇbyTurboCtofreeallocatedgraphicsmemoryand
hasnotbeimplementedontheST/STe/TT.Aftera
calltoü_graphfreememÇ,ügraphresultÇwillreturn
ägrNotImplementedÇ.
__________________________________________________________________
ü_graphgetmemÇ User hook into graphics memory allocation
__________________________________________________________________
üSyntaxÇ void far _graphgetmem(unsigned äsizeÇ);
üPurpose_graphgetmemÇisamemorymanagementroutineusedby
TurboCtoallocategraphicsmemoryandhasnotbe
implementedontheST/STe/TT.Afteracallto
ü_graphgetmemÇ,ügraphresultÇwillreturn
ägrNotImplementedÇ.
__________________________________________________________________
ügraphresultÇ Returnsanerrorcodeforthelastunsuccessful
graphicsoperation
__________________________________________________________________
üSyntaxÇ int far graphresult(void);
üPurposegraphresultÇreturnstheerrorcodethatwas
reportedforthelastgraphicsoperation.Theerror
statusisresettoägrOkÇ.
Allgraphicsfunctionswillsettheerrorstatusto
ägrOkÇunlesssomethinghasgonewrong.
Error ägraphics_errors
Ç code constant messagestring
-------------------------------------------------------
0 grOk No error
-1 grNoInitGraphGraphicsnotinitia⑨
lized(use'initgraph')
-2 grNotDetectedGraphicshardwarenotde⑨
tected
-3 grFileNotFoundDevicedriverfilenotfo⑨
und
-4 grInvalidDriverInvaliddevicedriverfile
-5 grNoLoadMemNotenoughmemorytoload
driver
-6 grNoScanMemOutofmemoryinscanfill
-7 grNoFloodMemOutofmemoryinflood
fill
-8 grFontNotFoundFontfilenotfound
-9 grNoFontMemNotenoughmemorytoload
font
-10 grInvalidModeInvalidgraphicsmodefor
selecteddriver
-11 grErrorGraphicserror
-12 grIOerrorGraphicsI/Oerror
Ç -13 grInvalidFontInvalidfontfile
-14 grInvalidFontNumInvalidfontnumber
-15 grInvalidDeviceNumInvaliddevicenumber
-16 grInvalidFontSizeInvalidfontsize
-17 grNotImplementedNotimplementedonAtari
ST/STe/TT
-18 grInvalidVersionInvalidversionnumber
__________________________________________________________________
üimagesizeÇ Returnsthenumberofbytesrequiredtostoreabit
image
__________________________________________________________________
üSyntaxÇ unsigned far imagesize(int äleftÇ, int ätopÇ,
int räightÇ, int äbottomÇ);
üPurposeimagesizeÇdeterminesthenumberofbytesofmemory
requiredtostoreabitimage.
__________________________________________________________________
üinitgraphÇ Initializes the graphics system
__________________________________________________________________
üSyntaxÇ void far initgraph(int far ä*graphdriverÇ,
int far *ägraphmodeÇ,
char far *äpathtodriverÇ);
üPurposeinitgraphÇinitializationsthegraphicssystemand
mustbecalledbeforeanygraphicsfunctionsare
attempted.Ifagraphicfunctioniscalledbefore
üinitgraphÇanerrormessagewillbedisplayedand
theprogramwillterminate.
ä*graphdriverÇisanintegerthatindicatesthe
drivertobeused.Youcanuseconstantsdefinedby
theägraphics_driverÇenumerationtypeasshown
below.
ägraphics_driver
Ç constant Numericvalue
--------------------------------------
DETECT 0(autodetection)
... ..(CGA,EGA,VGA,etc)
SC1224 11
SM124 12
TTC1434 13
TTM194 14
UNKNOWN_DRIVER 15
ä*graphmodeÇisanintegerthatindicatesthescreen
modetobeused.Youcanuseconstantsdefinedby
theägraphics_modeÇenumerationtypeasshownbelow.
ägraphics_mode
Ç constant Numericvalue
--------------------------------------
CGAC0 0
... ..(CGA,EGA,VGA,etc)
SC1224LO 0
SC1224MED 1
SM124HI 0
TTC1434LO 0
TTC1434MED 1
TTM194HI 0
UNKNOWN_MODE 0
êNote:ÇRefertographics.hforacompletelistof
values.OnlyST/STe/TTspecificvaluesareused.
AfterüinitgraphÇiscalled,ägraphdriverÇand
ägraphmodeÇwillbeupdatedtotheappropriatevalues
toindicatedtheactualgraphicsmodeset.
äpathtodriverÇhasnoeffectontheST/STe/TTsince
graphicdriverscannotbeloaded.
Ifnographicshardwareisdetected,ä*graphdriverÇ
issettoägrNotDetectedÇandügraphresultÇwillalso
returnägrNotDetectedÇ.
__________________________________________________________________
üinstalluserdriver
ÇInstallsavendor-addeddevicedrivertotheBGI
ü Ç devicedrivertable
__________________________________________________________________
üSyntaxÇ int far installuserdriver(char far ä*nameÇ,
int huge (ä*detectÇ)(void));
üPurposeinstalluserdriverÇisusedtoloadalternative
graphicsdriversandhasnotbeimplementedonthe
ST/STe/TT.Afteracalltoü_graphgetmemÇ,
ügraphresultÇwillreturnägrNotImplementedÇ.
__________________________________________________________________
üinstalluserfont
Ç LoadsafontfilethatisnotbuiltintotheBGI
system
__________________________________________________________________
üSyntaxÇ int far installuserfont(char far ä*nameÇ);
üPurposeinstalluserfontÇisusedtoloada"stroked"font
andhasnotbeenimplementedontheST/STe/TT.
AfteracalltoüinstalluserfontÇ,ügraphresultÇwill
returnägrNotImplementedÇ.
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....]0110
__________________________________________________________________
ülineÇ Draws a line between two specified points
__________________________________________________________________
üSyntaxÇ void far line(int äx1Ç, int äy1Ç, int äx2Ç, int äy2Ç);
üPurposelineÇdrawsalineusingthecurrentcolour,line
style,thicknessbetweenthe(äx1Ç,äy1Ç)and(äx2Ç,äy2Ç)
points.
__________________________________________________________________
ülinerelÇDrawsalinearelativedistancefromthecurrent
position(CP)
__________________________________________________________________
üSyntaxÇ void far linerel(int ädxÇ, int ädyÇ);
üPurposelinerelÇdrawsalinefromthecurrentposition(CP)
tothepoint(ädxÇ,ädyÇ)whichisarelativedistance
fromCP.CPisadjustedby(ädxÇ,ädyÇ).Thecurrent
colour,linestyleandthicknessareused.
__________________________________________________________________
ülinetoÇDrawsalinefromthecurrentposition(CP)to
(x,y)
__________________________________________________________________
üSyntaxÇ void far lineto(int äxÇ, int äyÇ);
üPurposelinetoÇdrawsalinefromthecurrentposition(CP)
tothepoint(äxÇ,äyÇ).CPismovedto(äxÇ,äyÇ).The
currentcolour,linestyleandthicknessareused.
__________________________________________________________________
ümoverel ÇMoves the current position (CP) a relative distance
__________________________________________________________________
üSyntaxÇ void far moverel(int ädxÇ, int ädyÇ);
üPurposemoverelÇmovesthecurrentposition(CP)byädxÇin
thehorizontaldirectionandädyÇinthevertical
direction.
__________________________________________________________________
ümovetoÇ Moves the current position (CP) to (x,y)
__________________________________________________________________
üSyntaxÇ void far moveto(int äxÇ, int äyÇ);
üPurposemovetoÇmovesthecurrentposition(CP)tothepoint
specifiedby(äxÇ,äyÇ).
__________________________________________________________________
üouttextÇ Displays a string in the viewport
__________________________________________________________________
üSyntaxÇ void far outtext(char far ä*textstringÇ);
üPurposeouttextÇdisplaysatextstringintheviewport
usingthecurrenttextstyle,size,justification
anddirection.
üouttextÇdisplaysätextstringÇatthecurrentposition
(CP).Ifthehorizontaljustificationissetto
LEFT_TEXTandtheverticaljustificationto
HORIZ_TEXT,thenCP'sxcoordinateisadjustedby
ütextwidthÇ(ätextstringÇ).OtherwiseCPisunchanged.
__________________________________________________________________
üouttextxyÇ Displays a string at a specified location
__________________________________________________________________
üSyntaxÇ void far outtextxy(int äxÇ, int äyÇ,
char far ä*textstringÇ);
üPurposeouttextxyÇdisplaysatextstringintheviewport
usingthecurrenttextstyle,size,justification
anddirectionat(äxÇ,äyÇ).
Thecurrentposition(CP)isnotchanged.
__________________________________________________________________
üpiesliceÇ Draws and fills in pie slice
__________________________________________________________________
üSyntaxÇ void far pieslice(int äxÇ, int äyÇ, int ästangleÇ,
int äendangleÇ, int äradiusÇ);
üPurposepiesliceÇdrawsapiesliceat(äxÇ,äyÇ)witharadius
givenbyäradiusÇ.Thepiesliceisdrawnfromthe
ästangleÇtotheäendangleÇ.ästangleÇandäendangleÇare
givenindegreesandmeasuredcounterclockwisewith
0degreesbeingat3o'clock.
Thepiesliceisfilledwiththecurrentfillstyle
andcolour,thenoutlinedwiththecurrentcolour,
linestyleandthickness.
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..◆.]0110
__________________________________________________________________
üputimageÇ Outputs a bit image onto the screen
__________________________________________________________________
üSyntaxÇ void far putimage(int äleftÇ, int ätopÇ,
void far ä*bitmapÇ, int äopÇ);
üPurposeputimageÇdrawsthebitimagesavedbyügetimageÇon
thescreenwiththeupperrightcornerbeing
positionedat(äleftÇ,ätopÇ).äbitmapÇpointstothe
locationinmemorywheretheimageisstored.
ÇäopÇindicateswhotheimageistobedrawnonthe
screen.Theenumerationtypeäputimage_opsÇ,asfound
ingraphics.h,givesnamefortheäopÇvalues.
äputimage_ops
Ç constant value description
-----------------------------------------
COPY_PUT 0 copy
XOR_PUT 1 exclusiveor
OR_PUT 2 inclusiveor
AND_PUT 3 and
NOT_PUT 4 copytheinverse
__________________________________________________________________
üputpixelÇ Plots a pixel at a specific point
__________________________________________________________________
üSyntaxÇ void far putpixel(int äxÇ, int äyÇ, int äcolorÇ);
üPurposeputpixelÇdrawsasinglepointat(äxÇ,äyÇ)usingthe
givenäcolorÇ.
__________________________________________________________________
ürectangleÇ Draws a rectangle
__________________________________________________________________
üSyntaxÇ void far rectangle(int äleftÇ, int ätopÇ,
int ärightÇ, int äbottomÇ);
üPurposerectangleÇdrawsarectanglefromtheupperleft
corner(äleftÇ,ätopÇ)tothelowerrightcorner
(ärightÇ,äbottomÇ)usingthecurrentcolour,linestyle
andthickness.
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..◆.]0110
__________________________________________________________________
üregisterbgidriverÇandüregisterfarbgidriver
ÇRegistersauser-loadedorlinked-ingraphics
drivercodewiththegraphicssystem
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..◆.]0110
__________________________________________________________________
üSyntaxÇ int registerbgidriver(void (ä*driverÇ)(void));
int registerfarbgidriver(void (*driver)(void));
üPurposeregisterbgidriverÇandüregisterfarbgidriverÇhavenot
beenimplementedinthisgraphicslibrary.
ügraphresultÇwillreportaägrNotImplementedÇerror.
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..◆.]0110
__________________________________________________________________
üregisterbgifontÇandüregisterfarbgifont
ÇRegistersauser-loadedorlinked-ingraphicsfont
codewiththegraphicssystem
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..◆.]0110
__________________________________________________________________
üSyntaxÇ int registerbgifont(void (ä*fontÇ)(void));
Ç int registerfarbgifont(void (ä*fontÇ)(void));
üPurposeregisterbgifontÇandüregisterfarbgifontÇhavenot
beenimplementedinthisgraphicslibrary.
ügraphresultÇwillreportaägrNotImplementedÇerror.
__________________________________________________________________
ürestorecrtmodeÇRestoresthescreenmodetoitspre-initgraph
setting
__________________________________________________________________
üSyntaxÇ void far restorecrtmode(void);
üPurposerestorecrtmodeÇreturnsthescreentotextmode.The
screenisclearedandthecursorreturnstothe
homeposition(0,0).Thisfunctioncanbeusedin
conjuctionwithüsetgraphmodeÇtoswitchbetweentext
andgraphicmodes.
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....]0110
__________________________________________________________________
üsectorÇ Draw and fills an elliptical pie slice
__________________________________________________________________
üSyntaxÇ void far sector(int äxÇ, int äyÇ,
int ästangleÇ, int äendangleÇ,
int äxradiusÇ, int äyradiusÇ );
ä
üPurposesectorÇdrawsanellipticalpieslicelocatedat
(äxÇ,äyÇ)withahorizontalradiusofäxradiusÇanda
verticalradiusofäyradiusÇ.Thesectorisdrawn
fromästangleÇandendsatäendangleÇ.Thesectoris
filledwiththecurrentfillstyleandcolour,then
outlinedwiththecurrentlinecolour,styleand
thickness.
ä
stangleÇandäendangleÇaregivenindegrees.The
angleismeasuredcounterclockwisewith0degrees
beingat3o'clock.
__________________________________________________________________
üsetactivepageÇSets active page for graphics output
__________________________________________________________________
üSyntaxÇ void far setactivepage(int äpageÇ);
üPurposesetactivepageÇhasnoeffectontheST/STe/TT
implementationsinceonlyONEpageisused.IfäpageÇ
isnon-zeroügraphresultÇreturnsägrErrorÇ.
__________________________________________________________________
üsetallpaletteÇ Changes all palette colours as specified
__________________________________________________________________
üSyntaxÇ void far setallpalette(struct palettetype
Ç far ä*paletteÇ);
üPurposesetallpaletteÇsetsthecolourpalettetothecolour
valuescontainedintheüpalettetypeÇstructure
pointedtobyäpaletteÇ.
üpalettetypeÇasthefollowingstructuredefinein
graphics.h.
#defineMAXCOLORS15
structpalettetype{
unsignedcharsize;
signedcharcolors[MAXCOLORS+1];
};
äsizeÇindicateshowmanyentriesintheäcolorsÇarray
exist.äcolorsÇholdsthecolornumbers.
__________________________________________________________________
üsetaspectratioÇ Changes the default aspect ratio correction factor
__________________________________________________________________
üSyntaxÇ void far setaspectratio(int äxaspÇ, int äyaspÇ);
üPurposesetaspectratioÇhasnotbeenimplementedsincethe
VDIroutinescorrectlyhandletheaspectratio.The
purposeofüsetaspectratioÇforthePCistocorrect
theaspectratioforaddongraphicsdrivers.
ügraphresultÇwillreturnägrNotImplementedÇif
üsetaspectratioÇiscalled.
__________________________________________________________________
ü
setbkcolorÇSetsthecurrentbackgroundcolourusingthe
palette
__________________________________________________________________
üSyntaxÇ void far setbkcolor(int äcolorÇ)ü;
Ç
üPurposesetbkcolorÇsetsthebackgroundcolor(pen0)to
äcolorÇ.
Number Colour
------------------------
0 BLACK
1 BLUE
2 GREEN
3 CYAN
4 RED
5 MAGENTA
6 BROWN
7 LIGHTGRAY
8 DARKGRAY
Ç 9 LIGHTBLUE
10 LIGHTGREEN
11 LIGHTCYAN
12 LIGHTRED
13 LIGHTMAGENTA
14 YELLOW
15 WHITE
__________________________________________________________________
üsetcolorÇ Sets the current drawing colour using the palette
__________________________________________________________________
üSyntaxÇ void far setcolor(int äcolorÇ);
üPurposesetcolorÇsetsthecurrentdrawingcolourtoäcolorÇ.
äcolorÇcanrangefrom0toügetmaxcolorÇ.See
üsetbkcolorÇ.
üsetcolorÇalsoeffectsthecolourofgraphictext
drawnonthescreen.
__________________________________________________________________
üsetfillpatternÇ Selects a user-defined fill pattern
__________________________________________________________________
üSyntaxÇ void far setfillpattern(char far ä*upatternÇ,
int äcolorÇ);
üPurposesetfillpatternÇallowstheprogrammertodefineuser
definedfillpatternsthatwillbeusedbygraphic
functionsthatfillshapes.Thepatternisdefined
with8bytes,pointedtobyäupatternÇ,eachbyte
representsthebitpatternperrow.See
ügetfillpatternÇformoreinformation.Thefill
colourissettoäcolor.
Ç
__________________________________________________________________
üsetfillstyleÇ Sets the fill pattern and colour
__________________________________________________________________
üSyntaxÇ void far setfillstyle(int äpatternÇ, int äcolorÇ);
üPurposesetfillstyleÇsetsthefillpatterntoäpatternÇ,one
ofthepredefinedfillpatternsandsetsthefill
colourtoäcolorÇ.üÇSeeügetfillsettingsÇformore
information.
DonotuseaäpatternÇofUSER_FILLwith
üsetfillstyleÇ,useüsetfillpatternÇtodefineanduse
auserdefinedfillpattern
__________________________________________________________________
üsetgraphbufsize
Ç Changes the size of the internal graphics buffer
__________________________________________________________________
üSyntax Çunsigned far setgraphbufsize(unsigned äbufsizeÇ);
üPurposesetgraphbufsizeÇhasnotbeenimplementedinthis
graphicslibrary.ügraphresultÇwillreporta
ägrNotImplementedÇerror.
__________________________________________________________________
üsetgraphmodeÇ Sets the system to graphics mode, clears the screen
__________________________________________________________________
üSyntax Çvoid far setgraphmode(int ämodeÇ);
üPurposesetgraphmodeÇreturnsthescreentographicsmode
andresetsallgraphicssettingstotheirdefault
values.Thisfunctioncanbeusedinconjuction
withürestorecrtmodeÇtoswitchbetweentextand
graphicmodes.
__________________________________________________________________
üsetlinestyleÇ Sets the current line width and style
__________________________________________________________________
üSyntaxÇ void far setlinestyle(int älinestyleÇ,
unsigned äupatternÇ,
int äthicknessÇ);
üPurposesetlinestyleÇsetsthecurrentlinestyleto
älinestyleÇandthicknesstoäthicknessÇ.See
ügetlinesettingsÇformoreinformationabout
älinestyleÇvalues.
Auser-definedlinestylecanalsobespecifiedby
requestingaUSERBIT_LINEinasälinestyleÇand
specifyingthebitpatterninäupatternÇ.Ifauser
definedpatternisnotwanted,äupatternÇmuststill
beprovided,butissimplyignored.
êNote:ÇtheälinestyleÇsettingisonlyeffectwhenthe
äthicknessÇis1.
__________________________________________________________________
üsetpaletteÇ Changes one palette colour
__________________________________________________________________
üSyntaxÇ void far setpalette(int äcolornumÇ, int äcolorÇ);
üPurposesetpaletteÇisnotimplementedsinceüsetrgbpaletteÇ
willhandleallchangestothecolourpalette.
ügraphresultÇwillreturnägrNotImplementedÇ.
__________________________________________________________________
üsetrgbpaletteÇ Allows user to define colour for the IBM8514
__________________________________________________________________
üSyntaxÇ void far setrgbpalette(int äcolornumÇ,
int äredÇ, int ägreenÇ,
int äblueÇ);
üPurposesetrgbpaletteÇsetstheäcolornumÇentryinthecolour
palettetotheäredÇ,ägreenÇ,äblueÇvalues.Onthe
ST/STethesevaluescanrangefrom0to7and0to
15ontheTT.
TheTTandthirdpartygraphiccardsarecapableof
morethan16coloursonthescreen.üsetrgbpaletteÇ
canchangeanyofthemandthefirstsixteen
entriesinthepalettearesettothedefaultTurbo
CcoloursshowninüsetbkcolorÇ.
__________________________________________________________________
üsettextjustifyÇ Sets text justification for graphics functions
__________________________________________________________________
üSyntaxÇ void far settextjustify(int ähorizÇ, int ävertÇ);
üPurposesettextjustifyÇdetermineshowtextisdisplayed
withreferencetothecurrentposition(CP).
ätext_just
Ç constant value
--------------------- LEFT_TEXT
0
CENTER_TEXT 1
RIGHT_TEXT 2
BOTTOM_TEXT 0
CENTER_TEXT 1
TOP_TEXT 2
__________________________________________________________________
üsettextstyleÇSetsthecurrenttextcharacteristicsforgraphic
output
__________________________________________________________________
üSyntaxÇ void far settextstyle(int äfontÇ, int ädirectionÇ,
int ächarsizeÇ);
üPurposesettextstyleÇsetsthetextäfontÇ,ädirectionÇ,and
ächarsizeÇthatwillbeusedbyüouttextÇand
üouttextxyÇ.
äfontÇcanhaveseveralvalues:
value result
--------------------- 0x00 sytem
font
Ç 0x01 boldfont
0x02 grayedfont
0x04 italicizedfont
0x08 underlinedfont
0x10 outlinedfont
TheseäfontÇvaluescanbeANDedtogethertocombine
thefonts.Forexample,ifäfontÇis0x14thefontis
shownitalicizedandoutlied.
ächarsizeÇdiffersfromTurboCisthatitrepresents
thefontpointsizeandnotamagnificationfactor.
Thesystemfontcanbedisplayedinsixsizes:
value pointsize
-------------------- 0 8
1 9
2 10
3 16
4 18
5andup 20
9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....]0110
__________________________________________________________________
üsetusercharsize
ÇAllowstheusertovarythecharacterwidthand
heightforfonts
__________________________________________________________________
üSyntaxÇ void far setusercharsize(int ämultxÇ, int ädivxÇ,
int ämultyÇ, int ädivyÇ);
üPurposesetusercharsizeÇhasnotbeenimplementedinthis
graphicslibrary.ügraphresultÇwillreporta
ägrNotImplementedÇerror.
__________________________________________________________________
üsetviewportÇ Sets the current viewport for graphics output
__________________________________________________________________
üSyntaxÇ void far setviewport(int äleftÇ, int ätopÇ,
int ärightÇ, int äbottomÇ,
int äclipÇ);
üPurposesetviewportÇdefinesaportionofthescreenthat
willbecomethenewviewportforgraphicsoutput.
Theupperleftcorner(äleftÇ,ätopÇ)andlowerright
corner(ärightÇ,äbottomÇ)aregiveninabsolutescreen
coordinates.Thecurrentposition(CP)ismovedto
(0,0)andcorrespondstotheupperleftcorner.
äclipÇdetermineswhetherornotgraphicoperations
areclippedattheviewportsperimeter.IfäclipÇis
nonzero,allgraphicoperationswillbeclipped.
Ç
êNote:Çallgraphicoperationsareviewportrelative.
WhenüsetviewportÇisused,(0,0)willmovetothe
upperleftcorner(äleftÇ,ätopÇ)ofthenewviewport.
__________________________________________________________________
üsetvisualpageÇ Sets the visual graphics page number
__________________________________________________________________
üSyntaxÇ void far setvisualpage(int äpageÇ);
üPurposesetvisualpageÇhasnoeffectontheST/STe/TT
implementationsinceonlyONEpageisused.IfäpageÇ
isnon-zeroügraphresultÇreturnsägrErrorÇ.
__________________________________________________________________
üsetwritemodeÇSetsthewritingmodeforlinedrawing
__________________________________________________________________
üSyntaxÇ void far setwritemode(int ämodeÇ);
üPurposesetwritemodeÇeffectshowtheoutputofthegraphic
functionsappearsusingbinaryoperations.
COPY_PUTsimplycopiesthenewoutputtothescreen
andXOR_PUTperformsanexclusiveORoperation
betweentheoutputandtheexistingscreenimage.
AsecondXOR_PUTofthesamegraphicoutputwill
erasetheresultofthefirstone.
__________________________________________________________________
ütextheightÇReturns the height of a string in pixels
__________________________________________________________________
üSyntaxÇ int far textheight(char far ä*textstringÇ);
üPurpose textheightÇdeterminestheheightofätextstringÇ,in
pixels,ofthecurrenttextfont.
Thisfunctionisveryusefulforcreating
resolutionindependentprogramsthatusetext.Use
ütextheightÇratherthandoingthecalculation
manually.
__________________________________________________________________
ütextwidthÇ Returns the width of a string in pixels
__________________________________________________________________
üSyntaxÇ int far textwidth(char far ä*textstringÇ);
üPurposetextwidthÇdeterminesthewidthofätextstringÇ,in
pixels,ofthecurrenttextfont.
Thisfunctionisveryusefulforcreating
Çresolutionindependentprogramsthatusetext.Use
ütextwidthÇratherthandoingthecalculation
manually.