| 5 | import io.github.humbleui.skija.impl.*; |
| 6 | |
| 7 | public interface IHasImageInfo { |
| 8 | ImageInfo getImageInfo(); |
| 9 | |
| 10 | /** |
| 11 | * Returns pixel count in each row. Should be equal or less than |
| 12 | * getRowBytes() / getImageInfo().getBytesPerPixel(). |
| 13 | * |
| 14 | * May be less than getPixelRef().getWidth(). Will not exceed getPixelRef().getWidth() less |
| 15 | * |
| 16 | * @return pixel width in ImageInfo |
| 17 | */ |
| 18 | default int getWidth() { |
| 19 | return getImageInfo()._width; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Returns pixel row count. |
| 24 | * |
| 25 | * Maybe be less than getPixelRef().getHeight(). Will not exceed getPixelRef().getHeight() |
| 26 | * |
| 27 | * @return pixel height in ImageInfo |
| 28 | */ |
| 29 | default int getHeight() { |
| 30 | return getImageInfo()._height; |
| 31 | } |
| 32 | |
| 33 | @NotNull |
| 34 | default ColorInfo getColorInfo() { |
| 35 | return getImageInfo()._colorInfo; |
| 36 | } |
| 37 | |
| 38 | @NotNull |
| 39 | default ColorType getColorType() { |
| 40 | return getImageInfo()._colorInfo._colorType; |
| 41 | } |
| 42 | |
| 43 | @NotNull |
| 44 | default ColorAlphaType getAlphaType() { |
| 45 | return getImageInfo()._colorInfo._alphaType; |
| 46 | } |
| 47 | |
| 48 | @Nullable |
| 49 | default ColorSpace getColorSpace() { |
| 50 | return getImageInfo()._colorInfo._colorSpace; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Returns number of bytes per pixel required by ColorType. |
| 55 | * Returns zero if colorType is {@link ColorType#UNKNOWN}. |
| 56 | * |
| 57 | * @return bytes in pixel |
| 58 | */ |
| 59 | default int getBytesPerPixel() { |
| 60 | return getImageInfo().getBytesPerPixel(); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |
no outgoing calls
no test coverage detected