Experiment:
[AROS-Contrib.git] / bgui / gfx.c
blobe06723cb4c67c2fbb7658579f897cbe3434ed5ab
1 /*
2 * @(#) $Header$
4 * BGUI library
5 * gfx.c
7 * (C) Copyright 1998 Manuel Lemos.
8 * (C) Copyright 1996-1997 Ian J. Einman.
9 * (C) Copyright 1993-1996 Jaba Development.
10 * (C) Copyright 1993-1996 Jan van den Baard.
11 * All Rights Reserved.
13 * $Log$
14 * Revision 42.6 2004/06/16 20:16:48 verhaegs
15 * Use METHODPROTO, METHOD_END and REGFUNCPROTOn where needed.
17 * Revision 42.5 2003/01/18 19:09:56 chodorowski
18 * Instead of using the _AROS or __AROS preprocessor symbols, use __AROS__.
20 * Revision 42.4 2000/08/09 11:45:57 chodorowski
21 * Removed a lot of #ifdefs that disabled the AROS_LIB* macros when not building on AROS. This is now handled in contrib/bgui/include/bgui_compilerspecific.h.
23 * Revision 42.3 2000/05/29 00:40:23 bergers
24 * Update to compile with AROS now. Should also still compile with SASC etc since I only made changes that test the define __AROS__. The compilation is still very noisy but it does the trick for the main directory. Maybe members of the BGUI team should also have a look at the compiler warnings because some could also cause problems on other systems... (Comparison always TRUE due to datatype (or something like that)). And please compile it on an Amiga to see whether it still works... Thanks.
26 * Revision 42.2 2000/05/15 19:27:01 stegerg
27 * another hundreds of REG() macro replacements in func headers/protos.
29 * Revision 42.1 2000/05/14 23:32:47 stegerg
30 * changed over 200 function headers which all use register
31 * parameters (oh boy ...), because the simple REG() macro
32 * doesn't work with AROS. And there are still hundreds
33 * of headers left to be fixed :(
35 * Many of these functions would also work with stack
36 * params, but since i have fixed every single one
37 * I encountered up to now, I guess will have to do
38 * the same for the rest.
40 * Revision 42.0 2000/05/09 22:09:05 mlemos
41 * Bumped to revision 42.0 before handing BGUI to AROS team
43 * Revision 41.11 2000/05/09 19:54:20 mlemos
44 * Merged with the branch Manuel_Lemos_fixes.
46 * Revision 41.10.2.2 1999/07/04 05:16:05 mlemos
47 * Added a debuging version of the function BRectFill.
49 * Revision 41.10.2.1 1998/07/05 19:26:58 mlemos
50 * Added debugging code to trap invalid RectFill calls.
52 * Revision 41.10 1998/02/25 21:12:07 mlemos
53 * Bumping to 41.10
55 * Revision 1.1 1998/02/25 17:08:24 mlemos
56 * Ian sources
61 #include "include/classdefs.h"
64 * Default drawinfo pens.
66 makeproto UWORD DefDriPens[12] = { 0, 1, 1, 2, 1, 3, 1, 0, 2, 1, 2, 1 };
69 * Disabled pattern.
71 STATIC UWORD DisPat[2] = { 0x2222, 0x8888 };
74 * Calculate the text width.
76 //makeproto ASM ULONG TextWidth(REG(a1) struct RastPort *rp, REG(a0) UBYTE *text)
77 makeproto ASM REGFUNC2(ULONG, TextWidth,
78 REGPARAM(A1, struct RastPort *, rp),
79 REGPARAM(A0, UBYTE *, text))
81 return TextWidthNum(rp, text, strlen(text));
83 REGFUNC_END
85 //makeproto ASM ULONG TextWidthNum(REG(a1) struct RastPort *rp, REG(a0) UBYTE *text, REG(d0) ULONG len)
86 makeproto ASM REGFUNC3(ULONG, TextWidthNum,
87 REGPARAM(A1, struct RastPort *, rp),
88 REGPARAM(A0, UBYTE *, text),
89 REGPARAM(D0, ULONG, len))
91 struct TextExtent te;
92 ULONG extent;
95 * Call TextExtent to find out the text width.
97 TextExtent(rp, text, len, &te);
100 * Figure out extent width.
102 extent = te.te_Extent.MaxX - te.te_Extent.MinX + 1;
105 * Return which ever is bigger.. extent or te.te_Width.
107 return( extent /*( extent > te.te_Width ) ? extent : te.te_Width */);
109 REGFUNC_END
112 * Disable the given area.
114 //makeproto ASM VOID BDisableBox(REG(a0) struct BaseInfo *bi, REG(a1) struct IBox *area)
115 makeproto ASM REGFUNC2(VOID, BDisableBox,
116 REGPARAM(A0, struct BaseInfo *, bi),
117 REGPARAM(A1, struct IBox *, area))
119 BSetAfPt(bi, DisPat, 1);
120 BSetDrMd(bi, JAM1);
121 BSetDPenA(bi, SHADOWPEN);
122 BBoxFillA(bi, area);
123 BClearAfPt(bi);
125 REGFUNC_END
128 * Render a frame/separator title.
130 makeproto VOID RenderTitle(Object *title, struct BaseInfo *bi, WORD l, WORD t, WORD w, BOOL highlight, BOOL center, UWORD place)
132 struct IBox box;
134 w -= 24;
135 l += 12;
137 if (w > 8)
139 DoMethod(title, TEXTM_DIMENSIONS, bi->bi_RPort, &box.Width, &box.Height);
142 * Figure out where to render.
144 if (box.Width > w) box.Width = w;
146 switch (place)
148 case 1:
149 box.Left = l;
150 break;
151 case 2:
152 box.Left = l + w - box.Width;
153 break;
154 default:
155 box.Left = l + ((w - box.Width) >> 1);
156 break;
158 if (box.Left < l) box.Left = l;
161 * Figure out y position.
163 if (center) box.Top = t - (box.Height >> 1);
164 else box.Top = t - bi->bi_RPort->TxBaseline;
167 * Setup rastport.
169 BSetDPenA(bi, BACKGROUNDPEN);
170 BSetDrMd(bi, JAM1);
171 BClearAfPt(bi);
174 * Clear text area.
176 BRectFill(bi, box.Left - 4, box.Top, box.Left + box.Width + 4, box.Top + box.Height);
178 BSetDPenA(bi, highlight ? HIGHLIGHTTEXTPEN : TEXTPEN);
179 DoMethod(title, TEXTM_RENDER, bi, &box);
183 //makeproto VOID ASM SetDashedLine(REG(a0) struct BaseInfo *bi, REG(d0) UWORD offset)
184 makeproto ASM REGFUNC2(VOID, SetDashedLine,
185 REGPARAM(A0, struct BaseInfo *, bi),
186 REGPARAM(D0, UWORD, offset))
189 * Render a SHINE/SHADOW pen, dotted box or,
190 * when the two pens are equal a SHADOW/BACKGROUND
191 * pen dotted box.
193 BSetDPenA(bi, SHINEPEN);
194 BSetDPenB(bi, SHADOWPEN);
195 BSetDrMd(bi, JAM2);
196 BSetDrPt(bi, 0xF0F0F0F0 >> offset);
198 if (bi->bi_RPort->FgPen == bi->bi_RPort->BgPen)
199 BSetDPenA(bi, BACKGROUNDPEN);
201 REGFUNC_END
204 * Quickly render a bevelled box.
206 makeproto VOID RenderBevelBox(struct BaseInfo *bi, WORD l, WORD t, WORD r, WORD b, UWORD state, BOOL recessed, BOOL thin)
208 struct RastPort *rp = bi->bi_RPort;
211 * Selected or normal?
213 if ((state == IDS_SELECTED) || (state == IDS_INACTIVESELECTED))
215 recessed = !recessed;
219 * Shiny side.
221 BSetDPenA(bi, recessed ? SHADOWPEN : SHINEPEN);
223 HLine(rp, l, t, r);
224 VLine(rp, l, t, b - 1);
225 if (!thin) VLine(rp, l + 1, t + 1, b - 1);
228 * Shadow side.
230 BSetDPenA(bi, recessed ? SHINEPEN : SHADOWPEN);
232 HLine(rp, l, b, r);
233 VLine(rp, r, t + 1, b);
234 if (!thin) VLine(rp, r - 1, t + 1, b - 1);
237 #ifdef DEBUG_BGUI
238 //makeproto ASM VOID SRectFillDebug(REG(a0) struct RastPort *rp, REG(d0) LONG l, REG(d1) LONG t, REG(d2) LONG r, REG(d3) LONG b,REG(a1) STRPTR file,REG(d4) ULONG line)
239 makeproto ASM REGFUNC7(VOID, SRectFillDebug,
240 REGPARAM(A0, struct RastPort *, rp),
241 REGPARAM(D0, LONG, l),
242 REGPARAM(D1, LONG, t),
243 REGPARAM(D2, LONG, r),
244 REGPARAM(D3, LONG, b),
245 REGPARAM(A1, STRPTR, file),
246 REGPARAM(D4, ULONG, line))
247 #else
248 //ASM VOID SRectFill(REG(a0) struct RastPort *rp, REG(d0) LONG l, REG(d1) LONG t, REG(d2) LONG r, REG(d3) LONG b)
249 ASM REGFUNC5(VOID, SRectFill,
250 REGPARAM(A0, struct RastPort *, rp),
251 REGPARAM(D0, LONG, l),
252 REGPARAM(D1, LONG, t),
253 REGPARAM(D2, LONG, r),
254 REGPARAM(D3, LONG, b))
255 #endif
257 if ((r >= l) && (b >= t))
258 RectFill(rp, l, t, r, b);
259 #ifdef DEBUG_BGUI
260 else
261 D(bug("***Invalid RectFill (%lx,%ld,%ld,%ld,%ld) (%s,%lu)\n",rp,l,t,r,b,file ? file : (STRPTR)"Unknown file",line));
262 #endif
264 REGFUNC_END
267 * Do a safe rect-fill.
269 #ifdef DEBUG_BGUI
270 //makeproto ASM VOID BRectFillDebug(REG(a0) struct BaseInfo *bi, REG(d0) LONG l, REG(d1) LONG t, REG(d2) LONG r, REG(d3) LONG b,REG(a1) STRPTR file,REG(d4) ULONG line)
271 makeproto ASM REGFUNC7(VOID, BRectFillDebug,
272 REGPARAM(A0, struct BaseInfo *, bi),
273 REGPARAM(D0, LONG, l),
274 REGPARAM(D1, LONG, t),
275 REGPARAM(D2, LONG, r),
276 REGPARAM(D3, LONG, b),
277 REGPARAM(A1, STRPTR, file),
278 REGPARAM(D4, ULONG, line))
280 SRectFillDebug(bi->bi_RPort, l, t, r, b,file,line);
282 REGFUNC_END
283 #else
284 //ASM VOID BRectFill(REG(a0) struct BaseInfo *bi, REG(d0) LONG l, REG(d1) LONG t, REG(d2) LONG r, REG(d3) LONG b)
285 ASM REGFUNC5(VOID, BRectFill,
286 REGPARAM(A0, struct BaseInfo *, bi),
287 REGPARAM(D0, LONG, l),
288 REGPARAM(D1, LONG, t),
289 REGPARAM(D2, LONG, r),
290 REGPARAM(D3, LONG, b))
292 SRectFill(bi->bi_RPort, l, t, r, b);
294 REGFUNC_END
295 #endif
297 //makeproto ASM VOID BRectFillA(REG(a0) struct BaseInfo *bi, REG(a1) struct Rectangle *rect)
298 makeproto ASM REGFUNC2(VOID, BRectFillA,
299 REGPARAM(A0, struct BaseInfo *, bi),
300 REGPARAM(A1, struct Rectangle *, rect))
302 BRectFill(bi, rect->MinX, rect->MinY, rect->MaxX, rect->MaxY);
304 REGFUNC_END
306 //makeproto ASM VOID BBoxFill(REG(a0) struct BaseInfo *bi, REG(d0) LONG l, REG(d1) LONG t, REG(d2) LONG w, REG(d3) LONG h)
307 makeproto ASM REGFUNC5(VOID, BBoxFill,
308 REGPARAM(A0, struct BaseInfo *, bi),
309 REGPARAM(D0, LONG, l),
310 REGPARAM(D1, LONG, t),
311 REGPARAM(D2, LONG, w),
312 REGPARAM(D3, LONG, h))
314 SRectFill(bi->bi_RPort, l, t, l + w - 1, t + h - 1);
316 REGFUNC_END
318 //makeproto ASM VOID BBoxFillA(REG(a0) struct BaseInfo *bi, REG(a1) struct IBox *box)
319 makeproto ASM REGFUNC2(VOID, BBoxFillA,
320 REGPARAM(A0, struct BaseInfo *, bi),
321 REGPARAM(A1, struct IBox *, box))
323 BBoxFill(bi, box->Left, box->Top, box->Width, box->Height);
325 REGFUNC_END
328 * Background filling.
331 //makeproto ASM VOID RenderBackFill(REG(a0) struct RastPort *rp, REG(a1) struct IBox *ib, REG(a2) UWORD *pens, REG(d0) ULONG type)
332 makeproto ASM REGFUNC4(VOID, RenderBackFill,
333 REGPARAM(A0, struct RastPort *, rp),
334 REGPARAM(A1, struct IBox *, ib),
335 REGPARAM(A2, UWORD *, pens),
336 REGPARAM(D0, ULONG, type))
338 int apen, bpen;
340 if (!pens) pens = DefDriPens;
343 * Which type?
345 switch (type)
347 case SHINE_RASTER:
348 apen = SHINEPEN;
349 bpen = BACKGROUNDPEN;
350 break;
352 case SHADOW_RASTER:
353 apen = SHADOWPEN;
354 bpen = BACKGROUNDPEN;
355 break;
357 case SHINE_SHADOW_RASTER:
358 apen = SHINEPEN;
359 bpen = SHADOWPEN;
360 break;
362 case FILL_RASTER:
363 apen = FILLPEN;
364 bpen = BACKGROUNDPEN;
365 break;
367 case SHINE_FILL_RASTER:
368 apen = SHINEPEN;
369 bpen = FILLPEN;
370 break;
372 case SHADOW_FILL_RASTER:
373 apen = SHADOWPEN;
374 bpen = FILLPEN;
375 break;
377 case SHINE_BLOCK:
378 apen = SHINEPEN;
379 bpen = apen;
380 break;
382 case SHADOW_BLOCK:
383 apen = SHADOWPEN;
384 bpen = apen;
385 break;
387 default:
388 apen = BACKGROUNDPEN;
389 bpen = apen;
390 break;
392 RenderBackFillRaster(rp, ib, pens[apen], pens[bpen]);
394 REGFUNC_END
396 #ifdef DEBUG_BGUI
397 //makeproto ASM VOID RenderBackFillRasterDebug(REG(a0) struct RastPort *rp, REG(a1) struct IBox *ib, REG(d0) UWORD apen, REG(d1) UWORD bpen,REG(a2) STRPTR file, REG(d2) ULONG line)
398 makeproto ASM REGFUNC6(VOID, RenderBackFillRasterDebug,
399 REGPARAM(A0, struct RastPort *, rp),
400 REGPARAM(A1, struct IBox *, ib),
401 REGPARAM(D0, UWORD, apen),
402 REGPARAM(D1, UWORD, bpen),
403 REGPARAM(A2, STRPTR, file),
404 REGPARAM(D2, ULONG, line))
405 #else
406 //ASM VOID RenderBackFillRaster(REG(a0) struct RastPort *rp, REG(a1) struct IBox *ib, REG(d0) UWORD apen, REG(d1) UWORD bpen)
407 ASM REGFUNC4(VOID, RenderBackFillRaster,
408 REGPARAM(A0, struct RastPort *, rp),
409 REGPARAM(A1, struct IBox *, ib),
410 REGPARAM(D0, UWORD, apen),
411 REGPARAM(D1, UWORD, bpen))
412 #endif
414 static UWORD pat[] = { 0x5555, 0xAAAA };
416 * Setup RastPort.
419 FSetABPenDrMd(rp, apen, bpen, JAM2);
421 if (apen == bpen)
423 FSetDrMd(rp, JAM1);
424 FClearAfPt(rp);
426 else
428 SetAfPt(rp, pat, 1);
432 * Render...
434 #ifdef DEBUG_BGUI
435 SRectFillDebug(rp, ib->Left, ib->Top, ib->Left + ib->Width - 1, ib->Top + ib->Height - 1,file,line);
436 #else
437 SRectFill(rp, ib->Left, ib->Top, ib->Left + ib->Width - 1, ib->Top + ib->Height - 1);
438 #endif
441 * Clear area pattern.
443 FClearAfPt(rp);
445 REGFUNC_END
448 * Draw a dotted box.
450 //makeproto ASM VOID DottedBox(REG(a0) struct BaseInfo *bi, REG(a1) struct IBox *ibx)
451 makeproto ASM REGFUNC2(VOID, DottedBox,
452 REGPARAM(A0, struct BaseInfo *, bi),
453 REGPARAM(A1, struct IBox *, ibx))
455 int x1 = ibx->Left;
456 int x2 = ibx->Left + ibx->Width - 1;
457 int y1 = ibx->Top;
458 int y2 = ibx->Top + ibx->Height - 1;
460 ULONG secs, micros, hundredths;
462 struct RastPort *rp = bi->bi_RPort;
465 * We clear any thick framing which may be
466 * there or not.
468 BSetDPenA(bi, BACKGROUNDPEN);
469 Move(rp, x1 + 1, y1 + 1);
470 Draw(rp, x1 + 1, y2 - 1);
471 Draw(rp, x2 - 1, y2 - 1);
472 Draw(rp, x2 - 1, y1 + 1);
473 Draw(rp, x1 + 2, y1 + 1);
475 CurrentTime(&secs, &micros);
476 hundredths = ((secs & 0xFFFFFF) * 100) + (micros / 10000);
477 SetDashedLine(bi, (hundredths / 5) % 8);
480 * Draw the box.
482 Move(rp, x1, y1);
483 Draw(rp, x2, y1);
484 Draw(rp, x2, y2);
485 Draw(rp, x1, y2);
486 Draw(rp, x1, y1 + 1);
488 REGFUNC_END
491 * Find out rendering state.
493 //makeproto ASM ULONG GadgetState(REG(a0) struct BaseInfo *bi, REG(a1) Object *obj, REG(d0) BOOL norec)
494 makeproto ASM REGFUNC3(ULONG, GadgetState,
495 REGPARAM(A0, struct BaseInfo *, bi),
496 REGPARAM(A1, Object *, obj),
497 REGPARAM(D0, BOOL, norec))
499 BOOL active = !(GADGET(obj)->Activation & BORDERMASK) || (bi->bi_IWindow->Flags & WFLG_WINDOWACTIVE);
500 BOOL normal = !(GADGET(obj)->Flags & GFLG_SELECTED) || norec;
502 return active ? (ULONG)(normal ? IDS_NORMAL : IDS_SELECTED)
503 : (ULONG)(normal ? IDS_INACTIVENORMAL : IDS_INACTIVESELECTED);
505 REGFUNC_END
507 #ifdef __AROS__
508 makearosproto
509 AROS_LH6(VOID, BGUI_FillRectPattern,
510 AROS_LHA(struct RastPort *, r, A1),
511 AROS_LHA(struct bguiPattern *, bp, A0),
512 AROS_LHA(ULONG, x1, D0),
513 AROS_LHA(ULONG, y1, D1),
514 AROS_LHA(ULONG, x2, D2),
515 AROS_LHA(ULONG, y2, D3),
516 struct Library *, BGUIBase, 22, BGUI)
517 #else
518 makeproto SAVEDS ASM VOID BGUI_FillRectPattern(REG(a1) struct RastPort *r, REG(a0) struct bguiPattern *bp,
519 REG(d0) ULONG x1, REG(d1) ULONG y1, REG(d2) ULONG x2, REG(d3) ULONG y2)
520 #endif
522 AROS_LIBFUNC_INIT
524 int i, j;
526 int x0 = bp->bp_Left;
527 int y0 = bp->bp_Top;
528 int w = bp->bp_Width;
529 int h = bp->bp_Height;
531 int col_min, col_max;
532 int row_min, row_max;
534 int from_x, to_x1, to_x2, to_w;
535 int from_y, to_y1, to_y2, to_h;
537 struct BitMap *bm = bp->bp_BitMap;
539 if (bm && w && h)
541 col_min = x1 / w;
542 row_min = y1 / h;
543 col_max = x2++ / w + 1;
544 row_max = y2++ / h + 1;
546 for (i = col_min; i <= col_max; i++)
548 to_x1 = i * w;
549 to_x2 = to_x1 + w;
551 if (to_x1 < x1)
553 from_x = x0 + x1 - to_x1;
554 to_x1 = x1;
556 else
558 from_x = x0;
560 if (to_x2 > x2)
562 to_x2 = x2;
564 if ((to_w = to_x2 - to_x1) > 0)
566 for (j = row_min; j <= row_max; j++)
568 to_y1 = j * h;
569 to_y2 = to_y1 + h;
571 if (to_y1 < y1)
573 from_y = y0 + y1 - to_y1;
574 to_y1 = y1;
576 else
578 from_y = y0;
580 if (to_y2 > y2)
582 to_y2 = y2;
584 if ((to_h = to_y2 - to_y1) > 0)
586 BltBitMapRastPort(bm, from_x, from_y, r, to_x1, to_y1, to_w, to_h, 0xC0);
593 AROS_LIBFUNC_EXIT
596 //makeproto VOID ASM HLine(REG(a1) struct RastPort *rp, REG(d0) UWORD l, REG(d1) UWORD t, REG(d2) UWORD r)
597 makeproto ASM REGFUNC4(VOID, HLine,
598 REGPARAM(A1, struct RastPort *, rp),
599 REGPARAM(D0, UWORD, l),
600 REGPARAM(D1, UWORD, t),
601 REGPARAM(D2, UWORD, r))
603 Move(rp, l, t);
604 Draw(rp, r, t);
606 REGFUNC_END
608 //makeproto VOID ASM VLine(REG(a1) struct RastPort *rp, REG(d0) UWORD l, REG(d1) UWORD t, REG(d2) UWORD b)
609 makeproto ASM REGFUNC4(VOID, VLine,
610 REGPARAM(A1, struct RastPort *, rp),
611 REGPARAM(D0, UWORD, l),
612 REGPARAM(D1, UWORD, t),
613 REGPARAM(D2, UWORD, b))
615 Move(rp, l, t);
616 Draw(rp, l, b);
618 REGFUNC_END
620 //makeproto ASM ULONG FGetAPen(REG(a1) struct RastPort *rp)
621 makeproto ASM REGFUNC1(ULONG, FGetAPen,
622 REGPARAM(A1, struct RastPort *,rp))
624 #ifdef ENHANCED
625 return GetAPen(rp);
626 #else
627 if (OS30) return GetAPen(rp);
628 return rp->FgPen;
629 #endif
631 REGFUNC_END
633 //makeproto ASM ULONG FGetBPen(REG(a1) struct RastPort *rp)
634 makeproto ASM REGFUNC1(ULONG, FGetBPen,
635 REGPARAM(A1, struct RastPort *,rp))
637 #ifdef ENHANCED
638 return GetBPen(rp);
639 #else
640 if (OS30) return GetBPen(rp);
641 return rp->BgPen;
642 #endif
644 REGFUNC_END
646 //makeproto ASM ULONG FGetDrMd(REG(a1) struct RastPort *rp)
647 makeproto ASM REGFUNC1(ULONG, FGetDrMd,
648 REGPARAM(A1, struct RastPort *,rp))
650 #ifdef ENHANCED
651 return GetDrMd(rp);
652 #else
653 if (OS30) return GetDrMd(rp);
654 return rp->DrawMode;
655 #endif
657 REGFUNC_END
659 //makeproto ASM ULONG FGetDepth(REG(a1) struct RastPort *rp)
660 makeproto ASM REGFUNC1(ULONG, FGetDepth,
661 REGPARAM(A1, struct RastPort *, rp))
663 #ifdef ENHANCED
664 return GetBitMapAttr(rp->BitMap, BMA_DEPTH);
665 #else
666 if (OS30) return GetBitMapAttr(rp->BitMap, BMA_DEPTH);
667 return rp->BitMap->Depth;
668 #endif
670 REGFUNC_END
672 //makeproto ASM VOID FSetAPen(REG(a1) struct RastPort *rp, REG(d0) ULONG pen)
673 makeproto ASM REGFUNC2(VOID, FSetAPen,
674 REGPARAM(A1, struct RastPort *, rp),
675 REGPARAM(D0, ULONG, pen))
677 #ifdef ENHANCED
678 SetRPAttrs(rp, RPTAG_APen, pen, TAG_END);
679 #else
680 if (OS30) SetRPAttrs(rp, RPTAG_APen, pen, TAG_END);
681 else if (rp->FgPen != pen) SetAPen(rp, pen);
682 #endif
684 REGFUNC_END
686 //makeproto ASM VOID FSetBPen(REG(a1) struct RastPort *rp, REG(d0) ULONG pen)
687 makeproto ASM REGFUNC2(VOID, FSetBPen,
688 REGPARAM(A1, struct RastPort *, rp),
689 REGPARAM(D0, ULONG, pen))
691 #ifdef ENHANCED
692 SetRPAttrs(rp, RPTAG_BPen, pen, TAG_END);
693 #else
694 if (OS30) SetRPAttrs(rp, RPTAG_BPen, pen, TAG_END);
695 else if (rp->BgPen != pen) SetBPen(rp, pen);
696 #endif
698 REGFUNC_END
700 //makeproto ASM VOID FSetDrMd(REG(a1) struct RastPort *rp, REG(d0) ULONG drmd)
701 makeproto ASM REGFUNC2(VOID, FSetDrMd,
702 REGPARAM(A1, struct RastPort *, rp),
703 REGPARAM(D0, ULONG, drmd))
705 #ifdef ENHANCED
706 SetRPAttrs(rp, RPTAG_DrMd, drmd, TAG_END);
707 #else
708 if (OS30) SetRPAttrs(rp, RPTAG_DrMd, drmd, TAG_END);
709 else if (rp->DrawMode != drmd) SetDrMd(rp, drmd);
710 #endif
712 REGFUNC_END
714 //makeproto ASM VOID FSetABPenDrMd(REG(a1) struct RastPort *rp, REG(d0) ULONG apen, REG(d1) ULONG bpen, REG(d2) ULONG mode)
715 makeproto ASM REGFUNC4(VOID, FSetABPenDrMd,
716 REGPARAM(A1, struct RastPort *, rp),
717 REGPARAM(D0, ULONG, apen),
718 REGPARAM(D1, ULONG, bpen),
719 REGPARAM(D2, ULONG, mode))
721 #ifdef ENHANCED
722 SetABPenDrMd(rp, apen, bpen, mode);
723 #else
724 if (OS30) SetABPenDrMd(rp, apen, bpen, mode);
725 else
727 SetAPen(rp, apen);
728 SetBPen(rp, bpen);
729 SetDrMd(rp, mode);
731 #endif
733 REGFUNC_END
735 //makeproto ASM VOID FSetFont(REG(a1) struct RastPort *rp, REG(a0) struct TextFont *tf)
736 makeproto ASM REGFUNC2(VOID, FSetFont,
737 REGPARAM(A1, struct RastPort *, rp),
738 REGPARAM(A0, struct TextFont *, tf))
740 #ifdef ENHANCED
741 SetRPAttrs(rp, RPTAG_Font, tf, TAG_END);
742 #else
743 if (OS30) SetRPAttrs(rp, RPTAG_Font, tf, TAG_END);
744 else
746 if (rp->Font != tf) SetFont(rp, tf);
748 #endif
750 REGFUNC_END
752 //makeproto ASM VOID FSetFontStyle(REG(a1) struct RastPort *rp, REG(d0) ULONG style)
753 makeproto ASM REGFUNC2(VOID, FSetFontStyle,
754 REGPARAM(A1, struct RastPort *, rp),
755 REGPARAM(D0, ULONG, style))
757 SetSoftStyle(rp, style, AskSoftStyle(rp));
759 REGFUNC_END
761 //makeproto ASM VOID FClearAfPt(REG(a1) struct RastPort *rp)
762 makeproto ASM REGFUNC1(VOID, FClearAfPt,
763 REGPARAM(A1, struct RastPort *, rp))
765 SetAfPt(rp, NULL, 0);
767 REGFUNC_END
772 //makeproto ASM VOID BSetDPenA(REG(a0) struct BaseInfo *bi, REG(d0) LONG pen)
773 makeproto ASM REGFUNC2(VOID, BSetDPenA,
774 REGPARAM(A0, struct BaseInfo *, bi),
775 REGPARAM(D0, LONG, pen))
777 FSetAPen(bi->bi_RPort, bi->bi_Pens[pen]);
779 REGFUNC_END
781 //makeproto ASM VOID BSetPenA(REG(a0) struct BaseInfo *bi, REG(d0) ULONG pen)
782 makeproto ASM REGFUNC2(VOID, BSetPenA,
783 REGPARAM(A0, struct BaseInfo *, bi),
784 REGPARAM(D0, ULONG, pen))
786 FSetAPen(bi->bi_RPort, pen);
788 REGFUNC_END
790 //makeproto ASM VOID BSetDPenB(REG(a0) struct BaseInfo *bi, REG(d0) LONG pen)
791 makeproto ASM REGFUNC2(VOID, BSetDPenB,
792 REGPARAM(A0, struct BaseInfo *, bi),
793 REGPARAM(D0, LONG, pen))
795 FSetBPen(bi->bi_RPort, bi->bi_Pens[pen]);
797 REGFUNC_END
799 //makeproto ASM VOID BSetPenB(REG(a0) struct BaseInfo *bi, REG(d0) ULONG pen)
800 makeproto ASM REGFUNC2(VOID, BSetPenB,
801 REGPARAM(A0, struct BaseInfo *, bi),
802 REGPARAM(D0, ULONG, pen))
804 FSetBPen(bi->bi_RPort, pen);
806 REGFUNC_END
808 //makeproto ASM VOID BSetDrMd(REG(a0) struct BaseInfo *bi, REG(d0) ULONG drmd)
809 makeproto ASM REGFUNC2(VOID, BSetDrMd,
810 REGPARAM(A0, struct BaseInfo *, bi),
811 REGPARAM(D0, ULONG, drmd))
813 FSetDrMd(bi->bi_RPort, drmd);
815 REGFUNC_END
817 //makeproto ASM VOID BSetFont(REG(a0) struct BaseInfo *bi, REG(a1) struct TextFont *tf)
818 makeproto ASM REGFUNC2(VOID, BSetFont,
819 REGPARAM(A0, struct BaseInfo *, bi),
820 REGPARAM(A1, struct TextFont *, tf))
822 FSetFont(bi->bi_RPort, tf);
824 REGFUNC_END
826 //makeproto ASM VOID BSetFontStyle(REG(a0) struct BaseInfo *bi, REG(d0) ULONG style)
827 makeproto ASM REGFUNC2(VOID, BSetFontStyle,
828 REGPARAM(A0, struct BaseInfo *, bi),
829 REGPARAM(D0, ULONG, style))
831 SetSoftStyle(bi->bi_RPort, style, AskSoftStyle(bi->bi_RPort));
833 REGFUNC_END
835 //makeproto ASM VOID BSetAfPt(REG(a0) struct BaseInfo *bi, REG(a1) UWORD *pat, REG(d0) ULONG size)
836 makeproto ASM REGFUNC3(VOID, BSetAfPt,
837 REGPARAM(A0, struct BaseInfo *, bi),
838 REGPARAM(A1, UWORD *, pat),
839 REGPARAM(D0, ULONG, size))
841 SetAfPt(bi->bi_RPort, pat, size);
843 REGFUNC_END
845 //makeproto ASM VOID BClearAfPt(REG(a0) struct BaseInfo *bi)
846 makeproto ASM REGFUNC1(VOID, BClearAfPt,
847 REGPARAM(A0, struct BaseInfo *, bi))
849 SetAfPt(bi->bi_RPort, NULL, 0);
851 REGFUNC_END
853 //makeproto ASM VOID BSetDrPt(REG(a0) struct BaseInfo *bi, REG(d0) ULONG pat)
854 makeproto ASM REGFUNC2(VOID, BSetDrPt,
855 REGPARAM(A0, struct BaseInfo *, bi),
856 REGPARAM(D0, ULONG, pat))
858 SetDrPt(bi->bi_RPort, pat & 0xFFFF);
860 REGFUNC_END
862 //makeproto ASM VOID BDrawImageState(REG(a0) struct BaseInfo *bi, REG(a1) Object *image,
863 // REG(d0) ULONG x, REG(d1) ULONG y, REG(d2) ULONG state)
864 makeproto ASM REGFUNC5(VOID, BDrawImageState,
865 REGPARAM(A0, struct BaseInfo *, bi),
866 REGPARAM(A1, Object *, image),
867 REGPARAM(D0, ULONG, x),
868 REGPARAM(D1, ULONG, y),
869 REGPARAM(D2, ULONG, state))
871 //tprintf("%08lx %08lx %ld %ld %04lx %08lx\n", /4*
872 DrawImageState(bi->bi_RPort, IMAGE(image), x, y, state, bi->bi_DrInfo);
874 REGFUNC_END