2000-08-23 19:32:42 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcimage.h */
|
|
|
|
/* */
|
|
|
|
/* XXX */
|
|
|
|
/* */
|
|
|
|
/* Copyright 2000 by */
|
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* 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-08-23 13:22:30 +02:00
|
|
|
#ifndef FTCIMAGE_H
|
|
|
|
#define FTCIMAGE_H
|
|
|
|
|
|
|
|
#include <cache/ftcmanag.h>
|
|
|
|
#include <freetype/ftglyph.h>
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct FTC_Image_QueueRec_* FTC_Image_Queue;
|
|
|
|
typedef struct FTC_Image_CacheRec_* FTC_Image_Cache;
|
|
|
|
typedef struct FTC_ImageNodeRec_* FTC_ImageNode;
|
2000-08-23 13:22:30 +02:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
2000-08-23 13:22:30 +02:00
|
|
|
/* types of glyph images */
|
2000-08-23 19:32:42 +02:00
|
|
|
typedef enum FTC_Image_Type_
|
2000-08-23 13:22:30 +02:00
|
|
|
{
|
|
|
|
ftc_image_mono = 0, /* monochrome bitmap */
|
|
|
|
ftc_image_grays, /* anti-aliased bitmap */
|
|
|
|
ftc_image_outline, /* scaled outline */
|
|
|
|
ftc_image_master_outline, /* original outline */
|
|
|
|
|
|
|
|
} FTC_Image_Type;
|
|
|
|
|
|
|
|
|
|
|
|
/* a descriptor used to describe all glyphs in a given queue */
|
|
|
|
typedef struct FTC_Image_Desc_
|
|
|
|
{
|
2000-08-23 19:32:42 +02:00
|
|
|
FTC_FaceID face_id;
|
|
|
|
FT_UInt pix_width;
|
|
|
|
FT_UInt pix_height;
|
|
|
|
FT_UInt image_type;
|
2000-08-23 13:22:30 +02:00
|
|
|
|
|
|
|
} FTC_Image_Desc;
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
|
|
|
/* macros used to pack a glyph index and a queue index in a single ptr */
|
|
|
|
#define FTC_PTR_TO_GINDEX( p ) ( (FT_UInt)( (FT_ULong)(p) >> 16 ) )
|
|
|
|
#define FTC_PTR_TO_QINDEX( p ) ( (FT_UInt)( (FT_ULong)(p) & 0xFFFF ) )
|
|
|
|
#define FTC_INDICES_TO_PTR( g, q ) \
|
|
|
|
( (FT_Pointer)( ( (FT_ULong)(g) << 16 ) | \
|
|
|
|
( (FT_ULong)(q) & 0xFFFF) ) )
|
2000-08-23 13:22:30 +02:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
typedef struct FTC_ImageNodeRec_
|
2000-08-23 13:22:30 +02:00
|
|
|
{
|
2000-08-23 19:32:42 +02:00
|
|
|
/* root1.data contains a FT_Glyph handle */
|
|
|
|
FT_ListNodeRec root1;
|
|
|
|
|
|
|
|
/* root2.data contains a glyph index + queue index */
|
|
|
|
FT_ListNodeRec root2;
|
2000-08-23 13:22:30 +02:00
|
|
|
|
|
|
|
} FTC_ImageNodeRec;
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
|
|
|
/* macros to read/set the glyph & queue index in a FTC_ImageNode */
|
|
|
|
#define FTC_IMAGENODE_GET_GINDEX( n ) FTC_PTR_TO_GINDEX( (n)->root2.data )
|
|
|
|
#define FTC_IMAGENODE_GET_QINDEX( n ) FTC_PTR_TO_QINDEX( (n)->root2.data )
|
|
|
|
#define FTC_IMAGENODE_SET_INDICES( g, q ) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
(n)->root2.data = FTC_INDICES_TO_PTR( g, q ); \
|
|
|
|
} while ( 0 )
|
2000-08-23 13:22:30 +02:00
|
|
|
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
typedef struct FTC_Image_CacheRec_
|
2000-08-23 13:22:30 +02:00
|
|
|
{
|
|
|
|
FTC_Manager manager;
|
|
|
|
FT_Memory memory;
|
|
|
|
|
|
|
|
FT_ULong max_bytes; /* maximum size of cache in bytes */
|
|
|
|
FT_ULong num_bytes; /* current size of cache in bytes */
|
|
|
|
|
|
|
|
FT_Lru queues_lru; /* static queues lru list */
|
|
|
|
|
|
|
|
} FTC_Image_Cache;
|
|
|
|
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
/* a table of functions used to generate/manager glyph images */
|
|
|
|
typedef struct FTC_Image_Class_
|
2000-08-23 13:22:30 +02:00
|
|
|
{
|
2000-08-23 19:32:42 +02:00
|
|
|
FT_Error (*init_image)( FTC_Image_Queue queue,
|
|
|
|
FTC_Image_Node node );
|
2000-08-23 13:22:30 +02:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
void (*done_image)( FTC_Image_Queue queue,
|
|
|
|
FTC_Image_Node node );
|
2000-08-23 13:22:30 +02:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
FT_ULong (*size_image)( FTC_Image_Queue queue,
|
|
|
|
FTC_Image_Node node );
|
2000-08-23 13:22:30 +02:00
|
|
|
|
|
|
|
} FTC_Image_Class;
|
|
|
|
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
typedef struct FTC_Image_QueueRec_
|
2000-08-23 13:22:30 +02:00
|
|
|
{
|
|
|
|
FTC_Image_Cache cache;
|
|
|
|
FTC_Manager manager;
|
|
|
|
FT_Memory memory;
|
|
|
|
FTC_Image_Class* clazz;
|
|
|
|
FTC_Image_Desc descriptor;
|
|
|
|
FT_UInt hash_size;
|
|
|
|
FT_List buckets;
|
|
|
|
|
|
|
|
} FTC_Image_SubCacheRec;
|
|
|
|
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_New( FTC_Manager manager,
|
|
|
|
FT_ULong max_bytes,
|
|
|
|
FTC_Image_Cache* acache );
|
2000-08-23 13:22:30 +02:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
FT_EXPORT_DEF( void ) FTC_Image_Cache_Done( FTC_Image_Cache cache );
|
2000-08-23 13:22:30 +02:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_Lookup(
|
|
|
|
FTC_Image_Cache cache,
|
|
|
|
FTC_Image_Desc* desc,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Glyph* aglyph );
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-08-23 13:22:30 +02:00
|
|
|
|
|
|
|
#endif /* FTCIMAGE_H */
|
2000-08-23 19:32:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|