[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

3989.0. "Display Transparent Text ???" by SIOG::OBRIEN_PAUL (Point and Grunt) Fri Aug 03 1990 14:38

    I'm doing some graphics programming in AmigaBASIC (I have not yet
    got my brain around C) and I have a simple problem I need to solve.
    
    When I print text on the screen, AmigaBASIC always uses the current
    colour setting for both foreground AND background; ie: each character
    is displayed in foreground colour on a rectangle filled with the
    background colour. So if I try to display text over a graphic, a
    rectangular region of the graphic is destroyed.
    
    What library routine do I need to call to make the character background
    transparent?
    
    Also, when I switch to a character font other than TOPAZ.8 the <X
    key wont delete the previous character properly, it deletes a rectangle
    whose size is appropiate for TOPAZ.8 but too small for the larger
    fonts. Is there some way to get around this?
    
    If there is anyone else out there doing stuff in AmigaBASIC, I would
    like to hear from you (by Mail) to compare notes etc.
    
    Regards	Paul O'Brien @DBO	DUB01::OBRIEN_PAUL DTN:827-2476
T.RTitleUserPersonal
Name
DateLines
3989.1WJG::GUINEAUFri Aug 03 1990 14:486
Well, from C those are modes known as JAM1 and JAM2. You are writing in
JAM2 mode (force both FG anf BG) and need to get into JAM1 (force FG only).

Not sure how you do that in BASIC...

john
3989.2The C code will doSIOG::OBRIEN_PAULPoint and GruntFri Aug 03 1990 14:5410
    
    Its much the same in BASIC, I call the library routine and make
    sure I pass the parameters in the correct format. So if you could
    tell me what you do in C to switch from JAM2 to JAM1 and what data
    types are used for arguments and return values I can probably translate
    it into BASIC.
    
    (Thanks for the fast response)
    
    pob
3989.3WJG::GUINEAUFri Aug 03 1990 15:1536
here is some code from CM.C (wjg::amiga:cm.arc)


	.
	.
	.

/* pointer text for ShowMouse() */
char    pbuf[80];
struct IntuiText pos_txt = {
   WHTPEN,BLKPEN,                       /* FrontPen, BackPen */
   JAM2,                                /* DrawMode */
   7,2,                                 /* LeftEdge, TopEdge */
   &TxtAt_Plain,                        /* TextAttr */
   pbuf,                                /* IText */
   NULL                                 /* NextText */
};

	.
	.
	.


ShowMouse(x,y)
SHORT x,y;
{

if(x<0||y<0) return(0);

sprintf(pbuf,"  %.3e , %.3e",
   (double)(x)*SI.ds,(double)(w->GZZHeight-y+1)*SI.ds);
PrintIText(prp,&pos_txt,0,0);

return(0);
}

3989.4SetDrMode?TLE::RMEYERSRandy MeyersFri Aug 03 1990 21:4616
Reply .3 shows an Intuition call that establishes the proper
graphics modes and prints the text.  The Intuition call could be
replaced by "more primitive" calls to the graphics library.

The graphics library has the idea of a foreground pen, background
pen, and drawing mode.  Once you establish the mode, it affects
all the graphics calls (including the text output call) until
you change it.

Depending on your program and what BASIC might be doing behind your
back, you my find it easier to call the graphics library routine
that sets the mode: setting the mode may have the proper effect
on the current way you output text.

The routine you want has some name like "Set Draw Mode," but
I think the name is spelled something like SetDrMode.
3989.5Get "Amiga Tricks and Tips"RGB::ROSESat Aug 04 1990 02:2825
    	The Abacus book "Amiga Tricks and Tips" tells how to access library
    functions from BASIC. If you want to extend your capability within
    BASIC, I recommend you get it. Then you will want the ROM Kernal
    Manual. Then you will want a C compiler...
    
    	At the beginning of the program, put in a statement
    
    LIBRARY "graphics.library"
    
    	When you want to set the drawmode put in the statement
    
    SetDrMd(WINDOW(8),Mode)
    
    	Where Mode =
    
    0 = jam1 (transparent)
    1 = jam2 (writes foreground and background)
    2 = inversevid (jam2 with colors reversed)
    3 = complement (jam1 with color register 0 complemented)
    
    	At the end of your program include the statement
    
    LIBRARY CLOSE
    
    
3989.6SetDrMd works fine!SIOG::OBRIEN_PAULPoint and GruntTue Aug 07 1990 09:5016
    SetDrMd(WINDOW(8),0) works perfectly.
    
    I've gone and bought Amiga Tricks & Tips, full of useful stuff but
    (like all Abacus books) its use of English is very bad. I presume it
    was written in German by someone who knew what they were talking about
    but was then translated into English by a non-techie garbling some of
    the meaning.
    
    Still have not solved the problem of incomplete deletion of characters
    when using large fonts; The only workaround that seems robust is to
    redisplay the entire line after blanking the region with a rectangle.
    But that destroys my background graphic -- back to square 1!
    
    Many thanks for your replies,
    
    pob
3989.7They aren't perfect, but the get the job doneRGB::ROSETue Aug 07 1990 12:456
    	Yes, Abacus books tend to have a lot of bad grammer and
    occasionally some programming errors. But I still find them useful.
    I have found at least one case in the advanced C book where their
    example code evokes the GURU. It's a good idea to have the ROM Kernal
    Manual as a back up reference. Especially when you get around to
    trying out C.