2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ScalerDiv()
9 /*****************************************************************************
12 #include <proto/graphics.h>
14 AROS_LH3(UWORD
, ScalerDiv
,
17 AROS_LHA(UWORD
, factor
, D0
),
18 AROS_LHA(UWORD
, numerator
, D1
),
19 AROS_LHA(UWORD
, denominator
, D2
),
22 struct GfxBase
*, GfxBase
, 114, Graphics
)
25 Use this to precalculate the width/height of the destination
26 bitmap. As factor give the width/height of the original bitmap
27 that is to be scaled via ScaleBitMap(), as numerator give
28 the value you will write into bsa_XSrcFactor/bsa_YSrcFactor
29 and as denominator the value of bsa_XDestFactor/bsa_YDestFactor.
32 factor - a number in the range of 0..16383
33 numerator - a number in the range of 1..16383
34 denominator - a number in the range of 1..16383
51 *****************************************************************************/
59 res
= (ULONG
)((ULONG
)factor
* (ULONG
)numerator
) / denominator
;
64 if (((factor
* numerator
) % denominator
) >= ((denominator
+ 1) >> 1))