JpxComponents

class JpxComponents(val width: Int, val height: Int, val componentCount: Int, val samples: ByteArray, val bitDepths: IntArray, val colorSpecification: JpxColorSpecification?)(source)

The samples of a JPEG 2000 image as the codestream stores them: every component after the inverse wavelet, the multiple component transform and the DC level shift, sampled onto the image grid, and before the JP2 palette, channel definitions and colour space. ImageKodec.decodeJpxComponents returns it.

Nothing is inverted or converted: a four-component file holds four components here, whether its header calls them CMYK or says nothing, and a palette image holds its indices. The caller decides what they mean, from colorSpecification or, in a PDF, from the image's own ColorSpace, which ISO 32000-1, 8.9.5.2 says overrides the file's.

Throws

if a side or componentCount is not positive, or samples or bitDepths does not hold what componentCount asks

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, componentCount: Int, samples: ByteArray, bitDepths: IntArray, colorSpecification: JpxColorSpecification?)

Properties

Link copied to clipboard

the bit depth the codestream gives each component, before the narrowing to 8 bits. Exposed directly: treat it as read-only.

Link copied to clipboard

the first colour specification box of the JP2 header, or null for a raw codestream or a JP2 file without one

Link copied to clipboard

the components of the codestream, 1 or more

Link copied to clipboard
val height: Int

rows, after the reduction

Link copied to clipboard

componentCount bytes per pixel, row by row, the components of a pixel in codestream order. A component deeper than 8 bits keeps its high 8 bits, and a shallower one is stretched to 0 to 255, as ImageKodec.decode narrows them. Exposed directly, not copied: treat it as read-only.

Link copied to clipboard
val width: Int

pixels per row, after the reduction

Functions

Link copied to clipboard
operator fun get(x: Int, y: Int, component: Int): Int

The sample of component at (x, y), 0 to 255.

Link copied to clipboard
open override fun toString(): String