JasPer 4.2.9 |

Loading...
Searching...
No Matches
jas_image.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1999-2000 Image Power, Inc. and the University of
3 * British Columbia.
4 * Copyright (c) 2001-2003 Michael David Adams.
5 * All rights reserved.
6 */
7
8/* __START_OF_JASPER_LICENSE__
9 *
10 * JasPer License Version 2.0
11 *
12 * Copyright (c) 2001-2006 Michael David Adams
13 * Copyright (c) 1999-2000 Image Power, Inc.
14 * Copyright (c) 1999-2000 The University of British Columbia
15 *
16 * All rights reserved.
17 *
18 * Permission is hereby granted, free of charge, to any person (the
19 * "User") obtaining a copy of this software and associated documentation
20 * files (the "Software"), to deal in the Software without restriction,
21 * including without limitation the rights to use, copy, modify, merge,
22 * publish, distribute, and/or sell copies of the Software, and to permit
23 * persons to whom the Software is furnished to do so, subject to the
24 * following conditions:
25 *
26 * 1. The above copyright notices and this permission notice (which
27 * includes the disclaimer below) shall be included in all copies or
28 * substantial portions of the Software.
29 *
30 * 2. The name of a copyright holder shall not be used to endorse or
31 * promote products derived from the Software without specific prior
32 * written permission.
33 *
34 * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
35 * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
36 * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
37 * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
39 * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
40 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
41 * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
42 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
43 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
44 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
45 * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
46 * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
47 * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
48 * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
49 * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
50 * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
51 * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
52 * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
53 * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
54 * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
55 * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
56 * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
57 * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
58 * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
59 * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
60 *
61 * __END_OF_JASPER_LICENSE__
62 */
63
68
69#ifndef JAS_IMAGE_H
70#define JAS_IMAGE_H
71
72/******************************************************************************\
73* Includes.
74\******************************************************************************/
75
76/* The configuration header file should be included first. */
77#include <jasper/jas_config.h>
78
79#include <jasper/jas_stream.h>
80#include <jasper/jas_types.h>
81#include <jasper/jas_seq.h> /* IWYU pragma: export */
82#include <jasper/jas_cm.h> /* IWYU pragma: export */
83#include <stdio.h>
84
85#ifdef __cplusplus
86 extern "C" {
87#endif
88
93
94/******************************************************************************\
95* Constants.
96\******************************************************************************/
97
98/*
99 * Miscellaneous constants.
100 */
101
102/* Basic units */
103#define JAS_IMAGE_KIBI (JAS_CAST(size_t, 1024))
104#define JAS_IMAGE_MEBI (JAS_IMAGE_KIBI * JAS_IMAGE_KIBI)
105
106/* The threshold at which image data is no longer stored in memory. */
107#define JAS_IMAGE_INMEMTHRESH (256 * JAS_IMAGE_MEBI)
108
109/*
110 * Component types
111 */
112
113#define JAS_IMAGE_CT_UNKNOWN 0x10000
114#define JAS_IMAGE_CT_COLOR(n) ((n) & 0x7fff)
115#define JAS_IMAGE_CT_OPACITY 0x08000
116
117#define JAS_IMAGE_CT_RGB_R 0
118#define JAS_IMAGE_CT_RGB_G 1
119#define JAS_IMAGE_CT_RGB_B 2
120
121#define JAS_IMAGE_CT_YCBCR_Y 0
122#define JAS_IMAGE_CT_YCBCR_CB 1
123#define JAS_IMAGE_CT_YCBCR_CR 2
124
125#define JAS_IMAGE_CT_GRAY_Y 0
126
127/******************************************************************************\
128* Simple types.
129\******************************************************************************/
130
134 typedef int_fast32_t jas_image_coord_t;
135#define JAS_IMAGE_COORD_MAX INT_FAST32_MAX
136#define JAS_IMAGE_COORD_MIN INT_FAST32_MIN
137
141 typedef int_fast16_t jas_image_colorspc_t;
142
146 typedef int_fast32_t jas_image_cmpttype_t;
147
152 typedef int_fast16_t jas_image_smpltype_t;
153
154/******************************************************************************\
155* Image class and supporting classes.
156\******************************************************************************/
157
168 typedef struct {
169
170 /* The x-coordinate of the top-left corner of the component. */
171 jas_image_coord_t tlx_;
172
173 /* The y-coordinate of the top-left corner of the component. */
174 jas_image_coord_t tly_;
175
176 /* The horizontal sampling period in units of the reference grid. */
177 jas_image_coord_t hstep_;
178
179 /* The vertical sampling period in units of the reference grid. */
180 jas_image_coord_t vstep_;
181
182 /* The component width in samples. */
183 jas_image_coord_t width_;
184
185 /* The component height in samples. */
186 jas_image_coord_t height_;
187
188 /* The precision of the sample data (i.e., the number of bits per sample).
189 If the samples are signed values, this quantity includes the sign bit. */
190 unsigned prec_;
191
192 /* The signedness of the sample data. */
193 int sgnd_;
194
195 /* The stream containing the component data. */
196 jas_stream_t *stream_;
197
198 /* The number of characters per sample in the stream. */
199 unsigned cps_;
200
201 /* The type of component (e.g., opacity, red, green, blue, luma). */
202 jas_image_cmpttype_t type_;
203
204} jas_image_cmpt_t;
205
215 typedef struct {
216
217 /* The x-coordinate of the top-left corner of the image bounding box. */
218 jas_image_coord_t tlx_;
219
220 /* The y-coordinate of the top-left corner of the image bounding box. */
221 jas_image_coord_t tly_;
222
223 /* The x-coordinate of the bottom-right corner of the image bounding
224 box (plus one). */
225 jas_image_coord_t brx_;
226
227 /* The y-coordinate of the bottom-right corner of the image bounding
228 box (plus one). */
229 jas_image_coord_t bry_;
230
231 /* The number of components. */
232 unsigned numcmpts_;
233
234 /* The maximum number of components that this image can have (i.e., the
235 allocated size of the components array). */
236 unsigned maxcmpts_;
237
238 /* Per-component information. */
239 jas_image_cmpt_t **cmpts_;
240
241 /* The color space. */
242 jas_clrspc_t clrspc_;
243
244 /* The CM profile. */
245 jas_cmprof_t *cmprof_;
246
247 //bool inmem_;
248
249} jas_image_t;
250
258 typedef struct {
259
260 /* The x-coordinate of the top-left corner of the component. */
261 jas_image_coord_t tlx;
262
263 /* The y-coordinate of the top-left corner of the component. */
264 jas_image_coord_t tly;
265
266 /* The horizontal sampling period in units of the reference grid. */
267 jas_image_coord_t hstep;
268
269 /* The vertical sampling period in units of the reference grid. */
270 jas_image_coord_t vstep;
271
272 /* The width of the component in samples. */
273 jas_image_coord_t width;
274
275 /* The height of the component in samples. */
276 jas_image_coord_t height;
277
278 /* The precision of the component sample data. */
279 unsigned prec;
280
281 /* The signedness of the component sample data. */
282 int sgnd;
283
284} jas_image_cmptparm_t;
285
286/******************************************************************************\
287* File format related classes.
288\******************************************************************************/
289
293#define JAS_IMAGE_MAXFMTS 32
294
298 typedef struct {
299
301 jas_image_t *(*decode)(jas_stream_t *in, const char *opts);
302
304 int (*encode)(jas_image_t *image, jas_stream_t *out, const char *opts);
305
307 int (*validate)(jas_stream_t *in);
308
309} jas_image_fmtops_t;
310
314 typedef struct {
315
317 int id;
318
320 char *name;
321
322 /* The primary file name extension associated with this format. */
323 /* This member only exists for backward compatibility. */
324 char *ext;
325
327 char **exts;
328 size_t max_exts;
329 size_t num_exts;
330
332 int enabled;
333
335 char *desc;
336
338 jas_image_fmtops_t ops;
339
340} jas_image_fmtinfo_t;
341
342/******************************************************************************\
343* Image operations.
344\******************************************************************************/
345
349JAS_EXPORT
350 jas_image_t *jas_image_create(unsigned numcmpts,
351 const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc);
352
356JAS_EXPORT
357 jas_image_t *jas_image_create0(void);
358
362JAS_EXPORT
363 jas_image_t *jas_image_copy(jas_image_t *image);
364
368JAS_EXPORT
369 void jas_image_destroy(jas_image_t *image);
370
374#define jas_image_width(image) \
375 ((image)->brx_ - (image)->tlx_)
376
380#define jas_image_height(image) \
381 ((image)->bry_ - (image)->tly_)
382
387#define jas_image_tlx(image) \
388 ((image)->tlx_)
389
394#define jas_image_tly(image) \
395 ((image)->tly_)
396
401#define jas_image_brx(image) \
402 ((image)->brx_)
403
408#define jas_image_bry(image) \
409 ((image)->bry_)
410
414#define jas_image_numcmpts(image) \
415 ((image)->numcmpts_)
416
420#define jas_image_clrspc(image) \
421 ((image)->clrspc_)
422
426#define jas_image_setclrspc(image, clrspc) \
427 ((image)->clrspc_ = (clrspc))
428
429#define jas_image_cmpttype(image, cmptno) \
430 ((image)->cmpts_[(cmptno)]->type_)
431#define jas_image_setcmpttype(image, cmptno, type) \
432 ((image)->cmpts_[(cmptno)]->type_ = (type))
433
437#define jas_image_cmptwidth(image, cmptno) \
438 ((image)->cmpts_[cmptno]->width_)
439
443#define jas_image_cmptheight(image, cmptno) \
444 ((image)->cmpts_[cmptno]->height_)
445
449#define jas_image_cmptsgnd(image, cmptno) \
450 ((image)->cmpts_[cmptno]->sgnd_)
451
455#define jas_image_cmptprec(image, cmptno) \
456 ((image)->cmpts_[cmptno]->prec_)
457
461#define jas_image_cmpthstep(image, cmptno) \
462 ((image)->cmpts_[cmptno]->hstep_)
463
467#define jas_image_cmptvstep(image, cmptno) \
468 ((image)->cmpts_[cmptno]->vstep_)
469
473#define jas_image_cmpttlx(image, cmptno) \
474 ((image)->cmpts_[cmptno]->tlx_)
475
479#define jas_image_cmpttly(image, cmptno) \
480 ((image)->cmpts_[cmptno]->tly_)
481
486#define jas_image_cmptbrx(image, cmptno) \
487 ((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
488 (image)->cmpts_[cmptno]->hstep_)
489
494#define jas_image_cmptbry(image, cmptno) \
495 ((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
496 (image)->cmpts_[cmptno]->vstep_)
497
501JAS_ATTRIBUTE_PURE
502JAS_EXPORT
503 bool jas_image_cmpt_domains_same(const jas_image_t *image);
504
509JAS_ATTRIBUTE_PURE
510JAS_EXPORT
511uint_fast32_t jas_image_rawsize(const jas_image_t *image);
512
516JAS_EXPORT
517 jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, const char *optstr);
518
522JAS_EXPORT
523 int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
524 const char *optstr);
525
533JAS_EXPORT
534 int jas_image_readcmpt(jas_image_t *image, unsigned cmptno,
535 jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width,
536 jas_image_coord_t height, jas_matrix_t *data);
537
541JAS_EXPORT
542 int jas_image_writecmpt(jas_image_t *image, unsigned cmptno,
543 jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width,
544 jas_image_coord_t height, const jas_matrix_t *data);
545
549JAS_EXPORT
550 void jas_image_delcmpt(jas_image_t *image, unsigned cmptno);
551
555JAS_EXPORT
556 int jas_image_addcmpt(jas_image_t *image, int cmptno,
557 const jas_image_cmptparm_t *cmptparm);
558
562JAS_EXPORT
563 int jas_image_copycmpt(jas_image_t *dstimage, unsigned dstcmptno,
564 jas_image_t *srcimage, unsigned srccmptno);
565
566JAS_ATTRIBUTE_CONST
567 static inline bool JAS_IMAGE_CDT_GETSGND(uint_least8_t dtype)
568{
569 return (dtype >> 7) & 1;
570}
571
572JAS_ATTRIBUTE_CONST
573 static inline uint_least8_t JAS_IMAGE_CDT_SETSGND(bool sgnd)
574{
575 return (uint_least8_t)sgnd << 7;
576}
577
578JAS_ATTRIBUTE_CONST
579 static inline uint_least8_t JAS_IMAGE_CDT_GETPREC(uint_least8_t dtype)
580{
581 return dtype & 0x7f;
582}
583
584JAS_ATTRIBUTE_CONST
585 static inline uint_least8_t JAS_IMAGE_CDT_SETPREC(uint_least8_t dtype)
586{
587 return dtype & 0x7f;
588}
589
590JAS_ATTRIBUTE_PURE
591 static inline uint_least8_t jas_image_cmptdtype(const jas_image_t *image,
592 unsigned cmptno)
593{
594 return JAS_IMAGE_CDT_SETSGND(image->cmpts_[cmptno]->sgnd_) |
595 JAS_IMAGE_CDT_SETPREC(image->cmpts_[cmptno]->prec_);
596}
597
601JAS_EXPORT
602 int jas_image_depalettize(jas_image_t *image, unsigned cmptno,
603 unsigned numlutents, const int_fast32_t *lutents, unsigned dtype,
604 unsigned newcmptno);
605
609JAS_EXPORT
610 int jas_image_readcmptsample(jas_image_t *image, unsigned cmptno, unsigned x,
611 unsigned y);
612
616JAS_EXPORT
617 void jas_image_writecmptsample(jas_image_t *image, unsigned cmptno,
618 unsigned x, unsigned y, int_fast32_t v);
619
623JAS_ATTRIBUTE_PURE
624JAS_EXPORT
625 int jas_image_getcmptbytype(const jas_image_t *image, jas_image_cmpttype_t ctype);
626
627/******************************************************************************\
628* Image format-related operations.
629\******************************************************************************/
630
634JAS_EXPORT
635 void jas_image_clearfmts(void);
636
637#if defined(JAS_FOR_INTERNAL_USE_ONLY)
638 void jas_image_clearfmts_internal(jas_image_fmtinfo_t *image_fmtinfos,
639 size_t *image_numfmts);
640#endif
641
645JAS_EXPORT
646 const jas_image_fmtinfo_t *jas_image_getfmtbyind(int index);
647
651JAS_EXPORT
652 int jas_image_getnumfmts(void);
653
654#if 0
655JAS_EXPORT
656 int jas_image_delfmtbyid(int id);
657#endif
658
666JAS_EXPORT
667 int jas_image_setfmtenable(int index, int enabled);
668
669#if 0
670// TODO: should this be added?
671JAS_EXPORT
672 int jas_image_getfmtindbyname(const char* name);
673#endif
674
678JAS_EXPORT
679 int jas_image_addfmt(int id, const char *name, const char *ext,
680 const char *desc, const jas_image_fmtops_t *ops);
681
682#if defined(JAS_FOR_INTERNAL_USE_ONLY)
683 int jas_image_addfmt_internal(jas_image_fmtinfo_t *image_fmtinfos,
684 size_t *image_numfmts, int id, const char *name, const char *ext,
685 const char *desc, const jas_image_fmtops_t *ops);
686#endif
687
691JAS_ATTRIBUTE_PURE
692JAS_EXPORT
693 int jas_image_strtofmt(const char *s);
694
698JAS_ATTRIBUTE_CONST
699JAS_EXPORT
700 const char *jas_image_fmttostr(int fmt);
701
705JAS_ATTRIBUTE_CONST
706JAS_EXPORT
707 const jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id);
708
712JAS_ATTRIBUTE_PURE
713JAS_EXPORT
714 const jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
715
719JAS_ATTRIBUTE_PURE
720JAS_EXPORT
721 int jas_image_fmtfromname(const char *filename);
722
729JAS_ATTRIBUTE_PURE
730JAS_EXPORT
731 int jas_image_getfmt(jas_stream_t *in);
732
736#define jas_image_cmprof(image) ((image)->cmprof_)
737
742JAS_ATTRIBUTE_PURE
743JAS_EXPORT
744 int jas_image_ishomosamp(const jas_image_t *image);
745
749JAS_EXPORT
750 int jas_image_sampcmpt(jas_image_t *image, unsigned cmptno, unsigned newcmptno,
751 jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs,
752 jas_image_coord_t vs, int sgnd, unsigned prec);
753
757JAS_EXPORT
758 int jas_image_writecmpt2(jas_image_t *image, unsigned cmptno,
759 jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width,
760 jas_image_coord_t height, const long *buf);
761
765JAS_EXPORT
766 int jas_image_readcmpt2(jas_image_t *image, unsigned cmptno,
767 jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width,
768 jas_image_coord_t height, long *buf);
769
773#define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
774
778JAS_EXPORT
779 jas_image_t *jas_image_chclrspc(jas_image_t *image,
780 const jas_cmprof_t *outprof, jas_cmxform_intent_t intent);
781
785JAS_EXPORT
786 int jas_image_dump(jas_image_t *image, FILE *out);
787
788/******************************************************************************\
789* Image format-dependent operations.
790\******************************************************************************/
791
792#if defined(JAS_INCLUDE_JPG_CODEC)
793/* Format-dependent operations for JPG support. */
794//JAS_EXPORT
795 jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr);
796//JAS_EXPORT
797 int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
798//JAS_EXPORT
799 int jpg_validate(jas_stream_t *in);
800#endif
801
802#if defined(JAS_INCLUDE_HEIC_CODEC)
803/* Format-dependent operations for HEIC support. */
804//JAS_EXPORT
805 jas_image_t *jas_heic_decode(jas_stream_t *in, const char *optstr);
806//JAS_EXPORT
807 int jas_heic_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
808//JAS_EXPORT
809 int jas_heic_validate(jas_stream_t *in);
810#endif
811
812#if defined(JAS_INCLUDE_MIF_CODEC)
813/* Format-dependent operations for MIF support. */
814//JAS_EXPORT
815 jas_image_t *mif_decode(jas_stream_t *in, const char *optstr);
816//JAS_EXPORT
817 int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
818//JAS_EXPORT
819 int mif_validate(jas_stream_t *in);
820#endif
821
822#if defined(JAS_INCLUDE_PNM_CODEC)
823/* Format-dependent operations for PNM support. */
824//JAS_EXPORT
825 jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr);
826//JAS_EXPORT
827 int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
828//JAS_EXPORT
829 int pnm_validate(jas_stream_t *in);
830#endif
831
832#if defined(JAS_INCLUDE_RAS_CODEC)
833/* Format-dependent operations for Sun Rasterfile support. */
834//JAS_EXPORT
835 jas_image_t *ras_decode(jas_stream_t *in, const char *optstr);
836//JAS_EXPORT
837 int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
838//JAS_EXPORT
839 int ras_validate(jas_stream_t *in);
840#endif
841
842#if defined(JAS_INCLUDE_BMP_CODEC)
843/* Format-dependent operations for BMP support. */
844//JAS_EXPORT
845 jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr);
846//JAS_EXPORT
847 int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
848//JAS_EXPORT
849 int bmp_validate(jas_stream_t *in);
850#endif
851
852#if defined(JAS_INCLUDE_JP2_CODEC)
853/* Format-dependent operations for JP2 support. */
854//JAS_EXPORT
855 jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr);
856//JAS_EXPORT
857 int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
858//JAS_EXPORT
859 int jp2_validate(jas_stream_t *in);
860#endif
861
862#if defined(JAS_INCLUDE_JPC_CODEC)
863/* Format-dependent operations for JPEG-2000 code stream support. */
864//JAS_EXPORT
865 jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr);
866//JAS_EXPORT
867 int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
868//JAS_EXPORT
869 int jpc_validate(jas_stream_t *in);
870#endif
871
872#if defined(JAS_INCLUDE_PGX_CODEC)
873/* Format-dependent operations for PGX support. */
874//JAS_EXPORT
875 jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr);
876//JAS_EXPORT
877 int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
878//JAS_EXPORT
879 int pgx_validate(jas_stream_t *in);
880#endif
881
885
886#ifdef __cplusplus
887}
888#endif
889
890#endif
jas_clrspc_t
unsigned jas_clrspc_t
Color space.
Definition jas_cm.h:97
jas_cmxform_intent_t
jas_cmxform_intent_t
Rendering intents.
Definition jas_cm.h:114
jas_image_copycmpt
JAS_EXPORT int jas_image_copycmpt(jas_image_t *dstimage, unsigned dstcmptno, jas_image_t *srcimage, unsigned srccmptno)
Copy a component from one image to another.
Definition jas_image.c:1113
jas_image_depalettize
JAS_EXPORT int jas_image_depalettize(jas_image_t *image, unsigned cmptno, unsigned numlutents, const int_fast32_t *lutents, unsigned dtype, unsigned newcmptno)
Depalettize an image.
Definition jas_image.c:1166
jas_image_readcmpt
JAS_EXPORT int jas_image_readcmpt(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, jas_matrix_t *data)
Read a rectangular region of an image component.
Definition jas_image.c:517
jas_image_destroy
JAS_EXPORT void jas_image_destroy(jas_image_t *image)
Deallocate any resources associated with an image.
Definition jas_image.c:306
jas_image_coord_t
int_fast32_t jas_image_coord_t
Image coordinate.
Definition jas_image.h:134
jas_image_delcmpt
JAS_EXPORT void jas_image_delcmpt(jas_image_t *image, unsigned cmptno)
Delete a component from an image.
Definition jas_image.c:964
jas_image_strtofmt
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_strtofmt(const char *s)
Get the ID for the image format with the specified name.
Definition jas_image.c:867
jas_image_addcmpt
JAS_EXPORT int jas_image_addcmpt(jas_image_t *image, int cmptno, const jas_image_cmptparm_t *cmptparm)
Add a component to an image.
Definition jas_image.c:979
jas_image_copy
JAS_EXPORT jas_image_t * jas_image_copy(jas_image_t *image)
Clone an image.
Definition jas_image.c:225
jas_image_lookupfmtbyid
JAS_ATTRIBUTE_CONST JAS_EXPORT const jas_image_fmtinfo_t * jas_image_lookupfmtbyid(int id)
Lookup image format information by the format ID.
Definition jas_image.c:1010
jas_image_readcmptsample
JAS_EXPORT int jas_image_readcmptsample(jas_image_t *image, unsigned cmptno, unsigned x, unsigned y)
Read a component sample for an image.
Definition jas_image.c:1209
jas_image_getfmt
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getfmt(jas_stream_t *in)
Get the format of image data in a stream.
Definition jas_image.c:885
jas_image_dump
JAS_EXPORT int jas_image_dump(jas_image_t *image, FILE *out)
Dump the information for an image (for debugging).
Definition jas_image.c:1136
jas_image_rawsize
JAS_ATTRIBUTE_PURE JAS_EXPORT uint_fast32_t jas_image_rawsize(const jas_image_t *image)
Get the raw size of an image (i.e., the nominal size of the image without any compression.
Definition jas_image.c:950
jas_image_chclrspc
JAS_EXPORT jas_image_t * jas_image_chclrspc(jas_image_t *image, const jas_cmprof_t *outprof, jas_cmxform_intent_t intent)
Change the color space for an image.
Definition jas_image.c:1608
jas_image_writecmptsample
JAS_EXPORT void jas_image_writecmptsample(jas_image_t *image, unsigned cmptno, unsigned x, unsigned y, int_fast32_t v)
Write a component sample for an image.
Definition jas_image.c:1231
jas_image_addfmt
JAS_EXPORT int jas_image_addfmt(int id, const char *name, const char *ext, const char *desc, const jas_image_fmtops_t *ops)
Add entry to table of image formats.
Definition jas_image.c:838
jas_image_fmttostr
JAS_ATTRIBUTE_CONST JAS_EXPORT const char * jas_image_fmttostr(int fmt)
Get the name of the image format with the specified ID.
Definition jas_image.c:876
jas_image_getcmptbytype
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getcmptbytype(const jas_image_t *image, jas_image_cmpttype_t ctype)
Get an image component by its type.
Definition jas_image.c:1254
jas_image_getfmtbyind
JAS_EXPORT const jas_image_fmtinfo_t * jas_image_getfmtbyind(int index)
Get a image format entry by its table index.
Definition jas_image.c:754
jas_image_cmpt_domains_same
JAS_ATTRIBUTE_PURE JAS_EXPORT bool jas_image_cmpt_domains_same(const jas_image_t *image)
Test if all components are specified at the same positions in space.
Definition jas_image.c:933
jas_image_fmtfromname
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_fmtfromname(const char *filename)
Guess the format of an image file based on its name.
Definition jas_image.c:907
jas_image_encode
JAS_EXPORT int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, const char *optstr)
Write an image to a stream in a specified format.
Definition jas_image.c:501
jas_image_lookupfmtbyname
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_image_fmtinfo_t * jas_image_lookupfmtbyname(const char *name)
Lookup image format information by the format name.
Definition jas_image.c:1025
jas_image_cmpttype_t
int_fast32_t jas_image_cmpttype_t
Component type (e.g., color, opacity).
Definition jas_image.h:146
jas_image_sampcmpt
JAS_EXPORT int jas_image_sampcmpt(jas_image_t *image, unsigned cmptno, unsigned newcmptno, jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, jas_image_coord_t vs, int sgnd, unsigned prec)
???
Definition jas_image.c:1347
jas_image_clearfmts
JAS_EXPORT void jas_image_clearfmts(void)
Clear the table of image formats.
Definition jas_image.c:787
jas_image_writecmpt
JAS_EXPORT int jas_image_writecmpt(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const jas_matrix_t *data)
Write a rectangular region of an image component.
Definition jas_image.c:620
jas_image_smpltype_t
int_fast16_t jas_image_smpltype_t
Component sample data format (e.g., real/integer, signedness, precision).
Definition jas_image.h:152
jas_image_readcmpt2
JAS_EXPORT int jas_image_readcmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, long *buf)
Read sample data in a component of an image.
Definition jas_image.c:1270
jas_image_getnumfmts
JAS_EXPORT int jas_image_getnumfmts(void)
Get the number of image format table entries.
Definition jas_image.c:762
jas_image_create
JAS_EXPORT jas_image_t * jas_image_create(unsigned numcmpts, const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc)
Create an image.
Definition jas_image.c:128
jas_image_colorspc_t
int_fast16_t jas_image_colorspc_t
Color space (e.g., RGB, YCbCr).
Definition jas_image.h:141
jas_image_writecmpt2
JAS_EXPORT int jas_image_writecmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const long *buf)
Write sample data in a component of an image.
Definition jas_image.c:1309
jas_image_decode
JAS_EXPORT jas_image_t * jas_image_decode(jas_stream_t *in, int fmt, const char *optstr)
Create an image from a stream in some specified format.
Definition jas_image.c:452
jas_image_create0
JAS_EXPORT jas_image_t * jas_image_create0(void)
Create an "empty" image.
Definition jas_image.c:203
jas_image_setfmtenable
JAS_EXPORT int jas_image_setfmtenable(int index, int enabled)
Get the number of image format table entries.
Definition jas_image.c:769
jas_image_ishomosamp
JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_ishomosamp(const jas_image_t *image)
Test if the sampling of the image is homogeneous.
Definition jas_image.c:1450
jas_cm.h
JasPer Color Management.
jas_seq.h
Sequence/Matrix Library.
jas_stream.h
I/O Stream Class.
jas_types.h
Primitive Types.
jas_cmprof_t
Definition jas_cm.h:329
jas_image_cmpt_t
Image component class.
Definition jas_image.h:168
jas_image_cmptparm_t
Component parameters class.
Definition jas_image.h:258
jas_image_fmtinfo_t
Image format information.
Definition jas_image.h:314
jas_image_fmtinfo_t::desc
char * desc
Definition jas_image.h:335
jas_image_fmtinfo_t::id
int id
Definition jas_image.h:317
jas_image_fmtinfo_t::ops
jas_image_fmtops_t ops
Definition jas_image.h:338
jas_image_fmtinfo_t::name
char * name
Definition jas_image.h:320
jas_image_fmtinfo_t::exts
char ** exts
Definition jas_image.h:327
jas_image_fmtinfo_t::enabled
int enabled
Definition jas_image.h:332
jas_image_fmtops_t
Image format-dependent operations.
Definition jas_image.h:298
jas_image_fmtops_t::encode
int(* encode)(jas_image_t *image, jas_stream_t *out, const char *opts)
Definition jas_image.h:304
jas_image_fmtops_t::validate
int(* validate)(jas_stream_t *in)
Definition jas_image.h:307
jas_image_t
Image class.
Definition jas_image.h:215
jas_matrix_t
Matrix type.
Definition jas_seq.h:117
jas_stream_t
I/O stream object.
Definition jas_stream.h:206