JasPer 2.0.33
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
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
86extern "C" {
87#endif
88
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
133typedef int_fast32_t jas_image_coord_t;
134#define JAS_IMAGE_COORD_MAX INT_FAST32_MAX
135#define JAS_IMAGE_COORD_MIN INT_FAST32_MIN
136
140typedef int_fast16_t jas_image_colorspc_t;
141
145typedef int_fast32_t jas_image_cmpttype_t;
146
151typedef int_fast16_t jas_image_smpltype_t;
152
153/******************************************************************************\
154* Image class and supporting classes.
155\******************************************************************************/
156
160typedef struct {
161
163 /* The x-coordinate of the top-left corner of the component. */
164
166 /* The y-coordinate of the top-left corner of the component. */
167
168 jas_image_coord_t hstep_;
169 /* The horizontal sampling period in units of the reference grid. */
170
171 jas_image_coord_t vstep_;
172 /* The vertical sampling period in units of the reference grid. */
173
174 jas_image_coord_t width_;
175 /* The component width in samples. */
176
177 jas_image_coord_t height_;
178 /* The component height in samples. */
179
180 unsigned prec_;
181 /* The precision of the sample data (i.e., the number of bits per
182 sample). If the samples are signed values, this quantity
183 includes the sign bit. */
184
185 int sgnd_;
186 /* The signedness of the sample data. */
187
188 jas_stream_t *stream_;
189 /* The stream containing the component data. */
190
191 unsigned cps_;
192 /* The number of characters per sample in the stream. */
193
195 /* The type of component (e.g., opacity, red, green, blue, luma). */
196
198
202typedef struct {
203
205 /* The x-coordinate of the top-left corner of the image bounding box. */
206
208 /* The y-coordinate of the top-left corner of the image bounding box. */
209
211 /* The x-coordinate of the bottom-right corner of the image bounding
212 box (plus one). */
213
215 /* The y-coordinate of the bottom-right corner of the image bounding
216 box (plus one). */
217
218 unsigned numcmpts_;
219 /* The number of components. */
220
221 unsigned maxcmpts_;
222 /* The maximum number of components that this image can have (i.e., the
223 allocated size of the components array). */
224
225 jas_image_cmpt_t **cmpts_;
226 /* Per-component information. */
227
228 jas_clrspc_t clrspc_;
229
230 jas_cmprof_t *cmprof_;
231
232// bool inmem_;
233
235
243typedef struct {
244
246 /* The x-coordinate of the top-left corner of the component. */
247
249 /* The y-coordinate of the top-left corner of the component. */
250
251 jas_image_coord_t hstep;
252 /* The horizontal sampling period in units of the reference grid. */
253
254 jas_image_coord_t vstep;
255 /* The vertical sampling period in units of the reference grid. */
256
257 jas_image_coord_t width;
258 /* The width of the component in samples. */
259
260 jas_image_coord_t height;
261 /* The height of the component in samples. */
262
263 unsigned prec;
264 /* The precision of the component sample data. */
265
266 int sgnd;
267 /* The signedness of the component sample data. */
268
270
271/******************************************************************************\
272* File format related classes.
273\******************************************************************************/
274
278#define JAS_IMAGE_MAXFMTS 32
279
283typedef struct {
284
285 jas_image_t *(*decode)(jas_stream_t *in, const char *opts);
286 /* Decode image data from a stream. */
287
288 int (*encode)(jas_image_t *image, jas_stream_t *out, const char *opts);
289 /* Encode image data to a stream. */
290
291 int (*validate)(jas_stream_t *in);
292 /* Determine if stream data is in a particular format. */
293
295
299typedef struct {
300
301 int id;
302 /* The ID for this format. */
303
304 char *name;
305 /* The name by which this format is identified. */
306
307 char *ext;
308 /* The file name extension associated with this format. */
309
310 char *desc;
311 /* A brief description of the format. */
312
314 /* The operations for this format. */
315
317
318/******************************************************************************\
319* Image operations.
320\******************************************************************************/
321
325JAS_DLLEXPORT jas_image_t *jas_image_create(unsigned numcmpts,
326 const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc);
327
331JAS_DLLEXPORT jas_image_t *jas_image_create0(void);
332
336JAS_DLLEXPORT jas_image_t *jas_image_copy(jas_image_t *image);
337
341JAS_DLLEXPORT void jas_image_destroy(jas_image_t *image);
342
346#define jas_image_width(image) \
347 ((image)->brx_ - (image)->tlx_)
348
352#define jas_image_height(image) \
353 ((image)->bry_ - (image)->tly_)
354
359#define jas_image_tlx(image) \
360 ((image)->tlx_)
361
366#define jas_image_tly(image) \
367 ((image)->tly_)
368
373#define jas_image_brx(image) \
374 ((image)->brx_)
375
380#define jas_image_bry(image) \
381 ((image)->bry_)
382
386#define jas_image_numcmpts(image) \
387 ((image)->numcmpts_)
388
392#define jas_image_clrspc(image) \
393 ((image)->clrspc_)
394
398#define jas_image_setclrspc(image, clrspc) \
399 ((image)->clrspc_ = (clrspc))
400
401#define jas_image_cmpttype(image, cmptno) \
402 ((image)->cmpts_[(cmptno)]->type_)
403#define jas_image_setcmpttype(image, cmptno, type) \
404 ((image)->cmpts_[(cmptno)]->type_ = (type))
405
409#define jas_image_cmptwidth(image, cmptno) \
410 ((image)->cmpts_[cmptno]->width_)
411
415#define jas_image_cmptheight(image, cmptno) \
416 ((image)->cmpts_[cmptno]->height_)
417
421#define jas_image_cmptsgnd(image, cmptno) \
422 ((image)->cmpts_[cmptno]->sgnd_)
423
427#define jas_image_cmptprec(image, cmptno) \
428 ((image)->cmpts_[cmptno]->prec_)
429
433#define jas_image_cmpthstep(image, cmptno) \
434 ((image)->cmpts_[cmptno]->hstep_)
435
439#define jas_image_cmptvstep(image, cmptno) \
440 ((image)->cmpts_[cmptno]->vstep_)
441
445#define jas_image_cmpttlx(image, cmptno) \
446 ((image)->cmpts_[cmptno]->tlx_)
447
451#define jas_image_cmpttly(image, cmptno) \
452 ((image)->cmpts_[cmptno]->tly_)
453
458#define jas_image_cmptbrx(image, cmptno) \
459 ((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
460 (image)->cmpts_[cmptno]->hstep_)
461
466#define jas_image_cmptbry(image, cmptno) \
467 ((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
468 (image)->cmpts_[cmptno]->vstep_)
469
473JAS_ATTRIBUTE_PURE
474JAS_DLLEXPORT bool jas_image_cmpt_domains_same(const jas_image_t *image);
475
480JAS_ATTRIBUTE_PURE
481JAS_DLLEXPORT
482uint_fast32_t jas_image_rawsize(const jas_image_t *image);
483
487JAS_DLLEXPORT
488jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, const char *optstr);
489
493JAS_DLLEXPORT
494int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
495 const char *optstr);
496
504JAS_DLLEXPORT
505int jas_image_readcmpt(jas_image_t *image, unsigned cmptno,
507 jas_image_coord_t height, jas_matrix_t *data);
508
512JAS_DLLEXPORT
513int jas_image_writecmpt(jas_image_t *image, unsigned cmptno,
515 jas_image_coord_t height, const jas_matrix_t *data);
516
520JAS_DLLEXPORT void jas_image_delcmpt(jas_image_t *image, unsigned cmptno);
521
525JAS_DLLEXPORT int jas_image_addcmpt(jas_image_t *image, int cmptno,
526 const jas_image_cmptparm_t *cmptparm);
527
531JAS_DLLEXPORT int jas_image_copycmpt(jas_image_t *dstimage, unsigned dstcmptno,
532 jas_image_t *srcimage, unsigned srccmptno);
533
534JAS_ATTRIBUTE_CONST
535static inline bool JAS_IMAGE_CDT_GETSGND(uint_least8_t dtype)
536{
537 return (dtype >> 7) & 1;
538}
539
540JAS_ATTRIBUTE_CONST
541static inline uint_least8_t JAS_IMAGE_CDT_SETSGND(bool sgnd)
542{
543 return (uint_least8_t)sgnd << 7;
544}
545
546JAS_ATTRIBUTE_CONST
547static inline uint_least8_t JAS_IMAGE_CDT_GETPREC(uint_least8_t dtype)
548{
549 return dtype & 0x7f;
550}
551
552JAS_ATTRIBUTE_CONST
553static inline uint_least8_t JAS_IMAGE_CDT_SETPREC(uint_least8_t dtype)
554{
555 return dtype & 0x7f;
556}
557
558JAS_ATTRIBUTE_PURE
559static inline uint_least8_t jas_image_cmptdtype(const jas_image_t *image, unsigned cmptno)
560{
561 return JAS_IMAGE_CDT_SETSGND(image->cmpts_[cmptno]->sgnd_) |
562 JAS_IMAGE_CDT_SETPREC(image->cmpts_[cmptno]->prec_);
563}
564
568JAS_DLLEXPORT
569int jas_image_depalettize(jas_image_t *image, unsigned cmptno,
570 unsigned numlutents, const int_fast32_t *lutents, unsigned dtype,
571 unsigned newcmptno);
572
576JAS_DLLEXPORT
577int jas_image_readcmptsample(jas_image_t *image, unsigned cmptno, unsigned x,
578 unsigned y);
579
583JAS_DLLEXPORT
584void jas_image_writecmptsample(jas_image_t *image, unsigned cmptno,
585 unsigned x, unsigned y, int_fast32_t v);
586
590JAS_ATTRIBUTE_PURE
591JAS_DLLEXPORT
593
594/******************************************************************************\
595* Image format-related operations.
596\******************************************************************************/
597
601JAS_DLLEXPORT
602void jas_image_clearfmts(void);
603
607JAS_DLLEXPORT
608int jas_image_addfmt(int id, const char *name, const char *ext,
609 const char *desc, const jas_image_fmtops_t *ops);
610
614JAS_ATTRIBUTE_PURE
615JAS_DLLEXPORT
616int jas_image_strtofmt(const char *s);
617
621JAS_ATTRIBUTE_CONST
622JAS_DLLEXPORT
623const char *jas_image_fmttostr(int fmt);
624
628JAS_ATTRIBUTE_CONST
629JAS_DLLEXPORT
631
635JAS_ATTRIBUTE_PURE
636JAS_DLLEXPORT
637const jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
638
642JAS_ATTRIBUTE_PURE
643JAS_DLLEXPORT
644int jas_image_fmtfromname(const char *filename);
645
649JAS_ATTRIBUTE_PURE
650JAS_DLLEXPORT
651int jas_image_getfmt(jas_stream_t *in);
652
653
657#define jas_image_cmprof(image) ((image)->cmprof_)
658
662JAS_ATTRIBUTE_PURE
663JAS_DLLEXPORT
664int jas_image_ishomosamp(const jas_image_t *image);
665
669JAS_DLLEXPORT
670int jas_image_sampcmpt(jas_image_t *image, unsigned cmptno, unsigned newcmptno,
672 jas_image_coord_t vs, int sgnd, unsigned prec);
673
677JAS_DLLEXPORT int jas_image_writecmpt2(jas_image_t *image, unsigned cmptno, jas_image_coord_t x,
679 const long *buf);
680
684JAS_DLLEXPORT
685int jas_image_readcmpt2(jas_image_t *image, unsigned cmptno,
687 jas_image_coord_t height, long *buf);
688
692#define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
693
697JAS_DLLEXPORT jas_image_t *jas_image_chclrspc(jas_image_t *image, const jas_cmprof_t *outprof,
698 jas_cmxform_intent_t intent);
699
703JAS_DLLEXPORT void jas_image_dump(jas_image_t *image, FILE *out);
704
705/******************************************************************************\
706* Image format-dependent operations.
707\******************************************************************************/
708
709#if defined(JAS_INCLUDE_JPG_CODEC)
710/* Format-dependent operations for JPG support. */
711JAS_DLLEXPORT jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr);
712JAS_DLLEXPORT int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
713JAS_DLLEXPORT int jpg_validate(jas_stream_t *in);
714#endif
715
716#if defined(JAS_INCLUDE_MIF_CODEC)
717/* Format-dependent operations for MIF support. */
718JAS_DLLEXPORT jas_image_t *mif_decode(jas_stream_t *in, const char *optstr);
719JAS_DLLEXPORT int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
720JAS_DLLEXPORT int mif_validate(jas_stream_t *in);
721#endif
722
723#if defined(JAS_INCLUDE_PNM_CODEC)
724/* Format-dependent operations for PNM support. */
725JAS_DLLEXPORT jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr);
726JAS_DLLEXPORT int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
727JAS_DLLEXPORT int pnm_validate(jas_stream_t *in);
728#endif
729
730#if defined(JAS_INCLUDE_RAS_CODEC)
731/* Format-dependent operations for Sun Rasterfile support. */
732JAS_DLLEXPORT jas_image_t *ras_decode(jas_stream_t *in, const char *optstr);
733JAS_DLLEXPORT int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
734JAS_DLLEXPORT int ras_validate(jas_stream_t *in);
735#endif
736
737#if defined(JAS_INCLUDE_BMP_CODEC)
738/* Format-dependent operations for BMP support. */
739JAS_DLLEXPORT jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr);
740JAS_DLLEXPORT int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
741JAS_DLLEXPORT int bmp_validate(jas_stream_t *in);
742#endif
743
744#if defined(JAS_INCLUDE_JP2_CODEC)
745/* Format-dependent operations for JP2 support. */
746JAS_DLLEXPORT jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr);
747JAS_DLLEXPORT int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
748JAS_DLLEXPORT int jp2_validate(jas_stream_t *in);
749#endif
750
751#if defined(JAS_INCLUDE_JPC_CODEC)
752/* Format-dependent operations for JPEG-2000 code stream support. */
753JAS_DLLEXPORT jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr);
754JAS_DLLEXPORT int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
755JAS_DLLEXPORT int jpc_validate(jas_stream_t *in);
756#endif
757
758#if defined(JAS_INCLUDE_PGX_CODEC)
759/* Format-dependent operations for PGX support. */
760JAS_DLLEXPORT jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr);
761JAS_DLLEXPORT int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr);
762JAS_DLLEXPORT int pgx_validate(jas_stream_t *in);
763#endif
764
769#ifdef __cplusplus
770}
771#endif
772
773#endif
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT int jas_image_ishomosamp(const jas_image_t *image)
???
Definition: jas_image.c:1308
JAS_DLLEXPORT 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:1458
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT 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:1112
int_fast32_t jas_image_coord_t
Image coordinate.
Definition: jas_image.h:133
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT int jas_image_getfmt(jas_stream_t *in)
Get the format of image data in a stream.
Definition: jas_image.c:753
JAS_ATTRIBUTE_CONST JAS_DLLEXPORT const jas_image_fmtinfo_t * jas_image_lookupfmtbyid(int id)
Lookup image format information by the format ID.
Definition: jas_image.c:876
JAS_DLLEXPORT 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:974
JAS_DLLEXPORT void jas_image_clearfmts(void)
Clear the table of image formats.
Definition: jas_image.c:666
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT int jas_image_fmtfromname(const char *filename)
Guess the format of an image file based on its name.
Definition: jas_image.c:774
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT int jas_image_strtofmt(const char *s)
Get the ID for the image format with the specified name.
Definition: jas_image.c:735
JAS_DLLEXPORT 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:570
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT 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:816
JAS_DLLEXPORT 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:845
JAS_DLLEXPORT 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:470
JAS_DLLEXPORT 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:1211
JAS_DLLEXPORT 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:1025
JAS_DLLEXPORT 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:687
JAS_DLLEXPORT jas_image_t * jas_image_copy(jas_image_t *image)
Clone an image.
Definition: jas_image.c:224
JAS_DLLEXPORT void jas_image_delcmpt(jas_image_t *image, unsigned cmptno)
Delete a component from an image.
Definition: jas_image.c:830
int_fast32_t jas_image_cmpttype_t
Component type (e.g., color, opacity).
Definition: jas_image.h:145
JAS_ATTRIBUTE_CONST JAS_DLLEXPORT const char * jas_image_fmttostr(int fmt)
Get the name of the image format with the specified ID.
Definition: jas_image.c:744
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT const jas_image_fmtinfo_t * jas_image_lookupfmtbyname(const char *name)
Lookup image format information by the format name.
Definition: jas_image.c:889
JAS_DLLEXPORT 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:416
int_fast16_t jas_image_smpltype_t
Component sample data format (e.g., real/integer, signedness, precision).
Definition: jas_image.h:151
JAS_DLLEXPORT void jas_image_dump(jas_image_t *image, FILE *out)
Dump the information for an image (for debugging).
Definition: jas_image.c:997
int_fast16_t jas_image_colorspc_t
Color space (e.g., RGB, YCbCr).
Definition: jas_image.h:140
JAS_DLLEXPORT 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:127
JAS_DLLEXPORT 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:1177
JAS_DLLEXPORT 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:1067
JAS_DLLEXPORT 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:1142
JAS_ATTRIBUTE_PURE JAS_DLLEXPORT 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:799
JAS_DLLEXPORT void jas_image_destroy(jas_image_t *image)
Deallocate any resources associated with an image.
Definition: jas_image.c:303
JAS_DLLEXPORT jas_image_t * jas_image_create0(void)
Create an "empty" image.
Definition: jas_image.c:202
JAS_DLLEXPORT 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:1089
JAS_DLLEXPORT 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:454
JasPer Color Management.
Sequence/Matrix Library.
I/O Stream Class.
Primitive Types.
Image component class.
Definition: jas_image.h:160
Component parameters class.
Definition: jas_image.h:243
Image format information.
Definition: jas_image.h:299
Image format-dependent operations.
Definition: jas_image.h:283
Image class.
Definition: jas_image.h:202