home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libimg / src / il.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.3 KB  |  158 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* -*- Mode: C; tab-width: 4 -*-
  20.  *   il.h --- Exported image library interface
  21.  *
  22.  *   $Id: il.h,v 3.1 1998/03/28 03:35:02 ltabb Exp $
  23.  */
  24.  
  25.  
  26. /*
  27.  *  global defines for image lib users
  28.  */
  29.  
  30. #ifndef _IL_H
  31. #define _IL_H
  32.  
  33. #include "ntypes.h"
  34.  
  35. /* attr values */
  36. #define IL_ATTR_RDONLY          0
  37. #define IL_ATTR_RW              1
  38. #define IL_ATTR_TRANSPARENT      2
  39. #define IL_ATTR_HONOR_INDEX   4
  40.  
  41. #undef ABS
  42. #define ABS(x)     (((x) < 0) ? -(x) : (x))
  43.  
  44. /* A fast but limited, perceptually-weighted color distance function */
  45. #define IL_COLOR_DISTANCE(r1, r2, g1, g2, b1, b2)                             \
  46.   ((ABS((g1) - (g2)) << 2) + (ABS((r1) - (r2)) << 1) + (ABS((b1) - (b2))))
  47.  
  48. /* We don't distinguish between colors that are "closer" together
  49.    than this.  The appropriate setting is a subjective matter. */
  50. #define IL_CLOSE_COLOR_THRESHOLD  6
  51.  
  52. #ifdef M12N                     /* Get rid of this */
  53. struct IL_Image_struct {
  54.     void XP_HUGE *bits;
  55.     int width, height;
  56.     int widthBytes, maskWidthBytes;
  57.     int depth, bytesPerPixel;
  58.     int colors;
  59.     int unique_colors;          /* Number of non-duplicated colors in colormap */
  60.     IL_RGB *map;
  61.     IL_IRGB *transparent;
  62.     void XP_HUGE *mask;
  63.     int validHeight;            /* number of valid scanlines */
  64.     void *platformData;            /* used by platform-specific FE */
  65.     Bool has_mask; 
  66.     Bool hasUniqueColormap;
  67. };
  68.  
  69. struct IL_IRGB_struct {
  70.     uint8 index, attr;
  71.     uint8 red, green, blue;
  72. };
  73.  
  74. struct IL_RGB_struct {
  75.     uint8 red, green, blue, pad;
  76.         /* windows requires the fourth byte & many compilers pad it anyway */
  77. };
  78. #endif /* M12N */
  79.  
  80.  
  81. XP_BEGIN_PROTOS
  82.  
  83. #ifndef M12N                    /* Get rid of these prototypes */
  84. extern Bool IL_ReplaceImage (MWContext *context, LO_ImageStruct *new_lo_image,
  85.                              LO_ImageStruct *old_lo_image);
  86.  
  87. extern IL_IRGB *IL_UpdateColorMap(MWContext *context, IL_IRGB *in,
  88.                                   int in_colors, int free_colors,
  89.                                   int *out_colors, IL_IRGB *transparent);
  90. extern int IL_RealizeDefaultColormap(MWContext *context, IL_IRGB *bgcolor,
  91.                                      int max_colors);
  92.  
  93. extern int IL_EnableTrueColor(MWContext *context, int bitsperpixel,
  94.                               int rshift, int gshift, int bshift,
  95.                               int rbits, int gbits, int bbits,
  96.                               IL_IRGB *transparent,
  97.                               int wild_wacky_rounding);
  98. extern int IL_GreyScale(MWContext *context, int depth, IL_IRGB *transparent);
  99. extern int IL_InitContext(MWContext *cx);
  100.  
  101. extern void IL_StartPage(MWContext *context);
  102. extern void IL_EndPage(MWContext *context);
  103.  
  104. extern void IL_DeleteImages(MWContext *cx);
  105.  
  106. extern void IL_SamePage(MWContext *cx);
  107.  
  108. extern int IL_Type(const char *buf, int32 len);
  109.  
  110. extern void IL_DisableScaling(MWContext *cx);
  111.  
  112. extern void IL_DisableLowSrc(MWContext *cx);
  113.  
  114. extern void IL_SetByteOrder(MWContext *cx, Bool ls_bit_first,
  115.                             Bool ls_byte_first);
  116.  
  117. extern int IL_SetTransparent(MWContext *cx, IL_IRGB *transparent);
  118.  
  119. extern void IL_NoMoreImages(MWContext *cx);
  120.  
  121. extern uint32 IL_ShrinkCache(void);
  122. extern uint32 IL_GetCacheSize(void);
  123. extern void IL_Shutdown(void);
  124.  
  125. extern int IL_ColormapTag(const char *image_url, MWContext* cx);
  126.  
  127. extern int IL_DisplayMemCacheInfoAsHTML(FO_Present_Types format_out,
  128.                                         URL_Struct *urls,
  129.                                         OPAQUE_CONTEXT *net_cx);
  130. extern void IL_ScourContext(MWContext *cx);
  131. extern void IL_SetImageCacheSize(uint32 new_size);
  132.  
  133. extern char *IL_HTMLImageInfo(char *url_address);
  134. extern void IL_UseDefaultColormapThisPage(MWContext *cx);
  135.  
  136. extern Bool IL_AreThereLoopingImagesForContext(MWContext *cx);
  137.  
  138.  
  139.  
  140. extern Bool IL_FreeImage (MWContext *context, IL_Image *portableImage,
  141.                           LO_ImageStruct *lo_image);
  142. extern void IL_SetColorRenderMode(MWContext *cx,
  143.                                   IL_ColorRenderMode color_render_mode);
  144. extern NET_StreamClass * IL_NewStream (FO_Present_Types format_out,
  145.                                        void *data_obj, URL_Struct *URL_s,
  146.                                        MWContext *context);
  147.  
  148. extern NET_StreamClass * IL_ViewStream (FO_Present_Types format_out,
  149.                                         void *data_obj, URL_Struct *URL_s,
  150.                                         MWContext *context);
  151. #endif /* M12N */
  152.  
  153. XP_END_PROTOS
  154.  
  155. #endif /* _IL_H */
  156.  
  157.  
  158.