~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to packages/extra/amunits/otherlibs/render/units/render.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
  This file is part of the Free Pascal run time library.
3
 
 
4
 
  A file in Amiga system run time library.
5
 
  Copyright (c) 2003 by Nils Sj�holm.
6
 
  member of the Amiga RTL development team.
7
 
 
8
 
  This is a unit for render.library
9
 
 
10
 
  See the file COPYING.FPC, included in this distribution,
11
 
  for details about the copyright.
12
 
 
13
 
  This program is distributed in the hope that it will be useful,
14
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 
 
17
 
**********************************************************************}
18
 
{
19
 
  History:
20
 
  
21
 
  First version of this unit.
22
 
  16 Jan 2003.
23
 
  
24
 
  Changed cardinal > longword.
25
 
  Changed startcode for unit.
26
 
  12 Feb 2003
27
 
  
28
 
  nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
29
 
}
30
 
 
31
 
{$mode objfpc}
32
 
{$I useamigasmartlink.inc}
33
 
{$ifdef use_amiga_smartlink}
34
 
   {$smartlink on}
35
 
{$endif use_amiga_smartlink}
36
 
 
37
 
UNIT RENDER;
38
 
 
39
 
INTERFACE
40
 
USES Exec,utility,graphics;
41
 
 
42
 
VAR RenderBase : pLibrary;
43
 
 
44
 
type
45
 
    pPLANEPTR = ^PLANEPTR;
46
 
 
47
 
const
48
 
    RENDERNAME : PChar = 'render.library';
49
 
 
50
 
{
51
 
        $VER: render.h v40 (19.12.2002)
52
 
        render.library definitions
53
 
   }
54
 
 
55
 
  const
56
 
     RND_TAGBASE = TAG_USER + $1000;
57
 
  {
58
 
  
59
 
        memhandler
60
 
 
61
 
                                                                          }
62
 
  { type of memhandler, see below  }
63
 
     RND_MemType = RND_TAGBASE + 1;
64
 
  { ptr to block of memory  }
65
 
     RND_MemBlock = RND_TAGBASE + 2;
66
 
  { size of memblock [bytes]  }
67
 
     RND_MemSize = RND_TAGBASE + 3;
68
 
  { memflags (exec/memory.h)  }
69
 
     RND_MemFlags = RND_TAGBASE + 18;
70
 
  { to pass a memhandler as an argument  }
71
 
     RND_RMHandler = RND_TAGBASE + 12;
72
 
  {
73
 
        memhandler types
74
 
    }
75
 
  { v39 exec dynamic pool  }
76
 
     RMHTYPE_POOL = 1;
77
 
  { private memory pool  }
78
 
     RMHTYPE_PRIVATE = 2;
79
 
  { common public memory  }
80
 
     RMHTYPE_PUBLIC = 3;
81
 
  {
82
 
 
83
 
        palette
84
 
 
85
 
                                                                          }
86
 
  { palette import/export format  }
87
 
     RND_PaletteFormat = RND_TAGBASE + 19;
88
 
  { tag to indicate a palette is EHB  }
89
 
     RND_EHBPalette = RND_TAGBASE + 22;
90
 
  { first palette entry  }
91
 
     RND_FirstColor = RND_TAGBASE + 23;
92
 
  { dispose the old palette and load a new one  }
93
 
     RND_NewPalette = RND_TAGBASE + 24;
94
 
  { quantization factors  }
95
 
     RND_RGBWeight = RND_TAGBASE + 11;
96
 
  {
97
 
        palette format types
98
 
    }
99
 
  { ULONG red,green,blue  }
100
 
     PALFMT_RGB32 = 1;
101
 
  { ULONG 0x00rrggbb  }
102
 
     PALFMT_RGB8 = 2;
103
 
  { UWORD 0xrgb  }
104
 
     PALFMT_RGB4 = 3;
105
 
  { render.library palette  }
106
 
     PALFMT_PALETTE = 4;
107
 
  {
108
 
        palette sort mode types
109
 
        for the use with SortPalette()
110
 
    }
111
 
  { no particular order  }
112
 
     PALMODE_NONE = $0000;
113
 
  { sort palette entries by brightness  }
114
 
     PALMODE_BRIGHTNESS = $0001;
115
 
  { sort palette entries by the number of pixels that they represent.
116
 
           You must supply the RND_Histogram taglist argument.  }
117
 
     PALMODE_POPULARITY = $0002;
118
 
  { sort palette entries by the number of histogram entries that they
119
 
           represent. You must supply the RND_Histogram taglist argument.  }
120
 
     PALMODE_REPRESENTATION = $0003;
121
 
  { sort palette entries by their optical significance for the human
122
 
           eye. Implementation is unknown to you and may change.
123
 
           You must supply the RND_Histogram taglist argument.  }
124
 
     PALMODE_SIGNIFICANCE = $0004;
125
 
  { sort palette entries by color intensity  }
126
 
     PALMODE_SATURATION = $0005;
127
 
  { By default, sort direction is descending, i.e. the precedence is
128
 
           more-to-less. Combine with this flag to invert the sort direction.  }
129
 
     PALMODE_ASCENDING = $0008;
130
 
  {
131
 
  
132
 
        histogram related
133
 
  
134
 
                                                                          }
135
 
  { histogram type, see below  }
136
 
     RND_HSType = RND_TAGBASE + 4;
137
 
  { a histogram as an argument  }
138
 
     RND_Histogram = RND_TAGBASE + 9;
139
 
  {
140
 
        Histogram / Palette types
141
 
        to be specified with RND_HSType
142
 
    }
143
 
  { 12bit dynamic histogram  }
144
 
     HSTYPE_12BIT = 4;
145
 
  { 15bit dynamic histogram  }
146
 
     HSTYPE_15BIT = 5;
147
 
  { 18bit dynamic histogram  }
148
 
     HSTYPE_18BIT = 6;
149
 
  { 21bit dynamic histogram  }
150
 
     HSTYPE_21BIT = 7;
151
 
  { 24bit dynamic histogram  }
152
 
     HSTYPE_24BIT = 8;
153
 
  { 12bit tabular histogram  }
154
 
     HSTYPE_12BIT_TURBO = 20;
155
 
  { 15bit tabular histogram  }
156
 
     HSTYPE_15BIT_TURBO = 21;
157
 
  { 18bit tabular histogram  }
158
 
     HSTYPE_18BIT_TURBO = 22;
159
 
  {
160
 
        tags that can be queried via QueryHistogram()
161
 
    }
162
 
  { # pixels in a histogram  }
163
 
     RND_NumPixels = RND_TAGBASE + 5;
164
 
  { # colors in a histogram  }
165
 
     RND_NumColors = RND_TAGBASE + 6;
166
 
  {
167
 
  
168
 
        rendering and conversions
169
 
  
170
 
                                                                          }
171
 
  { color mode, see below  }
172
 
     RND_ColorMode = RND_TAGBASE + 7;
173
 
  { dither mode, see below  }
174
 
     RND_DitherMode = RND_TAGBASE + 8;
175
 
  { dither amount  }
176
 
     RND_DitherAmount = RND_TAGBASE + 26;
177
 
  { first color index to be output  }
178
 
     RND_OffsetColorZero = RND_TAGBASE + 10;
179
 
  {
180
 
        color mode types
181
 
        to be specified with RND_ColorMode
182
 
    }
183
 
  { normal palette lookup  }
184
 
     COLORMODE_CLUT = $0000;
185
 
  { HAM8 mode  }
186
 
     COLORMODE_HAM8 = $0001;
187
 
  { HAM6 mode  }
188
 
     COLORMODE_HAM6 = $0002;
189
 
  { mask to determine COLORMODE  }
190
 
     COLORMODE_MASK = $0003;
191
 
  {
192
 
        dither mode types
193
 
        to be specified with RND_DitherMode
194
 
    }
195
 
  { no dither  }
196
 
     DITHERMODE_NONE = $0000;
197
 
  { Floyd-Steinberg dither  }
198
 
     DITHERMODE_FS = $0001;
199
 
  { random dither. amount required.  }
200
 
     DITHERMODE_RANDOM = $0002;
201
 
  { EDD dither  }
202
 
     DITHERMODE_EDD = $0003;
203
 
  {                                                                       
204
 
 
205
 
        miscellaneous
206
 
 
207
 
                                                                          }
208
 
  { progress callback hook  }
209
 
     RND_ProgressHook = RND_TAGBASE + 13;
210
 
  { total input width [pixels]  }
211
 
     RND_SourceWidth = RND_TAGBASE + 14;
212
 
  { total output width [pixels]  }
213
 
     RND_DestWidth = RND_TAGBASE + 15;
214
 
  { ptr to a chunky conversion table  }
215
 
     RND_PenTable = RND_TAGBASE + 16;
216
 
  { chunky data left edge [pixels]  }
217
 
     RND_LeftEdge = RND_TAGBASE + 17;
218
 
  { line callback hook  }
219
 
     RND_LineHook = RND_TAGBASE + 20;
220
 
  { Mapping-Engine  }
221
 
     RND_MapEngine = RND_TAGBASE + 27;
222
 
  { Interleave  }
223
 
     RND_Interleave = RND_TAGBASE + 28;
224
 
  { Palette  }
225
 
     RND_Palette = RND_TAGBASE + 29;
226
 
  { Weight factor  }
227
 
     RND_Weight = RND_TAGBASE + 30;
228
 
  { ScaleEngine  }
229
 
     RND_ScaleEngine = RND_TAGBASE + 31;
230
 
  { Texture coordinates  }
231
 
     RND_DestCoordinates = RND_TAGBASE + 42;
232
 
  { backcolor for filling  }
233
 
     RND_BGColor = RND_TAGBASE + 43;
234
 
  { backpen for filling  }
235
 
     RND_BGPen = RND_TAGBASE + 44;
236
 
  {
237
 
  
238
 
        alpha-channel and masking
239
 
  
240
 
                                                                          }
241
 
  { custom alpha-channel  }
242
 
     RND_AlphaChannel = RND_TAGBASE + 32;
243
 
  { bytes between alpha-channel pixels  }
244
 
     RND_AlphaModulo = RND_TAGBASE + 33;
245
 
  { width of alpha-channel array  }
246
 
     RND_AlphaWidth = RND_TAGBASE + 34;
247
 
  { masking RGB for CreateAlphaArray  }
248
 
     RND_MaskRGB = RND_TAGBASE + 35;
249
 
  { mask value for outside color range  }
250
 
     RND_MaskFalse = RND_TAGBASE + 36;
251
 
  { mask value for inside color range  }
252
 
     RND_MaskTrue = RND_TAGBASE + 37;
253
 
  { total source width for 3channel operations  }
254
 
     RND_SourceWidth2 = RND_TAGBASE + 38;
255
 
  { second custom alpha-channel  }
256
 
     RND_AlphaChannel2 = RND_TAGBASE + 39;
257
 
  { pixel modulo for a second alpha-channel  }
258
 
     RND_AlphaModulo2 = RND_TAGBASE + 40;
259
 
  { width of a second alpha-channel array  }
260
 
     RND_AlphaWidth2 = RND_TAGBASE + 41;
261
 
  {                                                                       
262
 
 
263
 
        PixelFormat
264
 
 
265
 
                                                                          }
266
 
  { pixel format, see below  }
267
 
     RND_PixelFormat = RND_TAGBASE + 25;
268
 
     PIXFMTB_CHUNKY = 3;
269
 
     PIXFMTB_BITMAP = 4;
270
 
     PIXFMTB_RGB = 5;
271
 
     PIXFMT_CHUNKY_CLUT = (1 shl PIXFMTB_CHUNKY) + COLORMODE_CLUT;
272
 
     PIXFMT_0RGB_32 = (1 shl PIXFMTB_RGB) + 0;
273
 
  {
274
 
        these types are currently not used by render.library, but
275
 
        some of them are applicable for guigfx.library functions:
276
 
    }
277
 
     PIXFMT_CHUNKY_HAM8 = (1 shl PIXFMTB_CHUNKY) + COLORMODE_HAM8;
278
 
     PIXFMT_CHUNKY_HAM6 = (1 shl PIXFMTB_CHUNKY) + COLORMODE_HAM6;
279
 
     PIXFMT_BITMAP_CLUT = (1 shl PIXFMTB_BITMAP) + COLORMODE_CLUT;
280
 
     PIXFMT_BITMAP_HAM8 = (1 shl PIXFMTB_BITMAP) + COLORMODE_HAM8;
281
 
     PIXFMT_BITMAP_HAM6 = (1 shl PIXFMTB_BITMAP) + COLORMODE_HAM6;
282
 
     PIXFMT_RGB_24 = (1 shl PIXFMTB_RGB) + 1;
283
 
  {
284
 
        strictly internal:
285
 
    }
286
 
     PIXFMT_BITMAP_RGB = (1 shl PIXFMTB_BITMAP) + (1 shl PIXFMTB_RGB);
287
 
  {
288
 
  
289
 
        ExtractPalette return codes
290
 
  
291
 
        You must at least check for EXTP_SUCCESS.
292
 
        EXTP_NO_DATA indicates that there were no colors
293
 
        in the histogram.
294
 
 
295
 
                                                                          }
296
 
     EXTP_SUCCESS = 0;
297
 
     EXTP_NOT_ENOUGH_MEMORY = 1;
298
 
     EXTP_CALLBACK_ABORTED = 2;
299
 
     EXTP_NO_DATA = 3;
300
 
  {
301
 
  
302
 
        AddRGB, AddRGBImage and AddChunkyImage return codes
303
 
  
304
 
        You must at least check for ADDH_SUCCESS.
305
 
        If not delivered, the histogram might be
306
 
        inaccurate.
307
 
  
308
 
                                                                          }
309
 
     ADDH_SUCCESS = 0;
310
 
     ADDH_NOT_ENOUGH_MEMORY = 1;
311
 
     ADDH_CALLBACK_ABORTED = 2;
312
 
     ADDH_NO_DATA = 3;
313
 
  {                                                                       
314
 
 
315
 
        Render return codes
316
 
 
317
 
        You must at least check for REND_SUCCESS.
318
 
        If not delivered, the image has not been
319
 
        rendered completely.
320
 
 
321
 
                                                                          }
322
 
     REND_SUCCESS = 0;
323
 
     REND_NOT_ENOUGH_MEMORY = 1;
324
 
     REND_CALLBACK_ABORTED = 2;
325
 
     REND_NO_VALID_PALETTE = 3;
326
 
     REND_NO_DATA = 3;
327
 
  {                                                                       
328
 
 
329
 
        SortPalette return codes
330
 
 
331
 
        You must at least check for SORTP_SUCCESS.
332
 
        SORTP_NO_DATA indicates that there were data missing,
333
 
        e.g. you specified no histogram or the histogram was empty.
334
 
 
335
 
                                                                          }
336
 
     SORTP_SUCCESS = 0;
337
 
     SORTP_NO_DATA = 1;
338
 
     SORTP_NOT_ENOUGH_MEMORY = 2;
339
 
     SORTP_NOT_IMPLEMENTED = 3;
340
 
  {
341
 
  
342
 
        conversion return codes
343
 
  
344
 
        These return codes apply to conversion functions
345
 
        such as Chunky2RGB and ConvertChunky.
346
 
 
347
 
                                                                          }
348
 
     CONV_SUCCESS = 0;
349
 
     CONV_CALLBACK_ABORTED = 1;
350
 
     CONV_NOT_ENOUGH_MEMORY = 2;
351
 
     CONV_NO_DATA = 3;
352
 
 
353
 
 
354
 
    
355
 
 
356
 
 
357
 
FUNCTION AddChunkyImageA(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; taglist : pTagItem) : longword;
358
 
FUNCTION AddHistogramA(histogram1 : POINTER; histogram2 : POINTER; taglist : pTagItem) : longword;
359
 
FUNCTION AddRGB(histogram : POINTER; RGB : longword; count : longword) : longword;
360
 
FUNCTION AddRGBImageA(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : longword;
361
 
FUNCTION AllocRenderMem(rendermemhandler : POINTER; size : longword) : POINTER;
362
 
FUNCTION AllocRenderVec(rendermemhandler : POINTER; size : longword) : POINTER;
363
 
FUNCTION AllocRenderVecClear(rendermemhandler : POINTER; size : longword) : POINTER;
364
 
PROCEDURE ApplyAlphaChannelA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; taglist : pTagItem);
365
 
FUNCTION BestPen(palette : POINTER; rgb : longword) : LONGINT;
366
 
PROCEDURE Chunky2BitMapA(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; taglist : pTagItem);
367
 
FUNCTION Chunky2RGBA(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; taglist : pTagItem) : longword;
368
 
FUNCTION ChunkyArrayDiversityA(chunky : pByte; palette : POINTER; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
369
 
FUNCTION ConvertChunkyA(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; taglist : pTagItem) : longword;
370
 
FUNCTION CountRGB(histogram : POINTER; rgb : longword) : longword;
371
 
PROCEDURE CreateAlphaArrayA(rgbarray : pULONG; width : WORD; height : WORD; taglist : pTagItem);
372
 
FUNCTION CreateHistogramA(taglist : pTagItem) : POINTER;
373
 
FUNCTION CreateMapEngineA(palette : POINTER; taglist : pTagItem) : POINTER;
374
 
FUNCTION CreatePaletteA(taglist : pTagItem) : POINTER;
375
 
PROCEDURE CreatePenTableA(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; taglist : pTagItem);
376
 
FUNCTION CreateRMHandlerA(taglist : pTagItem) : POINTER;
377
 
FUNCTION CreateScaleEngineA(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; taglist : pTagItem) : POINTER;
378
 
PROCEDURE DeleteHistogram(histogram : POINTER);
379
 
PROCEDURE DeleteMapEngine(engine : POINTER);
380
 
PROCEDURE DeletePalette(palette : POINTER);
381
 
PROCEDURE DeleteRMHandler(rmh : POINTER);
382
 
PROCEDURE DeleteScaleEngine(engine : POINTER);
383
 
PROCEDURE ExportPaletteA(palette : POINTER; coltab : POINTER; taglist : pTagItem);
384
 
PROCEDURE ExtractAlphaChannelA(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; taglist : pTagItem);
385
 
FUNCTION ExtractPaletteA(histogram : POINTER; palette : pULONG; numcolors : WORD; taglist : pTagItem) : longword;
386
 
PROCEDURE FlushPalette(palette : POINTER);
387
 
PROCEDURE FreeRenderMem(rendermemhandler : POINTER; mem : POINTER; size : longword);
388
 
PROCEDURE FreeRenderVec(mem : POINTER);
389
 
PROCEDURE ImportPaletteA(palette : POINTER; coltab : POINTER; numcols : WORD; taglist : pTagItem);
390
 
PROCEDURE InsertAlphaChannelA(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; taglist : pTagItem);
391
 
FUNCTION MapChunkyArrayA(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; taglist : pTagItem) : longword;
392
 
FUNCTION MapRGBArrayA(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; taglist : pTagItem) : longword;
393
 
PROCEDURE MixAlphaChannelA(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; taglist : pTagItem);
394
 
PROCEDURE MixRGBArrayA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; taglist : pTagItem);
395
 
PROCEDURE Planar2ChunkyA(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; taglist : pTagItem);
396
 
FUNCTION QueryHistogram(histogram : POINTER; d0arg : longword) : longword;
397
 
FUNCTION RenderA(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; taglist : pTagItem) : longword;
398
 
FUNCTION RGBArrayDiversityA(rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
399
 
FUNCTION ScaleA(engine : POINTER; source : POINTER; dest : POINTER; taglist : pTagItem) : longword;
400
 
FUNCTION ScaleOrdinate(source : WORD; dest : WORD; ordinate : WORD) : WORD;
401
 
FUNCTION SortPaletteA(palette : POINTER; mode : longword; taglist : pTagItem) : longword;
402
 
PROCEDURE TintRGBArrayA(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; taglist : pTagItem);
403
 
{
404
 
 Functions and procedures with array of const go here
405
 
}
406
 
FUNCTION AddChunkyImage(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; const taglist : Array Of Const) : longword;
407
 
FUNCTION AddHistogram(histogram1 : POINTER; histogram2 : POINTER; const taglist : Array Of Const) : longword;
408
 
FUNCTION AddRGBImage(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : longword;
409
 
PROCEDURE ApplyAlphaChannel(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; const taglist : Array Of Const);
410
 
PROCEDURE Chunky2BitMap(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; const taglist : Array Of Const);
411
 
FUNCTION Chunky2RGB(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; const taglist : Array Of Const) : longword;
412
 
FUNCTION ChunkyArrayDiversity(chunky : pByte; palette : POINTER; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
413
 
FUNCTION ConvertChunky(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; const taglist : Array Of Const) : longword;
414
 
PROCEDURE CreateAlphaArray(rgbarray : pULONG; width : WORD; height : WORD; const taglist : Array Of Const);
415
 
FUNCTION CreateHistogram(const taglist : Array Of Const) : POINTER;
416
 
FUNCTION CreateMapEngine(palette : POINTER; const taglist : Array Of Const) : POINTER;
417
 
FUNCTION CreatePalette(const taglist : Array Of Const) : POINTER;
418
 
PROCEDURE CreatePenTable(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; const taglist : Array Of Const);
419
 
FUNCTION CreateRMHandler(const taglist : Array Of Const) : POINTER;
420
 
FUNCTION CreateScaleEngine(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; const taglist : Array Of Const) : POINTER;
421
 
PROCEDURE ExportPalette(palette : POINTER; coltab : POINTER; const taglist : Array Of Const);
422
 
PROCEDURE ExtractAlphaChannel(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; const taglist : Array Of Const);
423
 
FUNCTION ExtractPalette(histogram : POINTER; palette : pULONG; numcolors : WORD; const taglist : Array Of Const) : longword;
424
 
PROCEDURE ImportPalette(palette : POINTER; coltab : POINTER; numcols : WORD; const taglist : Array Of Const);
425
 
PROCEDURE InsertAlphaChannel(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; const taglist : Array Of Const);
426
 
FUNCTION MapChunkyArray(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; const taglist : Array Of Const) : longword;
427
 
FUNCTION MapRGBArray(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; const taglist : Array Of Const) : longword;
428
 
PROCEDURE MixAlphaChannel(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; const taglist : Array Of Const);
429
 
PROCEDURE MixRGBArray(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; const taglist : Array Of Const);
430
 
PROCEDURE Planar2Chunky(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; const taglist : Array Of Const);
431
 
FUNCTION RenderTags(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; const taglist : Array Of Const) : longword;
432
 
FUNCTION RGBArrayDiversity(rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
433
 
FUNCTION Scale(engine : POINTER; source : POINTER; dest : POINTER; const taglist : Array Of Const) : longword;
434
 
FUNCTION SortPalette(palette : POINTER; mode : longword; const taglist : Array Of Const) : longword;
435
 
PROCEDURE TintRGBArray(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; const taglist : Array Of Const);
436
 
 
437
 
{You can remove this include and use a define instead}
438
 
{$I useautoopenlib.inc}
439
 
{$ifdef use_init_openlib}
440
 
procedure InitRENDERLibrary;
441
 
{$endif use_init_openlib}
442
 
 
443
 
{This is a variable that knows how the unit is compiled}
444
 
var
445
 
    RENDERIsCompiledHow : longint;
446
 
 
447
 
IMPLEMENTATION
448
 
 
449
 
uses
450
 
{$ifndef dont_use_openlib}
451
 
msgbox,
452
 
{$endif dont_use_openlib}
453
 
tagsarray;
454
 
 
455
 
FUNCTION AddChunkyImageA(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; taglist : pTagItem) : longword;
456
 
BEGIN
457
 
  ASM
458
 
        MOVE.L  A6,-(A7)
459
 
        MOVEA.L histogram,A0
460
 
        MOVEA.L chunky,A1
461
 
        MOVE.L  width,D0
462
 
        MOVE.L  height,D1
463
 
        MOVEA.L palette,A2
464
 
        MOVEA.L taglist,A3
465
 
        MOVEA.L RenderBase,A6
466
 
        JSR     -108(A6)
467
 
        MOVEA.L (A7)+,A6
468
 
        MOVE.L  D0,@RESULT
469
 
  END;
470
 
END;
471
 
 
472
 
FUNCTION AddHistogramA(histogram1 : POINTER; histogram2 : POINTER; taglist : pTagItem) : longword;
473
 
BEGIN
474
 
  ASM
475
 
        MOVE.L  A6,-(A7)
476
 
        MOVEA.L histogram1,A0
477
 
        MOVEA.L histogram2,A1
478
 
        MOVEA.L taglist,A2
479
 
        MOVEA.L RenderBase,A6
480
 
        JSR     -222(A6)
481
 
        MOVEA.L (A7)+,A6
482
 
        MOVE.L  D0,@RESULT
483
 
  END;
484
 
END;
485
 
 
486
 
FUNCTION AddRGB(histogram : POINTER; RGB : longword; count : longword) : longword;
487
 
BEGIN
488
 
  ASM
489
 
        MOVE.L  A6,-(A7)
490
 
        MOVEA.L histogram,A0
491
 
        MOVE.L  RGB,D0
492
 
        MOVE.L  count,D1
493
 
        MOVEA.L RenderBase,A6
494
 
        JSR     -096(A6)
495
 
        MOVEA.L (A7)+,A6
496
 
        MOVE.L  D0,@RESULT
497
 
  END;
498
 
END;
499
 
 
500
 
FUNCTION AddRGBImageA(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : longword;
501
 
BEGIN
502
 
  ASM
503
 
        MOVE.L  A6,-(A7)
504
 
        MOVEA.L histogram,A0
505
 
        MOVEA.L rgb,A1
506
 
        MOVE.L  width,D0
507
 
        MOVE.L  height,D1
508
 
        MOVEA.L taglist,A2
509
 
        MOVEA.L RenderBase,A6
510
 
        JSR     -102(A6)
511
 
        MOVEA.L (A7)+,A6
512
 
        MOVE.L  D0,@RESULT
513
 
  END;
514
 
END;
515
 
 
516
 
FUNCTION AllocRenderMem(rendermemhandler : POINTER; size : longword) : POINTER;
517
 
BEGIN
518
 
  ASM
519
 
        MOVE.L  A6,-(A7)
520
 
        MOVEA.L rendermemhandler,A0
521
 
        MOVE.L  size,D0
522
 
        MOVEA.L RenderBase,A6
523
 
        JSR     -054(A6)
524
 
        MOVEA.L (A7)+,A6
525
 
        MOVE.L  D0,@RESULT
526
 
  END;
527
 
END;
528
 
 
529
 
FUNCTION AllocRenderVec(rendermemhandler : POINTER; size : longword) : POINTER;
530
 
BEGIN
531
 
  ASM
532
 
        MOVE.L  A6,-(A7)
533
 
        MOVEA.L rendermemhandler,A0
534
 
        MOVE.L  size,D0
535
 
        MOVEA.L RenderBase,A6
536
 
        JSR     -066(A6)
537
 
        MOVEA.L (A7)+,A6
538
 
        MOVE.L  D0,@RESULT
539
 
  END;
540
 
END;
541
 
 
542
 
FUNCTION AllocRenderVecClear(rendermemhandler : POINTER; size : longword) : POINTER;
543
 
BEGIN
544
 
  ASM
545
 
        MOVE.L  A6,-(A7)
546
 
        MOVEA.L rendermemhandler,A0
547
 
        MOVE.L  size,D0
548
 
        MOVEA.L RenderBase,A6
549
 
        JSR     -306(A6)
550
 
        MOVEA.L (A7)+,A6
551
 
        MOVE.L  D0,@RESULT
552
 
  END;
553
 
END;
554
 
 
555
 
PROCEDURE ApplyAlphaChannelA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; taglist : pTagItem);
556
 
BEGIN
557
 
  ASM
558
 
        MOVE.L  A6,-(A7)
559
 
        MOVEA.L sourcearray,A0
560
 
        MOVE.L  width,D0
561
 
        MOVE.L  height,D1
562
 
        MOVEA.L destarray,A1
563
 
        MOVEA.L taglist,A2
564
 
        MOVEA.L RenderBase,A6
565
 
        JSR     -294(A6)
566
 
        MOVEA.L (A7)+,A6
567
 
  END;
568
 
END;
569
 
 
570
 
FUNCTION BestPen(palette : POINTER; rgb : longword) : LONGINT;
571
 
BEGIN
572
 
  ASM
573
 
        MOVE.L  A6,-(A7)
574
 
        MOVEA.L palette,A0
575
 
        MOVE.L  rgb,D0
576
 
        MOVEA.L RenderBase,A6
577
 
        JSR     -204(A6)
578
 
        MOVEA.L (A7)+,A6
579
 
        MOVE.L  D0,@RESULT
580
 
  END;
581
 
END;
582
 
 
583
 
PROCEDURE Chunky2BitMapA(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; taglist : pTagItem);
584
 
BEGIN
585
 
  ASM
586
 
        MOVE.L  A6,-(A7)
587
 
        MOVEA.L chunky,A0
588
 
        MOVE.L  sx,D0
589
 
        MOVE.L  sy,D1
590
 
        MOVE.L  width,D2
591
 
        MOVE.L  height,D3
592
 
        MOVEA.L bitmap,A1
593
 
        MOVE.L  dx,D4
594
 
        MOVE.L  dy,D5
595
 
        MOVEA.L taglist,A2
596
 
        MOVEA.L RenderBase,A6
597
 
        JSR     -138(A6)
598
 
        MOVEA.L (A7)+,A6
599
 
  END;
600
 
END;
601
 
 
602
 
FUNCTION Chunky2RGBA(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; taglist : pTagItem) : longword;
603
 
BEGIN
604
 
  ASM
605
 
        MOVE.L  A6,-(A7)
606
 
        MOVEA.L chunky,A0
607
 
        MOVE.L  width,D0
608
 
        MOVE.L  height,D1
609
 
        MOVEA.L rgb,A1
610
 
        MOVEA.L palette,A2
611
 
        MOVEA.L taglist,A3
612
 
        MOVEA.L RenderBase,A6
613
 
        JSR     -132(A6)
614
 
        MOVEA.L (A7)+,A6
615
 
        MOVE.L  D0,@RESULT
616
 
  END;
617
 
END;
618
 
 
619
 
FUNCTION ChunkyArrayDiversityA(chunky : pByte; palette : POINTER; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
620
 
BEGIN
621
 
  ASM
622
 
        MOVE.L  A6,-(A7)
623
 
        MOVEA.L chunky,A0
624
 
        MOVEA.L palette,A1
625
 
        MOVE.L  width,D0
626
 
        MOVE.L  height,D1
627
 
        MOVEA.L taglist,A2
628
 
        MOVEA.L RenderBase,A6
629
 
        JSR     -270(A6)
630
 
        MOVEA.L (A7)+,A6
631
 
        MOVE.L  D0,@RESULT
632
 
  END;
633
 
END;
634
 
 
635
 
FUNCTION ConvertChunkyA(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; taglist : pTagItem) : longword;
636
 
BEGIN
637
 
  ASM
638
 
        MOVE.L  A6,-(A7)
639
 
        MOVEA.L source,A0
640
 
        MOVEA.L oldpalette,A1
641
 
        MOVE.L  width,D0
642
 
        MOVE.L  height,D1
643
 
        MOVEA.L dest,A2
644
 
        MOVEA.L newpalette,A3
645
 
        MOVEA.L taglist,A4
646
 
        MOVEA.L RenderBase,A6
647
 
        JSR     -162(A6)
648
 
        MOVEA.L (A7)+,A6
649
 
        MOVE.L  D0,@RESULT
650
 
  END;
651
 
END;
652
 
 
653
 
FUNCTION CountRGB(histogram : POINTER; rgb : longword) : longword;
654
 
BEGIN
655
 
  ASM
656
 
        MOVE.L  A6,-(A7)
657
 
        MOVEA.L histogram,A0
658
 
        MOVE.L  rgb,D0
659
 
        MOVEA.L RenderBase,A6
660
 
        JSR     -198(A6)
661
 
        MOVEA.L (A7)+,A6
662
 
        MOVE.L  D0,@RESULT
663
 
  END;
664
 
END;
665
 
 
666
 
PROCEDURE CreateAlphaArrayA(rgbarray : pULONG; width : WORD; height : WORD; taglist : pTagItem);
667
 
BEGIN
668
 
  ASM
669
 
        MOVE.L  A6,-(A7)
670
 
        MOVEA.L rgbarray,A0
671
 
        MOVE.L  width,D0
672
 
        MOVE.L  height,D1
673
 
        MOVEA.L taglist,A1
674
 
        MOVEA.L RenderBase,A6
675
 
        JSR     -312(A6)
676
 
        MOVEA.L (A7)+,A6
677
 
  END;
678
 
END;
679
 
 
680
 
FUNCTION CreateHistogramA(taglist : pTagItem) : POINTER;
681
 
BEGIN
682
 
  ASM
683
 
        MOVE.L  A6,-(A7)
684
 
        MOVEA.L taglist,A1
685
 
        MOVEA.L RenderBase,A6
686
 
        JSR     -078(A6)
687
 
        MOVEA.L (A7)+,A6
688
 
        MOVE.L  D0,@RESULT
689
 
  END;
690
 
END;
691
 
 
692
 
FUNCTION CreateMapEngineA(palette : POINTER; taglist : pTagItem) : POINTER;
693
 
BEGIN
694
 
  ASM
695
 
        MOVE.L  A6,-(A7)
696
 
        MOVEA.L palette,A0
697
 
        MOVEA.L taglist,A1
698
 
        MOVEA.L RenderBase,A6
699
 
        JSR     -246(A6)
700
 
        MOVEA.L (A7)+,A6
701
 
        MOVE.L  D0,@RESULT
702
 
  END;
703
 
END;
704
 
 
705
 
FUNCTION CreatePaletteA(taglist : pTagItem) : POINTER;
706
 
BEGIN
707
 
  ASM
708
 
        MOVE.L  A6,-(A7)
709
 
        MOVEA.L taglist,A1
710
 
        MOVEA.L RenderBase,A6
711
 
        JSR     -174(A6)
712
 
        MOVEA.L (A7)+,A6
713
 
        MOVE.L  D0,@RESULT
714
 
  END;
715
 
END;
716
 
 
717
 
PROCEDURE CreatePenTableA(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; taglist : pTagItem);
718
 
BEGIN
719
 
  ASM
720
 
        MOVE.L  A6,-(A7)
721
 
        MOVEA.L chunky,A0
722
 
        MOVEA.L oldpalette,A1
723
 
        MOVE.L  width,D0
724
 
        MOVE.L  height,D1
725
 
        MOVEA.L newpalette,A2
726
 
        MOVEA.L convtab,A3
727
 
        MOVEA.L taglist,A4
728
 
        MOVEA.L RenderBase,A6
729
 
        JSR     -168(A6)
730
 
        MOVEA.L (A7)+,A6
731
 
  END;
732
 
END;
733
 
 
734
 
FUNCTION CreateRMHandlerA(taglist : pTagItem) : POINTER;
735
 
BEGIN
736
 
  ASM
737
 
        MOVE.L  A6,-(A7)
738
 
        MOVEA.L taglist,A1
739
 
        MOVEA.L RenderBase,A6
740
 
        JSR     -042(A6)
741
 
        MOVEA.L (A7)+,A6
742
 
        MOVE.L  D0,@RESULT
743
 
  END;
744
 
END;
745
 
 
746
 
FUNCTION CreateScaleEngineA(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; taglist : pTagItem) : POINTER;
747
 
BEGIN
748
 
  ASM
749
 
        MOVE.L  A6,-(A7)
750
 
        MOVE.L  sourcewidth,D0
751
 
        MOVE.L  sourceheight,D1
752
 
        MOVE.L  destwidth,D2
753
 
        MOVE.L  destheight,D3
754
 
        MOVEA.L taglist,A1
755
 
        MOVEA.L RenderBase,A6
756
 
        JSR     -144(A6)
757
 
        MOVEA.L (A7)+,A6
758
 
        MOVE.L  D0,@RESULT
759
 
  END;
760
 
END;
761
 
 
762
 
PROCEDURE DeleteHistogram(histogram : POINTER);
763
 
BEGIN
764
 
  ASM
765
 
        MOVE.L  A6,-(A7)
766
 
        MOVEA.L histogram,A0
767
 
        MOVEA.L RenderBase,A6
768
 
        JSR     -084(A6)
769
 
        MOVEA.L (A7)+,A6
770
 
  END;
771
 
END;
772
 
 
773
 
PROCEDURE DeleteMapEngine(engine : POINTER);
774
 
BEGIN
775
 
  ASM
776
 
        MOVE.L  A6,-(A7)
777
 
        MOVEA.L engine,A0
778
 
        MOVEA.L RenderBase,A6
779
 
        JSR     -252(A6)
780
 
        MOVEA.L (A7)+,A6
781
 
  END;
782
 
END;
783
 
 
784
 
PROCEDURE DeletePalette(palette : POINTER);
785
 
BEGIN
786
 
  ASM
787
 
        MOVE.L  A6,-(A7)
788
 
        MOVEA.L palette,A0
789
 
        MOVEA.L RenderBase,A6
790
 
        JSR     -180(A6)
791
 
        MOVEA.L (A7)+,A6
792
 
  END;
793
 
END;
794
 
 
795
 
PROCEDURE DeleteRMHandler(rmh : POINTER);
796
 
BEGIN
797
 
  ASM
798
 
        MOVE.L  A6,-(A7)
799
 
        MOVEA.L rmh,A0
800
 
        MOVEA.L RenderBase,A6
801
 
        JSR     -048(A6)
802
 
        MOVEA.L (A7)+,A6
803
 
  END;
804
 
END;
805
 
 
806
 
PROCEDURE DeleteScaleEngine(engine : POINTER);
807
 
BEGIN
808
 
  ASM
809
 
        MOVE.L  A6,-(A7)
810
 
        MOVEA.L engine,A0
811
 
        MOVEA.L RenderBase,A6
812
 
        JSR     -150(A6)
813
 
        MOVEA.L (A7)+,A6
814
 
  END;
815
 
END;
816
 
 
817
 
PROCEDURE ExportPaletteA(palette : POINTER; coltab : POINTER; taglist : pTagItem);
818
 
BEGIN
819
 
  ASM
820
 
        MOVE.L  A6,-(A7)
821
 
        MOVEA.L palette,A0
822
 
        MOVEA.L coltab,A1
823
 
        MOVEA.L taglist,A2
824
 
        MOVEA.L RenderBase,A6
825
 
        JSR     -192(A6)
826
 
        MOVEA.L (A7)+,A6
827
 
  END;
828
 
END;
829
 
 
830
 
PROCEDURE ExtractAlphaChannelA(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; taglist : pTagItem);
831
 
BEGIN
832
 
  ASM
833
 
        MOVE.L  A6,-(A7)
834
 
        MOVEA.L rgbarray,A0
835
 
        MOVE.L  width,D0
836
 
        MOVE.L  height,D1
837
 
        MOVEA.L chunkyarray,A1
838
 
        MOVEA.L taglist,A2
839
 
        MOVEA.L RenderBase,A6
840
 
        JSR     -288(A6)
841
 
        MOVEA.L (A7)+,A6
842
 
  END;
843
 
END;
844
 
 
845
 
FUNCTION ExtractPaletteA(histogram : POINTER; palette : pULONG; numcolors : WORD; taglist : pTagItem) : longword;
846
 
BEGIN
847
 
  ASM
848
 
        MOVE.L  A6,-(A7)
849
 
        MOVEA.L histogram,A0
850
 
        MOVEA.L palette,A1
851
 
        MOVE.L  numcolors,D0
852
 
        MOVEA.L taglist,A2
853
 
        MOVEA.L RenderBase,A6
854
 
        JSR     -114(A6)
855
 
        MOVEA.L (A7)+,A6
856
 
        MOVE.L  D0,@RESULT
857
 
  END;
858
 
END;
859
 
 
860
 
PROCEDURE FlushPalette(palette : POINTER);
861
 
BEGIN
862
 
  ASM
863
 
        MOVE.L  A6,-(A7)
864
 
        MOVEA.L palette,A0
865
 
        MOVEA.L RenderBase,A6
866
 
        JSR     -210(A6)
867
 
        MOVEA.L (A7)+,A6
868
 
  END;
869
 
END;
870
 
 
871
 
PROCEDURE FreeRenderMem(rendermemhandler : POINTER; mem : POINTER; size : longword);
872
 
BEGIN
873
 
  ASM
874
 
        MOVE.L  A6,-(A7)
875
 
        MOVEA.L rendermemhandler,A0
876
 
        MOVEA.L mem,A1
877
 
        MOVE.L  size,D0
878
 
        MOVEA.L RenderBase,A6
879
 
        JSR     -060(A6)
880
 
        MOVEA.L (A7)+,A6
881
 
  END;
882
 
END;
883
 
 
884
 
PROCEDURE FreeRenderVec(mem : POINTER);
885
 
BEGIN
886
 
  ASM
887
 
        MOVE.L  A6,-(A7)
888
 
        MOVEA.L mem,A0
889
 
        MOVEA.L RenderBase,A6
890
 
        JSR     -072(A6)
891
 
        MOVEA.L (A7)+,A6
892
 
  END;
893
 
END;
894
 
 
895
 
PROCEDURE ImportPaletteA(palette : POINTER; coltab : POINTER; numcols : WORD; taglist : pTagItem);
896
 
BEGIN
897
 
  ASM
898
 
        MOVE.L  A6,-(A7)
899
 
        MOVEA.L palette,A0
900
 
        MOVEA.L coltab,A1
901
 
        MOVE.L  numcols,D0
902
 
        MOVEA.L taglist,A2
903
 
        MOVEA.L RenderBase,A6
904
 
        JSR     -186(A6)
905
 
        MOVEA.L (A7)+,A6
906
 
  END;
907
 
END;
908
 
 
909
 
PROCEDURE InsertAlphaChannelA(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; taglist : pTagItem);
910
 
BEGIN
911
 
  ASM
912
 
        MOVE.L  A6,-(A7)
913
 
        MOVEA.L maskarray,A0
914
 
        MOVE.L  width,D0
915
 
        MOVE.L  height,D1
916
 
        MOVEA.L rgbarray,A1
917
 
        MOVEA.L taglist,A2
918
 
        MOVEA.L RenderBase,A6
919
 
        JSR     -282(A6)
920
 
        MOVEA.L (A7)+,A6
921
 
  END;
922
 
END;
923
 
 
924
 
FUNCTION MapChunkyArrayA(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; taglist : pTagItem) : longword;
925
 
BEGIN
926
 
  ASM
927
 
        MOVE.L  A6,-(A7)
928
 
        MOVEA.L engine,A0
929
 
        MOVEA.L source,A1
930
 
        MOVEA.L palette,A2
931
 
        MOVE.L  width,D0
932
 
        MOVE.L  height,D1
933
 
        MOVEA.L dest,A3
934
 
        MOVEA.L taglist,A4
935
 
        MOVEA.L RenderBase,A6
936
 
        JSR     -276(A6)
937
 
        MOVEA.L (A7)+,A6
938
 
        MOVE.L  D0,@RESULT
939
 
  END;
940
 
END;
941
 
 
942
 
FUNCTION MapRGBArrayA(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; taglist : pTagItem) : longword;
943
 
BEGIN
944
 
  ASM
945
 
        MOVE.L  A6,-(A7)
946
 
        MOVEA.L engine,A0
947
 
        MOVEA.L rgb,A1
948
 
        MOVE.L  width,D0
949
 
        MOVE.L  height,D1
950
 
        MOVEA.L chunky,A2
951
 
        MOVEA.L taglist,A3
952
 
        MOVEA.L RenderBase,A6
953
 
        JSR     -258(A6)
954
 
        MOVEA.L (A7)+,A6
955
 
        MOVE.L  D0,@RESULT
956
 
  END;
957
 
END;
958
 
 
959
 
PROCEDURE MixAlphaChannelA(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; taglist : pTagItem);
960
 
BEGIN
961
 
  ASM
962
 
        MOVE.L  A6,-(A7)
963
 
        MOVEA.L source1,A0
964
 
        MOVEA.L source2,A1
965
 
        MOVE.L  width,D0
966
 
        MOVE.L  height,D1
967
 
        MOVEA.L dest,A2
968
 
        MOVEA.L taglist,A3
969
 
        MOVEA.L RenderBase,A6
970
 
        JSR     -318(A6)
971
 
        MOVEA.L (A7)+,A6
972
 
  END;
973
 
END;
974
 
 
975
 
PROCEDURE MixRGBArrayA(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; taglist : pTagItem);
976
 
BEGIN
977
 
  ASM
978
 
        MOVE.L  A6,-(A7)
979
 
        MOVEA.L sourcearray,A0
980
 
        MOVE.L  width,D0
981
 
        MOVE.L  height,D1
982
 
        MOVEA.L destarray,A1
983
 
        MOVE.L  ratio,D2
984
 
        MOVEA.L taglist,A2
985
 
        MOVEA.L RenderBase,A6
986
 
        JSR     -300(A6)
987
 
        MOVEA.L (A7)+,A6
988
 
  END;
989
 
END;
990
 
 
991
 
PROCEDURE Planar2ChunkyA(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; taglist : pTagItem);
992
 
BEGIN
993
 
  ASM
994
 
        MOVE.L  A6,-(A7)
995
 
        MOVEA.L planetab,A0
996
 
        MOVE.L  bytewidth,D0
997
 
        MOVE.L  height,D1
998
 
        MOVE.L  depth,D2
999
 
        MOVE.L  bytesperrow,D3
1000
 
        MOVEA.L chunky,A1
1001
 
        MOVEA.L taglist,A2
1002
 
        MOVEA.L RenderBase,A6
1003
 
        JSR     -126(A6)
1004
 
        MOVEA.L (A7)+,A6
1005
 
  END;
1006
 
END;
1007
 
 
1008
 
FUNCTION QueryHistogram(histogram : POINTER; d0arg : longword) : longword;
1009
 
BEGIN
1010
 
  ASM
1011
 
        MOVE.L  A6,-(A7)
1012
 
        MOVEA.L histogram,A0
1013
 
        MOVE.L  d0arg,D0
1014
 
        MOVEA.L RenderBase,A6
1015
 
        JSR     -090(A6)
1016
 
        MOVEA.L (A7)+,A6
1017
 
        MOVE.L  D0,@RESULT
1018
 
  END;
1019
 
END;
1020
 
 
1021
 
FUNCTION RenderA(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; taglist : pTagItem) : longword;
1022
 
BEGIN
1023
 
  ASM
1024
 
        MOVE.L  A6,-(A7)
1025
 
        MOVEA.L rgb,A0
1026
 
        MOVE.L  width,D0
1027
 
        MOVE.L  height,D1
1028
 
        MOVEA.L chunky,A1
1029
 
        MOVEA.L palette,A2
1030
 
        MOVEA.L taglist,A3
1031
 
        MOVEA.L RenderBase,A6
1032
 
        JSR     -120(A6)
1033
 
        MOVEA.L (A7)+,A6
1034
 
        MOVE.L  D0,@RESULT
1035
 
  END;
1036
 
END;
1037
 
 
1038
 
FUNCTION RGBArrayDiversityA(rgb : pULONG; width : WORD; height : WORD; taglist : pTagItem) : LONGINT;
1039
 
BEGIN
1040
 
  ASM
1041
 
        MOVE.L  A6,-(A7)
1042
 
        MOVEA.L rgb,A0
1043
 
        MOVE.L  width,D0
1044
 
        MOVE.L  height,D1
1045
 
        MOVEA.L taglist,A1
1046
 
        MOVEA.L RenderBase,A6
1047
 
        JSR     -264(A6)
1048
 
        MOVEA.L (A7)+,A6
1049
 
        MOVE.L  D0,@RESULT
1050
 
  END;
1051
 
END;
1052
 
 
1053
 
FUNCTION ScaleA(engine : POINTER; source : POINTER; dest : POINTER; taglist : pTagItem) : longword;
1054
 
BEGIN
1055
 
  ASM
1056
 
        MOVE.L  A6,-(A7)
1057
 
        MOVEA.L engine,A0
1058
 
        MOVEA.L source,A1
1059
 
        MOVEA.L dest,A2
1060
 
        MOVEA.L taglist,A3
1061
 
        MOVEA.L RenderBase,A6
1062
 
        JSR     -156(A6)
1063
 
        MOVEA.L (A7)+,A6
1064
 
        MOVE.L  D0,@RESULT
1065
 
  END;
1066
 
END;
1067
 
 
1068
 
FUNCTION ScaleOrdinate(source : WORD; dest : WORD; ordinate : WORD) : WORD;
1069
 
BEGIN
1070
 
  ASM
1071
 
        MOVE.L  A6,-(A7)
1072
 
        MOVE.L  source,D0
1073
 
        MOVE.L  dest,D1
1074
 
        MOVE.L  ordinate,D2
1075
 
        MOVEA.L RenderBase,A6
1076
 
        JSR     -228(A6)
1077
 
        MOVEA.L (A7)+,A6
1078
 
        MOVE.L  D0,@RESULT
1079
 
  END;
1080
 
END;
1081
 
 
1082
 
FUNCTION SortPaletteA(palette : POINTER; mode : longword; taglist : pTagItem) : longword;
1083
 
BEGIN
1084
 
  ASM
1085
 
        MOVE.L  A6,-(A7)
1086
 
        MOVEA.L palette,A0
1087
 
        MOVE.L  mode,D0
1088
 
        MOVEA.L taglist,A1
1089
 
        MOVEA.L RenderBase,A6
1090
 
        JSR     -216(A6)
1091
 
        MOVEA.L (A7)+,A6
1092
 
        MOVE.L  D0,@RESULT
1093
 
  END;
1094
 
END;
1095
 
 
1096
 
PROCEDURE TintRGBArrayA(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; taglist : pTagItem);
1097
 
BEGIN
1098
 
  ASM
1099
 
        MOVE.L  A6,-(A7)
1100
 
        MOVEA.L source,A0
1101
 
        MOVE.L  width,D0
1102
 
        MOVE.L  height,D1
1103
 
        MOVE.L  RGB,D2
1104
 
        MOVE.L  ratio,D3
1105
 
        MOVEA.L dest,A1
1106
 
        MOVEA.L taglist,A2
1107
 
        MOVEA.L RenderBase,A6
1108
 
        JSR     -324(A6)
1109
 
        MOVEA.L (A7)+,A6
1110
 
  END;
1111
 
END;
1112
 
 
1113
 
{
1114
 
 Functions and procedures with array of const go here
1115
 
}
1116
 
FUNCTION AddChunkyImage(histogram : POINTER; chunky : pByte; width : WORD; height : WORD; palette : POINTER; const taglist : Array Of Const) : longword;
1117
 
begin
1118
 
    AddChunkyImage := AddChunkyImageA(histogram , chunky , width , height , palette , readintags(taglist));
1119
 
end;
1120
 
 
1121
 
FUNCTION AddHistogram(histogram1 : POINTER; histogram2 : POINTER; const taglist : Array Of Const) : longword;
1122
 
begin
1123
 
    AddHistogram := AddHistogramA(histogram1 , histogram2 , readintags(taglist));
1124
 
end;
1125
 
 
1126
 
FUNCTION AddRGBImage(histogram : POINTER; rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : longword;
1127
 
begin
1128
 
    AddRGBImage := AddRGBImageA(histogram , rgb , width , height , readintags(taglist));
1129
 
end;
1130
 
 
1131
 
PROCEDURE ApplyAlphaChannel(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; const taglist : Array Of Const);
1132
 
begin
1133
 
    ApplyAlphaChannelA(sourcearray , width , height , destarray , readintags(taglist));
1134
 
end;
1135
 
 
1136
 
PROCEDURE Chunky2BitMap(chunky : pByte; sx : WORD; sy : WORD; width : WORD; height : WORD; bitmap : pBitMap; dx : WORD; dy : WORD; const taglist : Array Of Const);
1137
 
begin
1138
 
    Chunky2BitMapA(chunky , sx , sy , width , height , bitmap , dx , dy , readintags(taglist));
1139
 
end;
1140
 
 
1141
 
FUNCTION Chunky2RGB(chunky : pByte; width : WORD; height : WORD; rgb : pULONG; palette : POINTER; const taglist : Array Of Const) : longword;
1142
 
begin
1143
 
    Chunky2RGB := Chunky2RGBA(chunky , width , height , rgb , palette , readintags(taglist));
1144
 
end;
1145
 
 
1146
 
FUNCTION ChunkyArrayDiversity(chunky : pByte; palette : POINTER; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
1147
 
begin
1148
 
    ChunkyArrayDiversity := ChunkyArrayDiversityA(chunky , palette , width , height , readintags(taglist));
1149
 
end;
1150
 
 
1151
 
FUNCTION ConvertChunky(source : pByte; oldpalette : POINTER; width : WORD; height : WORD; dest : pByte; newpalette : POINTER; const taglist : Array Of Const) : longword;
1152
 
begin
1153
 
    ConvertChunky := ConvertChunkyA(source , oldpalette , width , height , dest , newpalette , readintags(taglist));
1154
 
end;
1155
 
 
1156
 
PROCEDURE CreateAlphaArray(rgbarray : pULONG; width : WORD; height : WORD; const taglist : Array Of Const);
1157
 
begin
1158
 
    CreateAlphaArrayA(rgbarray , width , height , readintags(taglist));
1159
 
end;
1160
 
 
1161
 
FUNCTION CreateHistogram(const taglist : Array Of Const) : POINTER;
1162
 
begin
1163
 
    CreateHistogram := CreateHistogramA(readintags(taglist));
1164
 
end;
1165
 
 
1166
 
FUNCTION CreateMapEngine(palette : POINTER; const taglist : Array Of Const) : POINTER;
1167
 
begin
1168
 
    CreateMapEngine := CreateMapEngineA(palette , readintags(taglist));
1169
 
end;
1170
 
 
1171
 
FUNCTION CreatePalette(const taglist : Array Of Const) : POINTER;
1172
 
begin
1173
 
    CreatePalette := CreatePaletteA(readintags(taglist));
1174
 
end;
1175
 
 
1176
 
PROCEDURE CreatePenTable(chunky : pByte; oldpalette : POINTER; width : WORD; height : WORD; newpalette : POINTER; convtab : pByte; const taglist : Array Of Const);
1177
 
begin
1178
 
    CreatePenTableA(chunky , oldpalette , width , height , newpalette , convtab , readintags(taglist));
1179
 
end;
1180
 
 
1181
 
FUNCTION CreateRMHandler(const taglist : Array Of Const) : POINTER;
1182
 
begin
1183
 
    CreateRMHandler := CreateRMHandlerA(readintags(taglist));
1184
 
end;
1185
 
 
1186
 
FUNCTION CreateScaleEngine(sourcewidth : WORD; sourceheight : WORD; destwidth : WORD; destheight : WORD; const taglist : Array Of Const) : POINTER;
1187
 
begin
1188
 
    CreateScaleEngine := CreateScaleEngineA(sourcewidth , sourceheight , destwidth , destheight , readintags(taglist));
1189
 
end;
1190
 
 
1191
 
PROCEDURE ExportPalette(palette : POINTER; coltab : POINTER; const taglist : Array Of Const);
1192
 
begin
1193
 
    ExportPaletteA(palette , coltab , readintags(taglist));
1194
 
end;
1195
 
 
1196
 
PROCEDURE ExtractAlphaChannel(rgbarray : pULONG; width : WORD; height : WORD; chunkyarray : pByte; const taglist : Array Of Const);
1197
 
begin
1198
 
    ExtractAlphaChannelA(rgbarray , width , height , chunkyarray , readintags(taglist));
1199
 
end;
1200
 
 
1201
 
FUNCTION ExtractPalette(histogram : POINTER; palette : pULONG; numcolors : WORD; const taglist : Array Of Const) : longword;
1202
 
begin
1203
 
    ExtractPalette := ExtractPaletteA(histogram , palette , numcolors , readintags(taglist));
1204
 
end;
1205
 
 
1206
 
PROCEDURE ImportPalette(palette : POINTER; coltab : POINTER; numcols : WORD; const taglist : Array Of Const);
1207
 
begin
1208
 
    ImportPaletteA(palette , coltab , numcols , readintags(taglist));
1209
 
end;
1210
 
 
1211
 
PROCEDURE InsertAlphaChannel(maskarray : pByte; width : WORD; height : WORD; rgbarray : pULONG; const taglist : Array Of Const);
1212
 
begin
1213
 
    InsertAlphaChannelA(maskarray , width , height , rgbarray , readintags(taglist));
1214
 
end;
1215
 
 
1216
 
FUNCTION MapChunkyArray(engine : POINTER; source : pByte; palette : POINTER; width : WORD; height : WORD; dest : pByte; const taglist : Array Of Const) : longword;
1217
 
begin
1218
 
    MapChunkyArray := MapChunkyArrayA(engine , source , palette , width , height , dest , readintags(taglist));
1219
 
end;
1220
 
 
1221
 
FUNCTION MapRGBArray(engine : POINTER; rgb : pULONG; width : WORD; height : WORD; chunky : pByte; const taglist : Array Of Const) : longword;
1222
 
begin
1223
 
    MapRGBArray := MapRGBArrayA(engine , rgb , width , height , chunky , readintags(taglist));
1224
 
end;
1225
 
 
1226
 
PROCEDURE MixAlphaChannel(source1 : pULONG; source2 : pULONG; width : WORD; height : WORD; dest : pULONG; const taglist : Array Of Const);
1227
 
begin
1228
 
    MixAlphaChannelA(source1 , source2 , width , height , dest , readintags(taglist));
1229
 
end;
1230
 
 
1231
 
PROCEDURE MixRGBArray(sourcearray : pULONG; width : WORD; height : WORD; destarray : pULONG; ratio : WORD; const taglist : Array Of Const);
1232
 
begin
1233
 
    MixRGBArrayA(sourcearray , width , height , destarray , ratio , readintags(taglist));
1234
 
end;
1235
 
 
1236
 
PROCEDURE Planar2Chunky(planetab : pPLANEPTR; bytewidth : WORD; height : WORD; depth : WORD; bytesperrow : WORD; chunky : pByte; const taglist : Array Of Const);
1237
 
begin
1238
 
    Planar2ChunkyA(planetab , bytewidth , height , depth , bytesperrow , chunky , readintags(taglist));
1239
 
end;
1240
 
 
1241
 
FUNCTION RenderTags(rgb : pULONG; width : WORD; height : WORD; chunky : pByte; palette : POINTER; const taglist : Array Of Const) : longword;
1242
 
begin
1243
 
    RenderTags := RenderA(rgb , width , height , chunky , palette , readintags(taglist));
1244
 
end;
1245
 
 
1246
 
FUNCTION RGBArrayDiversity(rgb : pULONG; width : WORD; height : WORD; const taglist : Array Of Const) : LONGINT;
1247
 
begin
1248
 
    RGBArrayDiversity := RGBArrayDiversityA(rgb , width , height , readintags(taglist));
1249
 
end;
1250
 
 
1251
 
FUNCTION Scale(engine : POINTER; source : POINTER; dest : POINTER; const taglist : Array Of Const) : longword;
1252
 
begin
1253
 
    Scale := ScaleA(engine , source , dest , readintags(taglist));
1254
 
end;
1255
 
 
1256
 
FUNCTION SortPalette(palette : POINTER; mode : longword; const taglist : Array Of Const) : longword;
1257
 
begin
1258
 
    SortPalette := SortPaletteA(palette , mode , readintags(taglist));
1259
 
end;
1260
 
 
1261
 
PROCEDURE TintRGBArray(source : pULONG; width : WORD; height : WORD; RGB : longword; ratio : WORD; dest : pULONG; const taglist : Array Of Const);
1262
 
begin
1263
 
    TintRGBArrayA(source , width , height , RGB , ratio , dest , readintags(taglist));
1264
 
end;
1265
 
 
1266
 
const
1267
 
    { Change VERSION and LIBVERSION to proper values }
1268
 
 
1269
 
    VERSION : string[2] = '0';
1270
 
    LIBVERSION : longword = 0;
1271
 
 
1272
 
{$ifdef use_init_openlib}
1273
 
  {$Info Compiling initopening of render.library}
1274
 
  {$Info don't forget to use InitRENDERLibrary in the beginning of your program}
1275
 
 
1276
 
var
1277
 
    render_exit : Pointer;
1278
 
 
1279
 
procedure CloserenderLibrary;
1280
 
begin
1281
 
    ExitProc := render_exit;
1282
 
    if RenderBase <> nil then begin
1283
 
        CloseLibrary(RenderBase);
1284
 
        RenderBase := nil;
1285
 
    end;
1286
 
end;
1287
 
 
1288
 
procedure InitRENDERLibrary;
1289
 
begin
1290
 
    RenderBase := nil;
1291
 
    RenderBase := OpenLibrary(RENDERNAME,LIBVERSION);
1292
 
    if RenderBase <> nil then begin
1293
 
        render_exit := ExitProc;
1294
 
        ExitProc := @CloserenderLibrary;
1295
 
    end else begin
1296
 
        MessageBox('FPC Pascal Error',
1297
 
        'Can''t open render.library version ' + VERSION + #10 +
1298
 
        'Deallocating resources and closing down',
1299
 
        'Oops');
1300
 
        halt(20);
1301
 
    end;
1302
 
end;
1303
 
 
1304
 
begin
1305
 
    RENDERIsCompiledHow := 2;
1306
 
{$endif use_init_openlib}
1307
 
 
1308
 
{$ifdef use_auto_openlib}
1309
 
  {$Info Compiling autoopening of render.library}
1310
 
 
1311
 
var
1312
 
    render_exit : Pointer;
1313
 
 
1314
 
procedure CloserenderLibrary;
1315
 
begin
1316
 
    ExitProc := render_exit;
1317
 
    if RenderBase <> nil then begin
1318
 
        CloseLibrary(RenderBase);
1319
 
        RenderBase := nil;
1320
 
    end;
1321
 
end;
1322
 
 
1323
 
begin
1324
 
    RenderBase := nil;
1325
 
    RenderBase := OpenLibrary(RENDERNAME,LIBVERSION);
1326
 
    if RenderBase <> nil then begin
1327
 
        render_exit := ExitProc;
1328
 
        ExitProc := @CloserenderLibrary;
1329
 
        RENDERIsCompiledHow := 1;
1330
 
    end else begin
1331
 
        MessageBox('FPC Pascal Error',
1332
 
        'Can''t open render.library version ' + VERSION + #10 +
1333
 
        'Deallocating resources and closing down',
1334
 
        'Oops');
1335
 
        halt(20);
1336
 
    end;
1337
 
 
1338
 
{$endif use_auto_openlib}
1339
 
 
1340
 
{$ifdef dont_use_openlib}
1341
 
begin
1342
 
    RENDERIsCompiledHow := 3;
1343
 
   {$Warning No autoopening of render.library compiled}
1344
 
   {$Warning Make sure you open render.library yourself}
1345
 
{$endif dont_use_openlib}
1346
 
 
1347
 
 
1348
 
END. (* UNIT RENDER *)
1349
 
 
1350
 
{
1351
 
  $Log
1352
 
}
1353
 
 
1354