1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcalc.h */
|
|
|
|
/* */
|
|
|
|
/* Arithmetic computations (specification). */
|
|
|
|
/* */
|
2006-02-17 09:07:09 +01:00
|
|
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-07-18 08:50:03 +02:00
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#ifndef __FTCALC_H__
|
|
|
|
#define __FTCALC_H__
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2004-12-14 00:16:59 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_FixedSqrt */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Computes the square root of a 16.16 fixed point value. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* x :: The value to compute the root for. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* The result of `sqrt(x)'. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* This function is not very fast. */
|
|
|
|
/* */
|
* src/base/ftcalc.c (FT_MulTo64): Commented out.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed), src/base/ftcalc.c
(FT_SqrtFixed), include/freetype/internal/ftdebug.h
(FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message, FT_Panic),
src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message,
FT_Panic), include/freetype/internal/ftobjs.h (FT_New_Memory,
FT_Done_Memory), include/freetype/internal/ftstream.h
(FT_Stream_Open), src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
FT_Stream_Open): s/FT_EXPORT/FT_BASE/.
* builds/exports.mk: Manually add TT_New_Context to EXPORTS_LIST too.
2005-11-17 02:53:07 +01:00
|
|
|
FT_BASE( FT_Int32 )
|
2003-11-25 19:15:56 +01:00
|
|
|
FT_SqrtFixed( FT_Int32 x );
|
2001-05-09 22:57:45 +02:00
|
|
|
|
|
|
|
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
2001-06-28 19:49:10 +02:00
|
|
|
|
2000-11-07 18:21:11 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_Sqrt32 */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Computes the square root of an Int32 integer (which will be */
|
|
|
|
/* handled as an unsigned long value). */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* x :: The value to compute the root for. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* The result of `sqrt(x)'. */
|
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Int32 )
|
|
|
|
FT_Sqrt32( FT_Int32 x );
|
|
|
|
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
2005-11-12 18:07:11 +01:00
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2003-11-26 09:24:08 +01:00
|
|
|
|
2003-11-25 19:15:56 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_MulDiv_No_Round */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A very simple function used to perform the computation `(a*b)/c' */
|
|
|
|
/* (without rounding) with maximal accuracy (it uses a 64-bit */
|
|
|
|
/* intermediate integer whenever necessary). */
|
|
|
|
/* */
|
|
|
|
/* This function isn't necessarily as fast as some processor specific */
|
|
|
|
/* operations, but is at least completely portable. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* a :: The first multiplier. */
|
|
|
|
/* b :: The second multiplier. */
|
|
|
|
/* c :: The divisor. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* The result of `(a*b)/c'. This function never traps when trying to */
|
|
|
|
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
|
|
|
|
/* on the signs of `a' and `b'. */
|
|
|
|
/* */
|
|
|
|
FT_BASE( FT_Long )
|
|
|
|
FT_MulDiv_No_Round( FT_Long a,
|
|
|
|
FT_Long b,
|
|
|
|
FT_Long c );
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
2003-11-26 09:24:08 +01:00
|
|
|
|
2006-11-03 10:40:12 +01:00
|
|
|
|
2006-11-02 18:21:02 +01:00
|
|
|
/*
|
|
|
|
* Return -1, 0, or +1, depending on the orientation of a given corner.
|
|
|
|
* We use the Cartesian coordinate system, with positive vertical values
|
2006-11-03 10:40:12 +01:00
|
|
|
* going upwards. The function returns +1 if the corner turns to the
|
|
|
|
* left, -1 to the right, and 0 for undecidable cases.
|
2006-11-02 18:21:02 +01:00
|
|
|
*/
|
|
|
|
FT_BASE( FT_Int )
|
2006-11-03 10:40:12 +01:00
|
|
|
ft_corner_orientation( FT_Pos in_x,
|
|
|
|
FT_Pos in_y,
|
|
|
|
FT_Pos out_x,
|
|
|
|
FT_Pos out_y );
|
2006-11-02 18:21:02 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return TRUE if a corner is flat or nearly flat. This is equivalent to
|
|
|
|
* saying that the angle difference between the `in' and `out' vectors is
|
|
|
|
* very small.
|
|
|
|
*/
|
|
|
|
FT_BASE( FT_Int )
|
2006-11-03 10:40:12 +01:00
|
|
|
ft_corner_is_flat( FT_Pos in_x,
|
|
|
|
FT_Pos in_y,
|
|
|
|
FT_Pos out_x,
|
|
|
|
FT_Pos out_y );
|
|
|
|
|
2003-11-25 19:15:56 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
|
|
|
|
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
|
|
|
|
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
|
|
|
|
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
|
2000-07-18 08:50:03 +02:00
|
|
|
#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-02 23:31:32 +02:00
|
|
|
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
|
|
|
|
: ( -( ( 32 - (x) ) & -64 ) ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
2000-07-18 08:50:03 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#endif /* __FTCALC_H__ */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|