home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / intuition / printitext.c < prev    next >
C/C++ Source or Header  |  1997-01-27  |  3KB  |  143 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: printitext.c,v 1.8 1997/01/27 00:36:42 ldp Exp $
  4.     $Log: printitext.c,v $
  5.     Revision 1.8  1997/01/27 00:36:42  ldp
  6.     Polish
  7.  
  8.     Revision 1.7  1996/12/10 14:00:07  aros
  9.     Moved #include into first column to allow makedepend to see it.
  10.  
  11.     Revision 1.6  1996/11/08 11:28:04  aros
  12.     All OS function use now Amiga types
  13.  
  14.     Moved intuition-driver protos to intuition_intern.h
  15.  
  16.     Revision 1.5  1996/10/24 15:51:23  aros
  17.     Use the official AROS macros over the __AROS versions.
  18.  
  19.     Revision 1.4  1996/10/21 17:07:08  aros
  20.     Restored wrong font
  21.  
  22.     Revision 1.3  1996/08/29 15:13:32  digulla
  23.     Wrote code
  24.  
  25.     Revision 1.2  1996/08/29 13:57:37  digulla
  26.     Commented
  27.     Moved common code from driver to Intuition
  28.  
  29.     Revision 1.1  1996/08/23 17:28:18  digulla
  30.     Several new functions; some still empty.
  31.  
  32.  
  33.     Desc:
  34.     Lang: english
  35. */
  36. #include "intuition_intern.h"
  37. #include <string.h>
  38. #include <proto/graphics.h>
  39.  
  40. /*****************************************************************************
  41.  
  42.     NAME */
  43. #include <graphics/rastport.h>
  44. #include <intuition/intuition.h>
  45. #include <proto/intuition.h>
  46.  
  47.     AROS_LH4(void, PrintIText,
  48.  
  49. /*  SYNOPSIS */
  50.     AROS_LHA(struct RastPort  *, rp, A0),
  51.     AROS_LHA(struct IntuiText *, iText, A1),
  52.     AROS_LHA(LONG              , leftOffset, D0),
  53.     AROS_LHA(LONG              , topOffset, D1),
  54.  
  55. /*  LOCATION */
  56.     struct IntuitionBase *, IntuitionBase, 36, Intuition)
  57.  
  58. /*  FUNCTION
  59.     Render an IntuiText in the specified RastPort with the
  60.     specified offset.
  61.  
  62.     INPUTS
  63.     rp - Draw into this RastPort
  64.     iText - Render this text
  65.     leftOffset, topOffset - Starting-Point. All coordinates in the
  66.         IntuiText structures are relative to this point.
  67.  
  68.     RESULT
  69.     None.
  70.  
  71.     NOTES
  72.  
  73.     EXAMPLE
  74.  
  75.     BUGS
  76.  
  77.     SEE ALSO
  78.  
  79.     INTERNALS
  80.  
  81.     HISTORY
  82.     29-10-95    digulla automatically created from
  83.                 intuition_lib.fd and clib/intuition_protos.h
  84.  
  85. *****************************************************************************/
  86. {
  87.     AROS_LIBFUNC_INIT
  88.     AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  89.     ULONG  apen;
  90.     ULONG  bpen;
  91.     ULONG  drmd;
  92.     struct TextFont * font;
  93.     struct TextFont * newfont;
  94.  
  95.     /* Store important variables of the RastPort */
  96.     apen = GetAPen (rp);
  97.     bpen = GetBPen (rp);
  98.     drmd = GetDrMd (rp);
  99.  
  100.     font = rp->Font;
  101.  
  102.     /* For all borders... */
  103.     for ( ; iText; iText=iText->NextText)
  104.     {
  105.     /* Change RastPort to the colors/mode specified */
  106.     SetAPen (rp, iText->FrontPen);
  107.     SetBPen (rp, iText->BackPen);
  108.     SetDrMd (rp, iText->DrawMode);
  109.  
  110.     if (iText->ITextFont)
  111.     {
  112.         newfont = OpenFont (iText->ITextFont);
  113.  
  114.         if (newfont)
  115.         SetFont (rp, newfont);
  116.     }
  117.  
  118.     /* Move to initial position */
  119.     Move (rp
  120.         , iText->LeftEdge + leftOffset
  121.         , iText->TopEdge + topOffset
  122.     );
  123.     Text (rp, iText->IText, strlen (iText->IText));
  124.  
  125.     if (iText->ITextFont)
  126.     {
  127.         if (newfont)
  128.         {
  129.         SetFont (rp, font);
  130.         CloseFont (newfont);
  131.         }
  132.     }
  133.     }
  134.  
  135.     /* Restore RastPort */
  136.     SetAPen (rp, apen);
  137.     SetBPen (rp, bpen);
  138.     SetDrMd (rp, drmd);
  139.     SetFont (rp, font);
  140.  
  141.     AROS_LIBFUNC_EXIT
  142. } /* PrintIText */
  143.