New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / intuition / printitext.c
blob9d1c8bd661bf7c4c17e256a1643af10435289359
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <string.h>
8 #include <proto/graphics.h>
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <graphics/rastport.h>
15 #include <graphics/rpattr.h>
16 #include <intuition/intuition.h>
17 #include <proto/intuition.h>
19 AROS_LH4(void, PrintIText,
21 /* SYNOPSIS */
22 AROS_LHA(struct RastPort *, rp, A0),
23 AROS_LHA(struct IntuiText *, iText, A1),
24 AROS_LHA(LONG , leftOffset, D0),
25 AROS_LHA(LONG , topOffset, D1),
27 /* LOCATION */
28 struct IntuitionBase *, IntuitionBase, 36, Intuition)
30 /* FUNCTION
31 Render an IntuiText in the specified RastPort with the
32 specified offset.
34 INPUTS
35 rp - Draw into this RastPort
36 iText - Render this text
37 leftOffset, topOffset - Starting-Point. All coordinates in the
38 IntuiText structures are relative to this point.
40 RESULT
41 None.
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 HISTORY
54 29-10-95 digulla automatically created from
55 intuition_lib.fd and clib/intuition_protos.h
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
60 AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
62 int_PrintIText(rp, iText, leftOffset, topOffset, FALSE, IntuitionBase);
64 AROS_LIBFUNC_EXIT
66 } /* PrintIText */
68 void int_PrintIText(struct RastPort * rp, struct IntuiText * iText,
69 LONG leftOffset, LONG topOffset, BOOL ignore_attributes,
70 struct IntuitionBase *IntuitionBase)
73 IPTR apen;
74 IPTR bpen;
75 IPTR drmd;
76 IPTR penmode;
77 UBYTE style;
78 struct TextFont *font;
79 struct TextFont *newfont = NULL;
81 EXTENDWORD(leftOffset);
82 EXTENDWORD(topOffset);
84 DEBUG_PRINTITEXT(dprintf("int_PrintIText: rp %p text %p Left %ld Top %ld IgnoreAttrs %ld\n",
85 rp, iText, leftOffset, topOffset, ignore_attributes));
87 /* Store important variables of the RastPort */
88 #ifdef __MORPHOS__
89 GetRPAttrs(rp,RPTAG_PenMode,(IPTR)&penmode,RPTAG_APen,(IPTR)&apen,
90 RPTAG_BPen,(IPTR)&bpen,RPTAG_DrMd,(IPTR)&drmd,TAG_DONE);
91 #else
92 GetRPAttrs(rp,RPTAG_APen,(IPTR)&apen,
93 RPTAG_BPen,(IPTR)&bpen,RPTAG_DrMd,(IPTR)&drmd,TAG_DONE);
94 #endif
96 font = rp->Font;
97 style = rp->AlgoStyle;
99 /* For all borders... */
100 for ( ; iText; iText = iText->NextText)
102 if (!ignore_attributes)
104 /* Change RastPort to the colors/mode specified */
105 SetABPenDrMd (rp, iText->FrontPen, iText->BackPen, iText->DrawMode);
108 if (iText->ITextFont)
110 newfont = OpenFont (iText->ITextFont);
112 if (newfont)
113 SetFont (rp, newfont);
115 SetSoftStyle(rp, iText->ITextFont->ta_Style, AskSoftStyle(rp));
118 /* Move to initial position */
119 Move (rp
120 , iText->LeftEdge + leftOffset
121 , iText->TopEdge + topOffset + rp->Font->tf_Baseline
123 Text (rp, iText->IText, strlen (iText->IText));
125 if (iText->ITextFont)
127 if (newfont)
129 SetFont (rp, font);
130 CloseFont (newfont);
135 /* Restore RastPort */
136 #ifdef __MORPHOS__
137 SetRPAttrs(rp,RPTAG_APen,apen,RPTAG_BPen,bpen,RPTAG_DrMd,drmd,RPTAG_PenMode,penmode,TAG_DONE);
138 #else
139 SetRPAttrs(rp,RPTAG_APen,apen,RPTAG_BPen,bpen,RPTAG_DrMd,drmd,TAG_DONE);
140 #endif
141 SetFont (rp, font);
142 SetSoftStyle (rp, style, AskSoftStyle(rp));