| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
package com.drew.imaging.png; |
| 22 |
|
| 23 |
import com.drew.lang.SequentialByteArrayReader; |
| 24 |
import com.drew.lang.annotations.NotNull; |
| 25 |
|
| 26 |
import java.io.IOException; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public class PngChromaticities |
| 32 |
{ |
| 33 |
private final int _whitePointX; |
| 34 |
private final int _whitePointY; |
| 35 |
private final int _redX; |
| 36 |
private final int _redY; |
| 37 |
private final int _greenX; |
| 38 |
private final int _greenY; |
| 39 |
private final int _blueX; |
| 40 |
private final int _blueY; |
| 41 |
|
| 42 |
public PngChromaticities(@NotNull byte[] bytes) throws PngProcessingException |
| 43 |
{ |
| 44 |
if (bytes.length != 8 * 4) { |
| 45 |
throw new PngProcessingException("Invalid number of bytes"); |
| 46 |
} |
| 47 |
|
| 48 |
SequentialByteArrayReader reader = new SequentialByteArrayReader(bytes); |
| 49 |
try { |
| 50 |
_whitePointX = reader.getInt32(); |
| 51 |
_whitePointY = reader.getInt32(); |
| 52 |
_redX = reader.getInt32(); |
| 53 |
_redY = reader.getInt32(); |
| 54 |
_greenX = reader.getInt32(); |
| 55 |
_greenY = reader.getInt32(); |
| 56 |
_blueX = reader.getInt32(); |
| 57 |
_blueY = reader.getInt32(); |
| 58 |
} catch (IOException ex) { |
| 59 |
throw new PngProcessingException(ex); |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
public int getWhitePointX() |
| 64 |
{ |
| 65 |
return _whitePointX; |
| 66 |
} |
| 67 |
|
| 68 |
public int getWhitePointY() |
| 69 |
{ |
| 70 |
return _whitePointY; |
| 71 |
} |
| 72 |
|
| 73 |
public int getRedX() |
| 74 |
{ |
| 75 |
return _redX; |
| 76 |
} |
| 77 |
|
| 78 |
public int getRedY() |
| 79 |
{ |
| 80 |
return _redY; |
| 81 |
} |
| 82 |
|
| 83 |
public int getGreenX() |
| 84 |
{ |
| 85 |
return _greenX; |
| 86 |
} |
| 87 |
|
| 88 |
public int getGreenY() |
| 89 |
{ |
| 90 |
return _greenY; |
| 91 |
} |
| 92 |
|
| 93 |
public int getBlueX() |
| 94 |
{ |
| 95 |
return _blueX; |
| 96 |
} |
| 97 |
|
| 98 |
public int getBlueY() |
| 99 |
{ |
| 100 |
return _blueY; |
| 101 |
} |
| 102 |
} |