2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/graphics.h>
8 #include <proto/layers.h>
9 #include <graphics/rpattr.h>
10 #include "intuition_intern.h"
12 /*****************************************************************************
15 #include <graphics/rastport.h>
16 #include <intuition/intuition.h>
17 #include <proto/intuition.h>
19 AROS_LH4(void, DrawBorder
,
22 AROS_LHA(struct RastPort
*, rp
, A0
),
23 AROS_LHA(struct Border
*, border
, A1
),
24 AROS_LHA(LONG
, leftOffset
, D0
),
25 AROS_LHA(LONG
, topOffset
, D1
),
28 struct IntuitionBase
*, IntuitionBase
, 18, Intuition
)
31 Draws one or more borders in the specified RastPort. Rendering
32 will start at the position which you get when you add the offsets
33 leftOffset and topOffset to the LeftEdge and TopEdge specified
34 in the Border structure. All coordinates are relative to that point.
37 rp - The RastPort to render into
38 border - Information what and how to render
39 leftOffset, topOffset - Initial starting position
47 // Draw a house with one stroke
48 // The drawing starts at the lower left edge
65 8, // Number of pairs in XY
67 NULL // No next border
70 // Render the house with the bottom left edge at 150, 50
71 DrawBorder (rp, &demo, 50, -50);
80 29-10-95 digulla automatically created from
81 intuition_lib.fd and clib/intuition_protos.h
83 *****************************************************************************/
87 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
88 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
100 EXTENDWORD(leftOffset
);EXTENDWORD(topOffset
);
102 DEBUG_DRAWBORDER(dprintf("DrawBorder: rp %p border %p Left %ld Top %ld\n",
103 rp
, border
, leftOffset
, topOffset
));
108 if (rp
->Layer
) LockLayer(0,rp
->Layer
);
110 /* Store important variables of the RastPort */
112 GetRPAttrs(rp
, RPTAG_PenMode
, &penmode
, RPTAG_APen
, &apen
,
113 RPTAG_BPen
, &bpen
, RPTAG_DrMd
, &drmd
, TAG_DONE
);
115 GetRPAttrs(rp
, RPTAG_APen
, &apen
,
116 RPTAG_BPen
, &bpen
, RPTAG_DrMd
, &drmd
, TAG_DONE
);
119 /* For all borders... */
120 for ( ; border
; border
= border
->NextBorder
)
122 /* Change RastPort to the colors/mode specified */
123 SetAPen (rp
, border
->FrontPen
);
124 SetBPen (rp
, border
->BackPen
);
125 SetDrMd (rp
, border
->DrawMode
);
127 /* Get base coords */
129 x
= border
->LeftEdge
+ leftOffset
;
130 y
= border
->TopEdge
+ topOffset
;
132 /* Start of vector offsets */
135 for (t
= 0; t
< border
->Count
; t
++)
137 /* Add vector offset to current position */
143 Move (rp
, x
+ xoff
, y
+ yoff
);
148 Draw (rp
, x
+ xoff
, y
+ yoff
);
152 } /* for ( ; border; border = border->NextBorder) */
154 /* Restore RastPort */
156 SetRPAttrs(rp
,RPTAG_APen
,apen
,RPTAG_BPen
,bpen
,RPTAG_DrMd
,drmd
,RPTAG_PenMode
,penmode
,TAG_DONE
);
158 SetRPAttrs(rp
,RPTAG_APen
,apen
,RPTAG_BPen
,bpen
,RPTAG_DrMd
,drmd
,TAG_DONE
);
161 if (rp
->Layer
) UnlockLayer(rp
->Layer
);