Top Description Fields Constructors Methods
jogamp.opengl.util.pngj.chunks

public Class PngMetadata

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, jogamp.opengl.util.pngj.PngHelperInternal, .PngjException

We consider "image metadata" every info inside the image except for the most basic image info (IHDR chunk - ImageInfo class) and the pixels values.

This includes the palette (if present) and all the ancillary chunks

This class provides a wrapper over the collection of chunks of a image (read or to write) and provides some high level methods to access them

Field Summary

Modifier and TypeField and Description
private final ChunksList
private final boolean

Constructor Summary

AccessConstructor and Description
public
PngMetadata(final ChunksList chunks)

Method Summary

Modifier and TypeMethod and Description
public PngChunkPLTE
createPLTEChunk()

Creates a new empty palette chunk, queues it for write and return it to the caller, who should fill its entries

public PngChunkTRNS
createTRNSChunk()

Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries

private ChunksListForWrite
public double[]
getDpi()

returns -1 if not found or dimension unknown

public PngChunkPLTE

Returns:

null if not present
getPLTE
()

Returns the palette chunk, if present

public PngChunkTIME
getTime()

null if not found

public String
public PngChunkTRNS

Returns:

null if not present
getTRNS
()

Returns the TRNS chunk, if present

public String
getTxtForKey(final String k)

Returns empty if not found, concatenated (with newlines) if multiple!

public List<? extends PngChunkTextVar>
getTxtsForKey(final String k)

gets all text chunks with a given key

returns null if not found

Warning

this does not check the "lang" key of iTxt

public void
queueChunk(final PngChunk c, final boolean lazyOverwrite)

Queues the chunk at the writer

lazyOverwrite: if true, checks if there is a queued "equivalent" chunk and if so, overwrites it.

public void
public void
setDpi(final double x)

public void
setDpi(final double x, final double y)

public PngChunkTextVar

Returns:

Returns the created-queued chunks, just in case you want to examine, touch it
setText
(final String
: key (latin1)
k
,
final String
(arbitrary, should be latin1 if useLatin1)
val
,
final boolean useLatin1, final boolean compress)

Creates a text chunk and queue it.

public PngChunkTextVar
setText(final String k, final String val)

public PngChunkTIME

Returns:

Returns the created-queued chunk, just in case you want to examine or modify it
setTimeNow
(final int secsAgo)

Creates a time chunk with current time, less secsAgo seconds

public PngChunkTIME
public PngChunkTIME

Returns:

Returns the created-queued chunk, just in case you want to examine or modify it
setTimeYMDHMS
(final int yearx, final int monx, final int dayx, final int hourx, final int minx, final int secx)

Creates a time chunk with diven date-time

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

chunkListback to summary
private final ChunksList chunkList
readonlyback to summary
private final boolean readonly

Constructor Detail

PngMetadataback to summary
public PngMetadata(final ChunksList chunks)

Method Detail

createPLTEChunkback to summary
public PngChunkPLTE createPLTEChunk()

Creates a new empty palette chunk, queues it for write and return it to the caller, who should fill its entries

createTRNSChunkback to summary
public PngChunkTRNS createTRNSChunk()

Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries

getChunkListWback to summary
private ChunksListForWrite getChunkListW()
getDpiback to summary
public double[] getDpi()

returns -1 if not found or dimension unknown

getPLTEback to summary
public PngChunkPLTE getPLTE()

Returns the palette chunk, if present

Returns:PngChunkPLTE

null if not present

getTimeback to summary
public PngChunkTIME getTime()

null if not found

getTimeAsStringback to summary
public String getTimeAsString()
getTRNSback to summary
public PngChunkTRNS getTRNS()

Returns the TRNS chunk, if present

Returns:PngChunkTRNS

null if not present

getTxtForKeyback to summary
public String getTxtForKey(final String k)

Returns empty if not found, concatenated (with newlines) if multiple! - and trimmed

Use getTxtsForKey() if you don't want this behaviour

getTxtsForKeyback to summary
public List<? extends PngChunkTextVar> getTxtsForKey(final String k)

gets all text chunks with a given key

returns null if not found

Warning

this does not check the "lang" key of iTxt

Annotations
@SuppressWarnings:unchecked
queueChunkback to summary
public void queueChunk(final PngChunk c, final boolean lazyOverwrite)

Queues the chunk at the writer

lazyOverwrite: if true, checks if there is a queued "equivalent" chunk and if so, overwrites it. However if that not check for already written chunks.

queueChunkback to summary
public void queueChunk(final PngChunk c)
setDpiback to summary
public void setDpi(final double x)
setDpiback to summary
public void setDpi(final double x, final double y)
setTextback to summary
public PngChunkTextVar setText(final String k, final String val, final boolean useLatin1, final boolean compress)

Creates a text chunk and queue it.

Parameters
k:String

: key (latin1)

val:String

(arbitrary, should be latin1 if useLatin1)

Returns:PngChunkTextVar

Returns the created-queued chunks, just in case you want to examine, touch it

setTextback to summary
public PngChunkTextVar setText(final String k, final String val)
setTimeNowback to summary
public PngChunkTIME setTimeNow(final int secsAgo)

Creates a time chunk with current time, less secsAgo seconds

Returns:PngChunkTIME

Returns the created-queued chunk, just in case you want to examine or modify it

setTimeNowback to summary
public PngChunkTIME setTimeNow()
setTimeYMDHMSback to summary
public PngChunkTIME setTimeYMDHMS(final int yearx, final int monx, final int dayx, final int hourx, final int minx, final int secx)

Creates a time chunk with diven date-time

Returns:PngChunkTIME

Returns the created-queued chunk, just in case you want to examine or modify it