Returns the bit depth, 8, 16, 24 (RGB) or 32, or 0 if the bit depth is unknown. RGB images actually use 32 bits per pixel.
()
| 1483 | /** Returns the bit depth, 8, 16, 24 (RGB) or 32, or 0 if the bit depth |
| 1484 | is unknown. RGB images actually use 32 bits per pixel. */ |
| 1485 | public int getBitDepth() { |
| 1486 | ImageProcessor ip2 = ip; |
| 1487 | if (ip2==null) { |
| 1488 | int bitDepth = 0; |
| 1489 | switch (imageType) { |
| 1490 | case GRAY8: bitDepth=typeSet?8:0; break; |
| 1491 | case COLOR_256: bitDepth=8; break; |
| 1492 | case GRAY16: bitDepth=16; break; |
| 1493 | case GRAY32: bitDepth=32; break; |
| 1494 | case COLOR_RGB: bitDepth=24; break; |
| 1495 | } |
| 1496 | return bitDepth; |
| 1497 | } |
| 1498 | if (ip2 instanceof ByteProcessor) |
| 1499 | return 8; |
| 1500 | else if (ip2 instanceof ShortProcessor) |
| 1501 | return 16; |
| 1502 | else if (ip2 instanceof ColorProcessor) |
| 1503 | return 24; |
| 1504 | else if (ip2 instanceof FloatProcessor) |
| 1505 | return 32; |
| 1506 | return 0; |
| 1507 | } |
| 1508 | |
| 1509 | /** Returns the number of bytes per pixel. */ |
| 1510 | public int getBytesPerPixel() { |
no outgoing calls
no test coverage detected