Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / icon / icon_intern.h
blobdffb075249ecf7a5acef497293b2819fb384c087
1 #ifndef ICON_INTERN_H
2 #define ICON_INTERN_H
4 /*
5 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <exec/memory.h>
10 #include <exec/libraries.h>
11 #include <aros/asmcall.h>
12 #include <dos/dos.h>
13 #include <libraries/iffparse.h>
14 #include <cybergraphx/cybergraphics.h>
15 #include <workbench/workbench.h>
16 #include <workbench/icon.h>
17 #include <graphics/view.h>
19 #include <proto/alib.h>
20 #include <proto/exec.h>
21 #include <proto/intuition.h>
22 #include <proto/graphics.h>
23 #include <proto/icon.h>
24 #include <proto/iffparse.h>
25 #include <proto/utility.h>
26 #include <proto/cybergraphics.h>
27 #include <proto/dos.h>
29 #include <stddef.h>
31 #include <string.h>
32 #include <aros/libcall.h>
33 #include <aros/asmcall.h>
35 /****************************************************************************************/
37 /* Constants */
38 #define MAX_DEFICON_FILEPATH 256
40 /* Number of entries in the mementrys in the freelists */
41 #define FREELIST_MEMLISTENTRIES 10
43 #define ICONDUPA_JustLoadedFromDisk ICONA_Reserved1
45 #define ICONLIST_HASHSIZE 256
47 /****************************************************************************************/
49 /*
50 To get right alignment we make our very own memlist structure.
51 Look at the original struct MemList in <exec/memory.h> to see why.
54 struct IconInternalMemList
56 struct Node iiml_Node;
57 UWORD iiml_NumEntries;
58 struct MemEntry iiml_ME[FREELIST_MEMLISTENTRIES];
61 struct Image35
63 UBYTE *imagedata;
64 UBYTE *palette;
65 UBYTE *mask;
66 WORD numcolors;
67 WORD depth;
68 WORD flags;
69 UBYTE transparentcolor;
73 #define IMAGE35F_HASTRANSPARENTCOLOR 1
74 #define IMAGE35F_HASPALETTE 2
76 struct Icon35
78 struct Image35 img1;
79 struct Image35 img2;
80 WORD width;
81 WORD height;
82 WORD flags;
83 WORD aspect;
86 #define ICON35F_FRAMELESS 1
88 struct IconPNG
90 APTR handle;
91 APTR handle2;
92 UBYTE *filebuffer;
93 ULONG filebuffersize;
94 UBYTE *img1;
95 UBYTE *img2;
96 WORD width;
97 WORD height;
100 struct NativeIcon
102 struct MinNode node;
103 APTR pool;
104 struct DiskObject dobj;
105 ULONG readstruct_state;
106 struct Icon35 icon35;
107 struct IconPNG iconPNG;
108 APTR iconbase;
109 struct BitMap *iconbm1;
110 struct BitMap *iconbm2;
111 struct Screen *iconscr;
112 struct ViewPort *iconvp;
113 struct ColorMap *iconcm;
114 WORD iconbmwidth;
115 WORD iconbmheight;
116 WORD iconbmdepth;
119 #define RSS_OLDDRAWERDATA_READ (1 << 0)
120 #define RSS_GADGETIMAGE_READ (1 << 1)
121 #define RSS_SELECTIMAGE_READ (1 << 2)
122 #define RSS_DEFAULTTOOL_READ (1 << 3)
123 #define RSS_TOOLWINDOW_READ (1 << 4)
124 #define RSS_TOOLTYPES_READ (1 << 5)
126 #define NATIVEICON(icon) ((struct NativeIcon *)((UBYTE *)(icon) - offsetof(struct NativeIcon, dobj)))
128 struct IconBase
130 struct Library ib_Lib;
132 struct Library *pngbase;
133 struct Hook dsh;
134 struct SignalSemaphore iconlistlock;
135 struct MinList iconlists[ICONLIST_HASHSIZE];
137 APTR ib_MemoryPool;
138 ULONG ib_CRCTable[256];
139 BOOL ib_CRCTableComputed;
141 /* Global settings -----------------------------------------------------*/
142 struct Screen *ib_Screen;
143 LONG ib_Precision;
144 struct Rectangle ib_EmbossRectangle;
145 BOOL ib_Frameless;
146 struct Hook *ib_IdentifyHook;
147 LONG ib_MaxNameLength;
148 BOOL ib_NewIconsSupport;
149 BOOL ib_ColorIconSupport;
152 typedef struct IconBase IconBase_T;
154 #define PNGBase IconBase->pngbase
156 /****************************************************************************************/
158 extern struct ExecBase * SysBase;
159 extern struct DosLibrary * DOSBase;
161 /****************************************************************************************/
163 /* Internal prototypes */
164 AROS_UFP3(LONG, dosstreamhook,
165 AROS_UFPA(struct Hook *, hook, A0),
166 AROS_UFPA(BPTR, file, A2),
167 AROS_UFPA(ULONG *, msg, A1)
170 #include "support.h"
172 UBYTE * WriteValue (LONG, UBYTE *);
174 BOOL ReadIcon35(struct NativeIcon *icon, struct Hook *streamhook, void *stream, struct IconBase *IconBase);
175 BOOL WriteIcon35(struct NativeIcon *icon, struct Hook *streamhook, void *stream, struct IconBase *IconBase);
176 VOID FreeIcon35(struct NativeIcon *icon, struct IconBase *IconBase);
177 VOID MakeMask35(UBYTE *imgdata, UBYTE *imgmask, UBYTE transpcolor, LONG imagew, LONG imageh);
179 BOOL ReadIconNI(struct NativeIcon *icon, struct Hook *streamhook, void *stream, struct IconBase *IconBase);
180 BOOL WriteIconNI(struct NativeIcon *icon, struct Hook *streamhook, void *stream, struct IconBase *IconBase);
181 VOID FreeIconNI(struct NativeIcon *icon, struct IconBase *IconBase);
183 BOOL ReadIconPNG(struct DiskObject **ret, BPTR file, struct IconBase *IconBase);
184 BOOL WriteIconPNG(BPTR file, struct DiskObject *dobj, struct IconBase *IconBase);
185 VOID FreeIconPNG(struct DiskObject *dobj, struct IconBase *IconBase);
188 #define LB(ib) ((struct IconBase *) (ib))
190 #define POOL (((struct IconBase *) IconBase)->ib_MemoryPool)
192 #endif /* ICON_INTERN_H */