File: flimage.h

package info (click to toggle)
libforms1 1.0-8
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,648 kB
  • ctags: 14,351
  • sloc: ansic: 90,441; makefile: 9,902; sh: 8
file content (1252 lines) | stat: -rw-r--r-- 24,539 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
/*
 *
 *  This file is part of the XForms library package.
 *
 * XForms is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1, or
 * (at your option) any later version.
 *
 * XForms is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with XForms; see the file COPYING.  If not, write to
 * the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA.
 *
 */

/********************** crop here for forms.h **********************/

/*
 * $Id: flimage.h,v 0.89 1999/07/17 03:17:52 zhao Beta $
 *
 * Image related routines
 *
 */

#ifndef FL_IMAGE_H
#define FL_IMAGE_H

#if defined(__cplusplus)
extern "C"
{
#endif

#ifndef FL_EXPORT
#define FL_EXPORT extern
#endif


#define FL_RGB2GRAY(r,g,b)  (unsigned)((78*(r)+150*(g)+28*(b))>>8)

enum
{
    FL_IMAGE_NONE,
    FL_IMAGE_MONO = 1,		/* b&w. 1bit. 0=white 1=black */
    FL_IMAGE_GRAY = 2,		/* 8 bit gray image           */
    FL_IMAGE_CI = 4,		/* colormmaped image          */
    FL_IMAGE_RGB = 8,		/* RGBA image. 8bit each      */
    FL_IMAGE_PACKED  = 16,	/* RGBA packed into an int    */
    FL_IMAGE_GRAY16 = 32,	/* 12bit gray scale image     */
    FL_IMAGE_RGB16 = 64,	/* 36bits color image         */
    FL_IMAGE_FLEX = 1023,       /* all formats                */
    /* aliases */
    FLIMAGE_NONE   = FL_IMAGE_NONE,
    FLIMAGE_MONO   = FL_IMAGE_MONO,
    FLIMAGE_GRAY   = FL_IMAGE_GRAY,
    FLIMAGE_CI     = FL_IMAGE_CI,
    FLIMAGE_RGB    = FL_IMAGE_RGB,
    FLIMAGE_PACKED = FL_IMAGE_PACKED,
    FLIMAGE_GRAY16 = FL_IMAGE_GRAY16,
    FLIMAGE_RGB16  = FL_IMAGE_RGB16,
    FLIMAGE_FLEX   = FL_IMAGE_FLEX
};

#ifndef FL_PCBITS
typedef unsigned char FL_PCTYPE;	/* primary color type */
#define FL_PCBITS          8	/* primary color bits */
#define FL_PCMAX          ((1<<FL_PCBITS)-1)
#define FL_PCCLAMP(a)     ((a)>(FL_PCMAX) ? (FL_PCMAX):((a) < 0 ? 0:(a)))
typedef unsigned int       FL_PACKED4;
#define FL_PACKED          FL_PACKED4

#define FL_RMASK          0x000000ff
#define FL_RSHIFT         0
#define FL_GMASK          0x0000ff00
#define FL_GSHIFT         8
#define FL_BMASK          0x00ff0000
#define FL_BSHIFT         16
#define FL_AMASK          0xff000000
#define FL_ASHIFT         24
/* if PCBITS is not 8, we need to apply the RGBmask */
#define FL_GETR(packed)   ((packed)&FL_RMASK)
#define FL_GETG(packed)   (((packed)>>FL_GSHIFT)&FL_PCMAX)
#define FL_GETB(packed)   (((packed)>>FL_BSHIFT)&FL_PCMAX)
#define FL_GETA(packed)   (((packed)>>FL_ASHIFT)&FL_PCMAX)

#define FL_PACK3(r,g,b)   (((r)<<FL_RSHIFT)|((g)<<FL_GSHIFT)|((b)<<FL_BSHIFT))
#define FL_PACK            FL_PACK3
#define FL_PACK4(r,g,b,a) (FL_PACK3(r,g,b)|((a)<<FL_ASHIFT))

#define FL_UNPACK(p,r,g,b) do {r=FL_GETR(p);g=FL_GETG(p),b=FL_GETB(p);} while(0)
#define FL_UNPACK3         FL_UNPACK
#define FL_UNPACK4(p,r,g,b,a) do {FL_UNPACK3(p,r,g,b);a=FL_GETA(p);} while(0) 
#endif

#define FL_LUTBITS        12    /* max colormap bits. 4096 entries */

#define FL_IsRGB(im)      (im->type == FL_IMAGE_RGB)
#define FL_IsPacked(im)   (im->type == FL_IMAGE_PACKED)

enum 
{ 
    FLIMAGE_AUTOCOLOR = 0x7fffffff,
    FLIMAGE_BADCOLOR = FLIMAGE_AUTOCOLOR 
};



typedef Window FL_WINDOW;   /* unsigned long */

typedef struct flimage_text_
{
    char *str;		        /* the string itself             */
    int len;			/* string length                 */
    int x, y;			/* starting location of text (wrt image) */
    unsigned int color;		/* color of the text             */
    unsigned int bcolor;	/* background color of the text  */
    int nobk;                   /* no background                 */
    int size, style;		/* font size & style             */
    int angle;                  /* in 1/10th of a degrees        */
    int align;                  /* alignment wrt to (x,y)        */
    int reserved[6];
} FLIMAGE_TEXT;

typedef struct flimage_marker_
{
    const char *name;           /* marker name                  */
    int w, h;                   /* size                         */
    int x, y;                   /* location                     */
    unsigned int color;		/* color of the marker          */
    unsigned int bcolor;	/* aux. color of the marker     */
    int angle;                  /* in 1/10th of a degree        */
    int fill;
    int thickness;              /* line thickness               */
    int style;                  /* line style                   */
    /* the following is filled by the library */
    void *display;
    void *gc;
    FL_WINDOW win;
    const char *psdraw;
    int reserved[6];
} FLIMAGE_MARKER;
    

#define FLIMAGE_REPFREQ  0x1f   /* report every 32 lines */

#ifndef FL_RGB2PIXEL
typedef struct
{
   unsigned int rshift, rmask, rbits;
   unsigned int gshift, gmask, gbits;
   unsigned int bshift, bmask, bbits;
   int bits_per_rgb;
   int colormap_size;
   int reserved[2];
} FL_RGB2PIXEL_;

#define FL_RGB2PIXEL  FL_RGB2PIXEL_
#endif


typedef struct flimage_setup_ *FLIMAGESETUP;

struct flimage_src_;
struct flimage_dest_;

typedef struct flimage_
{
    int type;			/* image type                    */
    int w, h;			/* image size                    */
    void *app_data;		/* for application at setup time */
    void *u_vdata;		/* for application               */
    long  u_ldata;		/* for application               */
    unsigned char **red;        
    unsigned char **green;
    unsigned char **blue;
    unsigned char **alpha;
    unsigned char **rgba[4];    /* alias                         */
    unsigned short **ci;
    unsigned short **gray;
    FL_PACKED4 **packed;
    unsigned short **red16;    /* not currently supported */
    unsigned short **green16;  /* not currently supported */
    unsigned short **blue16;   /* not currently supported */
    unsigned short **alpha16;  /* not currently supported */
    unsigned char  **ci8;  /* not currently supported */
    int *red_lut;              /* red lookup tables                */
    int *green_lut;            /* green lookup tables              */
    int *blue_lut;             /* blue lookup tables               */
    int *alpha_lut;            /* alpha lookup tables              */
    int *lut[4];               /* alias                            */
    int map_len;               /* lut length                       */
    int colors;                /* actual colors used in displaying */
    int gray_maxval;           /* indicate the range of gray16     */
    int ci_maxval;             /* max value of ci. not used. use map_len */
    int rgb_maxval;            /* max value for rgb16 image       */
    int level, wwidth;
    unsigned short *wlut;      /* lut for window levelling         */
    int wlut_len;
    int app_background;        /* transparent color: in RGB        */
    char *comments;
    int comments_len;
    int available_type;
    struct flimage_ *next;
    int sx, sy;                 /* display subimage origin          */
    int sw, sh;                 /* display subimage width           */
    int wx, wy;                 /* display location relative to win */
    int modified;
    int (*display)(struct flimage_ *, FL_WINDOW);
    int double_buffer;
    int sxd, syd, swd, shd;
    int wxd, wyd;
    const char *fmt_name;       /* format name (ppm,jpg etc)     */
    int bi_reserved[8];

    /* annotation stuff */
    FLIMAGE_TEXT *text;
    int ntext, max_text;
    int dont_display_text;
    void (*display_text)(struct flimage_ *);
    void (*free_text)(struct flimage_ *);
    FLIMAGE_MARKER *marker;
    int nmarkers, max_markers;
    int dont_display_marker;
    void (*display_markers)(struct flimage_ *);
    void (*free_markers)(struct flimage_ *);
    int an_reserved[8];

    /* physicalValue = poffset + pixelValue * pscale  */
    double pmin, pmax;        /* physical data range             */
    double poffset;   
    double pscale;
    /* pixel grid distance */
    double xdist_offset;
    double xdist_scale;
    double ydist_offset;
    double ydist_scale;
    int px_reserved[8];

    char *infile;
    char *outfile;
    long foffset;
    int original_type;
     /* hooks for application to have a chance to set some options.
        if pre_write returns -1, the output will be canceled 
     */
    int (*pre_write)(struct flimage_ *);
    int (*post_write)(struct flimage_ *); 
    int f_reserved[16];

    /* image processing stuff */
    int subx, suby;           /* subimage origin       */
    int subw, subh;           /* subimage size         */
    int sub_shape;            /* shape of the subimage */
    unsigned int fill_color;  /* fill color            */
    int force_convert;
    int *llut[3];            /* linear lut            */
    int llut_len; 
    unsigned int *hist[4];
    int ip_reserved[16];

    /* application handlers */ 
    int total, completed;
    int (*visual_cue) (struct flimage_*,  const char *);
    void (*error_message) (struct flimage_*, const char *);
    int error_code;       /* not currently used */

    int display_type;		/* just before handing it to X      */
    unsigned short **pixels;
    void *image_spec;		/* additional image info            */
    void *xdisplay;             /* the X connection                 */
    int tran_rgb;           /* RGB color that should be transparent */
    int tran_index;         /* index that should be transparent     */
    int matr, matc;
    /* multi-frame images */
    int more;
    int current_frame;
    int total_frames;
    int (*next_frame)(struct flimage_ *);
    int (*prev_frame)(struct flimage_ *);
    int (*random_frame)(struct flimage_ *, int);
    int (*rewind_frame)(struct flimage_ *);
    void (*cleanup)(struct flimage_ *);
    int stop_looping;
    int mi_reserved[16];

    /* the following are for internal use */
    FILE *fpin;
    FILE *fpout;
    void *image_io;
    void *io_spec;		/* io operation helper       */
    int spec_size;
    int depth;                  /* the depth we actually use */
    int vclass;
    void *visual;
    unsigned long xcolormap;
    FL_RGB2PIXEL rgb2p;
    void *ximage;
    FL_WINDOW win;
    void *gc;
    int sdepth;                 /* depth the server says     */
    void *textgc;
    void *markergc;
    void *extra_io_info;
    unsigned long pixmap;
    int pixmap_w, pixmap_h, pixmap_depth;
    int isPixmap;
    FLIMAGESETUP setup;
    char *info;
    struct flimage_src_  *src;  /* src other than file         */
    struct flimage_dest_ *dest; /* destination other than file */
    int internal_reserved[14];
} 
FL_IMAGE;

/* some configuration stuff */
typedef struct flimage_setup_
{
    void *app_data;
    int (*visual_cue)(FL_IMAGE *, const char *);
    void (*error_message)(FL_IMAGE *, const char *);
    int (*display)(FL_IMAGE *, unsigned long);
    const char *rgbfile;
    int do_not_clear;
    void *xdisplay;
    int max_frames;
    int delay;
    int no_auto_extension;
    int report_frequency;
    int double_buffer;
    /* internal use */
    unsigned long trailblazer;
    int header_info;
    int reserved[8];
} FLIMAGE_SETUP;

FL_EXPORT void flimage_setup(
		FLIMAGE_SETUP *setup
		);


/* possible errors from the library. Not currently (v0.89) used */
enum
{
   FLIMAGE_ERR_NONE = 0,
   FLIMAGE_ERR_ALLOC = -50,     /* allocation error     */
   FLIMAGE_ERR_INVALID,         /* invalid image        */
   FLIMAGE_ERR_ARGUMENT,        /* bad argument/request */
   FLIMAGE_ERR_FILE,            /* io error             */
   FLIMAGE_ERR_INTERNAL,        /* bugs                 */
   FLIMAGE_ERR_UNKNOWN
};


typedef int (*FLIMAGE_Identify) (FILE *);
typedef int (*FLIMAGE_Description) (FL_IMAGE *);
typedef int (*FLIMAGE_Read_Pixels) (FL_IMAGE *);
typedef int (*FLIMAGE_Write_Image) (FL_IMAGE *);

/* basic IO routines */
FL_EXPORT FL_IMAGE *flimage_load(
		const char *file
		);

FL_EXPORT FL_IMAGE *flimage_read(
		FL_IMAGE *im
		);

FL_EXPORT int flimage_dump(
		FL_IMAGE *image,
		const char *filename,
		const char *fmt
		);

FL_EXPORT int flimage_close(
		FL_IMAGE *im
		);

FL_EXPORT FL_IMAGE *flimage_alloc(
		void
		);

FL_EXPORT int flimage_getmem(
		FL_IMAGE *im
		);


FL_EXPORT int flimage_is_supported(
		const char *file
		);


FL_EXPORT int flimage_description_via_filter(
		FL_IMAGE *im,
		char *const *cmds,
		const char *what,
		int verbose
		);

FL_EXPORT int flimage_write_via_filter(
		FL_IMAGE *im,
		char *const *cmds,
		char *const formats[],
		int verbose
		);



FL_EXPORT FL_IMAGE *flimage_alloc(
		void
		);

FL_EXPORT int flimage_free(
		FL_IMAGE *image
		);

FL_EXPORT int flimage_display(
		FL_IMAGE *in_image,
		Window win
		);

FL_EXPORT int flimage_sdisplay(
		FL_IMAGE *im,
		Window win
		);

FL_EXPORT int flimage_convert(
		FL_IMAGE *image,
		int newtype,
		int ncolors
		);

FL_EXPORT const char *flimage_type_name(
		int type
		);

FL_EXPORT int flimage_add_text(
		FL_IMAGE *im,
		const char *str,
		int len,
		int style,
		int size,
		unsigned int tcol,
		unsigned int bcol,
		int tran,
		double tx,
		double ty,
		int rot
		);

FL_EXPORT int flimage_add_text_struct(
		FL_IMAGE *im,
		const FLIMAGE_TEXT *txt
		);

FL_EXPORT void flimage_delete_all_text(
		FL_IMAGE *im
		);


FL_EXPORT int flimage_add_marker(
		FL_IMAGE *im,
		const char *name,
		double x,
		double y,
		double w,
		double h,
		int style,
		int fill,
		int rot,
		unsigned int col,
		unsigned bcol
		);


FL_EXPORT int flimage_add_marker_struct(
		FL_IMAGE *im,
		const FLIMAGE_MARKER *min
		);

FL_EXPORT int flimage_define_marker(
		const char *name,
		void (*draw)(FLIMAGE_MARKER *),
		const char *psdraw
		);

FL_EXPORT void flimage_delete_all_markers(
		FL_IMAGE *im
		);

FL_EXPORT int flimage_render_annotation(
		FL_IMAGE *im,
		FL_WINDOW win
		);


FL_EXPORT void flimage_error(
		FL_IMAGE *im,
		const char *fmt,
		...
		);


/* built-in format supports */
FL_EXPORT void flimage_enable_pnm(
		void
		);

FL_EXPORT int flimage_set_fits_bits(
		int bits
		);


/* output options       */
typedef struct
{
    int quality;
    int smoothing;
    int reserved[6];
} FLIMAGE_JPEG_OPTION;

FL_EXPORT void flimage_jpeg_options(
		FLIMAGE_JPEG_OPTION *op
		);

FL_EXPORT void flimage_pnm_options(
		int raw
		);

FL_EXPORT void flimage_gif_options(
		int inter
		);

struct flps_cntl_; /* the same as FLPS_CONTROL */
typedef struct flps_cntl_ FLIMAGE_PS_OPTION;
FL_EXPORT FLPS_CONTROL *flimage_ps_options(
		void
		);


#define flimage_jpeg_output_options   flimage_jpeg_options
#define flimage_pnm_output_options    flimage_pnm_options
#define flimage_gif_output_options    flimage_gif_options

enum
{
    FLIMAGE_WRITABLE = FL_WRITE, FLIMAGE_READABLE = FL_READ
};

typedef struct
{
    const char *formal_name;
    const char *short_name;
    const char *extension;
    int type;
    int read_write;
    int annotation;
    int reserved[5];
} FLIMAGE_FORMAT_INFO;

FL_EXPORT int flimage_get_number_of_formats(
		void
		);

FL_EXPORT const FLIMAGE_FORMAT_INFO *flimage_get_format_info(
		int n
		);


FL_EXPORT void *fl_get_matrix(
		int nrows,
		int ncols,
		unsigned int esize
		);

FL_EXPORT void *fl_make_matrix(
		int nrows,
		int ncols,
		unsigned int esize,
		void *mem
		);

FL_EXPORT void fl_free_matrix(
		void *p
		);

FL_EXPORT char *fl_basename(
		char name[]
		);

FL_EXPORT int fl_init_RGBdatabase(
		const char *f
		);

FL_EXPORT int fl_lookup_RGBcolor(
		const char *req_name,
		int *r,
		int *g,
		int *b
		);


FL_EXPORT int flimage_add_format(
		const char *formal_name,
		const char *short_name,
		const char *extension,
		int type,
		FLIMAGE_Identify identify,
		FLIMAGE_Description description,
		FLIMAGE_Read_Pixels read_pixels,
		FLIMAGE_Write_Image write_image
		);


FL_EXPORT void flimage_set_annotation_support(
		int in,
		int flag
		);


FL_EXPORT int flimage_getcolormap(
		FL_IMAGE *im
		);


FL_EXPORT void fl_select_octree_quantizer(void);

FL_EXPORT void fl_select_mediancut_quantizer(
		void
		);



/* simple image processing routines */

#define FLIMAGE_SHARPEN        (int**)(-1)
#define FLIMAGE_SMOOTH         (int**)(-2)
#define FL_SMOOTH              FLIMAGE_SMOOTH  
#define FL_SHARPEN             FLIMAGE_SHARPEN  

enum
{ 
   FLIMAGE_NOSUBPIXEL  = 0,    /* scale with no subpixel sampling */         
   FLIMAGE_SUBPIXEL  = 1,      /* scale with  subpixel sampling */         
   FLIMAGE_CENTER = 2,         /* center warped image. default  */
   FLIMAGE_RIGHT = 8,          /* flush right the warped image  */
   FLIMAGE_ASPECT = 32,        /* fit the size */
   FLIMAGE_NOCENTER = FL_ALIGN_TOP_LEFT 
};

FL_EXPORT int flimage_convolve(
		FL_IMAGE *im,
		int **kernel,
		int krow,
		int kcol
		);

FL_EXPORT int flimage_convolvea(
		FL_IMAGE *im,
		int *kernel,
		int krow,
		int kcol
		);

FL_EXPORT int flimage_tint(
		FL_IMAGE *im,
		unsigned int packed,
		double opacity
		);

FL_EXPORT int flimage_rotate(
		FL_IMAGE *im,
		int deg,
		int subp
		);

FL_EXPORT int flimage_flip(
		FL_IMAGE *im,
		int axis
		);

FL_EXPORT int flimage_scale(
		FL_IMAGE *im,
		int nw,
		int nh,
		int option
		);

FL_EXPORT int flimage_warp(
		FL_IMAGE *im,
		float m[][2],
		int nw,
		int nh,
		int option
		);

FL_EXPORT int flimage_autocrop(
		FL_IMAGE *im,
		unsigned int bk
		);

FL_EXPORT int flimage_get_autocrop(
		FL_IMAGE *im,
		unsigned int bk,
		int *xl,
		int *yt,
		int *xr,
		int *yb
		);

FL_EXPORT int flimage_crop(
		FL_IMAGE *im,
		int xl,
		int yt,
		int xr,
		int yb
		);

FL_EXPORT int flimage_replace_pixel(
		FL_IMAGE *im,
		unsigned int target,
		unsigned int repl
		);

FL_EXPORT int flimage_transform_pixels(
		FL_IMAGE *im,
		int *red,
		int *green,
		int *blue
		);

FL_EXPORT int flimage_windowlevel(
		FL_IMAGE *im,
		int level,
		int width
		);

FL_EXPORT int flimage_enhance(
		FL_IMAGE *im,
		int delta
		);


FL_EXPORT int flimage_from_pixmap(
		FL_IMAGE *im,
		Pixmap pixmap
		);

FL_EXPORT Pixmap flimage_to_pixmap(
		FL_IMAGE *im,
		FL_WINDOW win
		);

FL_EXPORT FL_IMAGE *flimage_dup(
		FL_IMAGE *sim
		);

/* Miscellaneous prototypes */

FL_EXPORT void *fl_get_submatrix(
		void *in,
		int rows,
		int cols,
		int r1,
		int c1,
		int rs,
		int cs,
		unsigned int esize
		);

FL_EXPORT int fl_j2pass_quantize_packed(
		unsigned int **packed,
		int w,
		int h,
		int max_color,
		unsigned short **ci,
		int *actual_color,
		int *red_lut,
		int *green_lut,
		int *blue_lut,
		FL_IMAGE *im
		);

FL_EXPORT int fl_j2pass_quantize_rgb(
		unsigned char **red,
		unsigned char **green,
		unsigned char **blue,
		int w,
		int h,
		int max_color,
		unsigned short **ci,
		int *actual_color,
		int *red_lut,
		int *green_lut,
		int *blue_lut,
		FL_IMAGE *im
		);

FL_EXPORT void *fl_make_submatrix(
		void *in,
		int rows,
		int cols,
		int r1,
		int c1,
		int rs,
		int cs,
		unsigned int esize
		);

FL_EXPORT int fl_object_ps_dump(
		FL_OBJECT *ob,
		const char *fname
		);

FL_EXPORT void fl_pack_bits(
		unsigned char *out,
		unsigned short *in,
		int len
		);

FL_EXPORT void fl_unpack_bits(
		unsigned short *out,
		unsigned char *in,
		int len
		);

FL_EXPORT unsigned int fl_value_to_bits(
		unsigned int val
		);

FL_EXPORT void flimage_add_comments(
		FL_IMAGE *im,
		const char *s,
		int len
		);

FL_EXPORT unsigned long flimage_color_to_pixel(
		FL_IMAGE *im,
		int r,
		int g,
		int b,
		int *newpix
		);

FL_EXPORT FL_IMAGE *flimage_combine(
		FL_IMAGE *im1,
		FL_IMAGE *im2,
		double alpha
		);

FL_EXPORT int flimage_define_marker(
		const char *name,
		void (*draw)(FLIMAGE_MARKER *),
		const char *psdraw
		);

FL_EXPORT void flimage_display_markers(
		FL_IMAGE *im
		);

FL_EXPORT FL_IMAGE *flimage_dup_(
		FL_IMAGE *sim,
		int pix
		);

FL_EXPORT void flimage_enable_bmp(
		void
		);

FL_EXPORT void flimage_enable_fits(
		void
		);

FL_EXPORT void flimage_enable_genesis(
		void
		);

FL_EXPORT void flimage_enable_gif(
		void
		);

FL_EXPORT void flimage_enable_gzip(
		void
		);

FL_EXPORT void flimage_enable_jpeg(
		void
		);

FL_EXPORT void flimage_enable_png(
		void
		);

FL_EXPORT void flimage_enable_ps(
		void
		);

FL_EXPORT void flimage_enable_sgi(
		void
		);

FL_EXPORT void flimage_enable_tiff(
		void
		);

FL_EXPORT void flimage_enable_xbm(
		void
		);

FL_EXPORT void flimage_enable_xpm(
		void
		);

FL_EXPORT void flimage_enable_xwd(
		void
		);

FL_EXPORT void flimage_free_ci(
		FL_IMAGE *im
		);

FL_EXPORT void flimage_free_gray(
		FL_IMAGE *im
		);

FL_EXPORT void flimage_free_linearlut(
		FL_IMAGE *im
		);

FL_EXPORT void flimage_free_rgb(
		FL_IMAGE *im
		);

FL_EXPORT void flimage_freemem(
		FL_IMAGE *image
		);

FL_EXPORT int flimage_get_closest_color_from_map(
		FL_IMAGE *im,
		unsigned int col
		);

FL_EXPORT int flimage_get_linearlut(
		FL_IMAGE *im
		);

FL_EXPORT void flimage_invalidate_pixels(
		FL_IMAGE *im
		);

FL_EXPORT FL_IMAGE *flimage_open(
		const char *file
		);

FL_EXPORT int flimage_read_annotation(
		FL_IMAGE *im
		);

FL_EXPORT void flimage_replace_image(
		FL_IMAGE *im,
		int w,
		int h,
		void *r,
		void *g,
		void *b
		);

FL_EXPORT int flimage_swapbuffer(
		FL_IMAGE *im
		);

FL_EXPORT int flimage_to_ximage(
		FL_IMAGE *im,
		FL_WINDOW win,
		XWindowAttributes *xwa
		);

FL_EXPORT int flimage_write_annotation(
		FL_IMAGE *im
		);

FL_EXPORT void flps_apply_gamma(
		float gamma
		);

FL_EXPORT void flps_arc(
		int fill,
		int x,
		int y,
		int r,
		int t1,
		int t2,
		long col
		);

FL_EXPORT void flps_circ(
		int fill,
		int x,
		int y,
		int r,
		long col
		);

FL_EXPORT void flps_color(
		long color
		);

FL_EXPORT void flps_draw_box(
		int style,
		int x,
		int y,
		int w,
		int h,
		long col,
		int bw_in
		);

FL_EXPORT void flps_draw_checkbox(
		int type,
		int x,
		int y,
		int w,
		int h,
		long col,
		int bw
		);

FL_EXPORT void flps_draw_frame(
		int style,
		int x,
		int y,
		int w,
		int h,
		long col,
		int bw
		);

FL_EXPORT int flps_draw_symbol(
		const char *label,
		int x,
		int y,
		int w,
		int h,
		long col
		);

FL_EXPORT void flps_draw_tbox(
		int style,
		int x,
		int y,
		int w,
		int h,
		long col,
		int bw
		);

FL_EXPORT void flps_draw_text(
		int align,
		int x,
		int y,
		int w,
		int h,
		long col,
		int style,
		int size,
		const char *istr
		);

FL_EXPORT void flps_draw_text_beside(
		int align,
		int x,
		int y,
		int w,
		int h,
		long col,
		int style,
		int size,
		const char *str
		);

FL_EXPORT void flps_emit_header(
		const char *title,
		int n,
		int xi,
		int yi,
		int xf,
		int yf
		);

FL_EXPORT void flps_emit_prolog(
		void
		);

FL_EXPORT int flps_get_gray255(
		long color
		);

FL_EXPORT int flps_get_linestyle(
		void
		);

FL_EXPORT int flps_get_linewidth(
		void
		);

FL_EXPORT int flps_get_namedcolor(
		const char *s
		);

FL_EXPORT FLPS_CONTROL *flps_init(
		void
		);

FL_EXPORT void flps_invalidate_color_cache(
		void
		);

FL_EXPORT void flps_invalidate_font_cache(
		void
		);

FL_EXPORT void flps_invalidate_linewidth_cache(
		void
		);

FL_EXPORT void flps_invalidate_symbol_cache(
		void
		);

FL_EXPORT void flps_line(
		int xi,
		int yi,
		int xf,
		int yf,
		long col
		);

FL_EXPORT void flps_lines(
		FL_POINT *xp,
		int n,
		long col
		);

FL_EXPORT void flps_linestyle(
		int n
		);

FL_EXPORT void flps_linewidth(
		int lw
		);

FL_EXPORT void flps_log(
		const char *s
		);

FL_EXPORT void flps_output(
		const char *fmt,
		...
		);

FL_EXPORT void flps_oval(
		int fill,
		int x,
		int y,
		int w,
		int h,
		long col
		);

FL_EXPORT void flps_pieslice(
		int fill,
		int x,
		int y,
		int w,
		int h,
		int t1,
		int t2,
		long col
		);

FL_EXPORT void flps_poly(
		int fill,
		FL_POINT *xp,
		int n,
		long col
		);

FL_EXPORT void flps_rectangle(
		int fill,
		int x,
		int y,
		int w,
		int h,
		long col
		);

FL_EXPORT void flps_reset_cache(
		void
		);

FL_EXPORT void flps_reset_linewidth(
		void
		);

FL_EXPORT void flps_restore_flps(
		void
		);

FL_EXPORT void flps_rgbcolor(
		int r,
		int g,
		int b
		);

FL_EXPORT void flps_roundrectangle(
		int fill,
		int x,
		int y,
		int w,
		int h,
		long col
		);

FL_EXPORT void flps_set_clipping(
		int x,
		int y,
		int w,
		int h
		);

FL_EXPORT void flps_set_font(
		int style,
		int size
		);

FL_EXPORT void flps_unset_clipping(
		void
		);

#ifdef MAKING_FORMS
#include "flimage_int.h"
#endif

#if defined(__cplusplus)
}
#endif

#endif