[comp.lang.c] Turbo C graphics library

tre@cci632.UUCP (Todd Engle) (04/07/90)

	Dear Turbo C wizards:

	I would like to find out if one can have a visible cursor in a 
graphics window.  The Turbo C manual states that the cursor is
invisible at the 'CP' (Current Position?) in graphics mode, but I could not find where to 'manually' turn it on.  I would like to make a user aware 
of his/her screen location (i.e for prompting).

Also, is it possible to have reverse video in graphics mode in Turbo C?  I know
that is it is possible in text mode, but I have been unable to find an answer
for graphics.


Thanks in advance!

Todd R. Engle
 

pga-grd@cs.rit.edu (04/09/90)

In article <35769@cci632.UUCP> tre@cci632.UUCP (Todd Engle) writes:
>
>	Dear Turbo C wizards:
>
>	I would like to find out if one can have a visible cursor in a 
>graphics window.  The Turbo C manual states that the cursor is
>invisible at the 'CP' (Current Position?) in graphics mode, but I could not find where to 'manually' turn it on.  I would like to make a user aware 
>of his/her screen location (i.e for prompting).

  I don't have my Turbo C manual handy since I'm sitting in the middle of a
UNIX lab right now, but I have a suggestion.  There is a library function
that allows you to place an arbitrarily-sized image on the screen.  You could
then write code that displays a cursor-sized block of pixels at the CP.  Sorry
that I couldn't be more specific about this function, but if you spend a few
moments looking through the manual, I think you'll find what I'm talking about.

>Also, is it possible to have reverse video in graphics mode in Turbo C?  I know
>that is it is possible in text mode, but I have been unable to find an answer
>for graphics.
>

  This might require some extra effort, since one way to do it is to display
your own bit-mapped characters.  In that way, you could control reverse video
in a straightforward manner.

[-----------------------------------------------------------------------------]
[ Jack D. Unrue              | "Alert is alive and alive is alert..."         ]
[ ultb::"jdu4855@cs.rit.edu" |   - a thief's credo in Sanctuary               ]
[-----------------------------------------------------------------------------]

tjr@cbnewsc.ATT.COM (thomas.j.roberts) (04/09/90)

From article <35769@cci632.UUCP>, by tre@cci632.UUCP (Todd Engle):
> 	I would like to find out if one can have a visible cursor in a 
> graphics window...
> Also, is it possible to have reverse video in graphics mode in Turbo C?

A cursor CAN be displayed in graphics mode, but you must do it manually.
On most PCs, printf (etc.) can be used in graphics mode, and will work
as expected (chars 0-127 only), storing the pixel representation of the
characters onto the graphics screen (both background and foreground).
If you use a direct BIOS call to display with the BLINK attribute, then
the foreground pixels of the character will be XORed onto the display.
Thus, you can display an underscore (_) as a cursor, using XOR mode,
and move it for every character typed (must use getch() or getche(), or
a similar BIOS call, cannot do a buffered read). Getting the cursor to
blink is a real challenge, as you must do the timing yourself, in parallel
with the getch(); if you are also looking for mouse events as well, it can
get pretty complicated, so you will probably need to go to an input-event
design with a single input-event queue into which TIMER, KEYBOARD, and
MOUSE events are all placed. Good Luck.

I have never tried using TC's TEXTMODE routines (cprintf, gotoxy(), etc.)
in GRAPHICS mode.

Tom Roberts
att!ihlpl!tjrob

mccaugh@sunb6.cs.uiuc.edu (04/11/90)

 I don't know that there is a notion of "cursor" (visible or otherwise) in
 graphics mode, as there is in text mode. Graphics mode is more "primitive'
 in that (without primitives) you have to selectively turn on pixels yourself.
 So to get a "visible cursor" at the current position, you would want to turn
 on 1 or more pixels in that vicinity.
 As to "reverse video" in graphics mode, I don't believe that exists (at least
 in a direct way) for CGA or EGA, anyway.

knutta@lise.unit.no (Knut Alfredsen) (02/12/91)

 I am looking for a graphics library for Turbo C/C++ which is on a higher level than the graphics included. I hope to find routines for automatic scaling and drawing of axes, text and labeling functions and routines for drawing of XY graphs and bargraphs.
I would also be interested in routines for 3D graphs and surfaces and topograhic charts

Knut Alfredsen *knutta@lise.unit.no*

Division of Hydraulic Engineering
Norwegian Institute of Technology