@Implementation protected void copyPixelsFromBuffer(Buffer dst) { if (isRecycled()) { throw new IllegalStateException("Can't call copyPixelsFromBuffer() on a recycled bitmap"); } // See the related comment in #copyPixelsToBuffer(Buffer). if (getBytesPerPixel(config) != INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Not implemented: only Bitmaps with " + INTERNAL_BYTES_PER_PIXEL + " bytes per pixel are supported"); } if (!(dst instanceof ByteBuffer)) { throw new RuntimeException("Not implemented: unsupported Buffer subclass"); } ByteBuffer byteBuffer = (ByteBuffer) dst; if (byteBuffer.remaining() < colors.length * INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Buffer not large enough for pixels"); } for (int i = 0; i < colors.length; i++) { colors[i] = byteBuffer.getInt(); } }
@Implementation protected void setPixel(int x, int y, int color) { if (isRecycled()) { throw new IllegalStateException("Can't call setPixel() on a recycled bitmap"); } else if (!isMutable()) { throw new IllegalStateException("Bitmap is immutable"); } internalCheckPixelAccess(x, y); if (colors == null) { colors = new int[getWidth() * getHeight()]; } colors[y * getWidth() + x] = color; }
@Implementation public void copyPixelsFromBuffer(Buffer dst) { if (isRecycled()) { throw new IllegalStateException("Can't call copyPixelsFromBuffer() on a recycled bitmap"); } // See the related comment in #copyPixelsToBuffer(Buffer). if (getBytesPerPixel(config) != INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Not implemented: only Bitmaps with " + INTERNAL_BYTES_PER_PIXEL + " bytes per pixel are supported"); } if (!(dst instanceof ByteBuffer)) { throw new RuntimeException("Not implemented: unsupported Buffer subclass"); } ByteBuffer byteBuffer = (ByteBuffer) dst; if (byteBuffer.remaining() < colors.length * INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Buffer not large enough for pixels"); } for (int i = 0; i < colors.length; i++) { colors[i] = byteBuffer.getInt(); } }
@Implementation public void copyPixelsFromBuffer(Buffer dst) { if (isRecycled()) { throw new IllegalStateException("Can't call copyPixelsFromBuffer() on a recycled bitmap"); } // See the related comment in #copyPixelsToBuffer(Buffer). if (getBytesPerPixel(config) != INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Not implemented: only Bitmaps with " + INTERNAL_BYTES_PER_PIXEL + " bytes per pixel are supported"); } if (!(dst instanceof ByteBuffer)) { throw new RuntimeException("Not implemented: unsupported Buffer subclass"); } ByteBuffer byteBuffer = (ByteBuffer) dst; if (byteBuffer.remaining() < colors.length * INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Buffer not large enough for pixels"); } for (int i = 0; i < colors.length; i++) { colors[i] = byteBuffer.getInt(); } }
@Implementation public void copyPixelsFromBuffer(Buffer dst) { if (isRecycled()) { throw new IllegalStateException("Can't call copyPixelsFromBuffer() on a recycled bitmap"); } // See the related comment in #copyPixelsToBuffer(Buffer). if (getBytesPerPixel(config) != INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Not implemented: only Bitmaps with " + INTERNAL_BYTES_PER_PIXEL + " bytes per pixel are supported"); } if (!(dst instanceof ByteBuffer)) { throw new RuntimeException("Not implemented: unsupported Buffer subclass"); } ByteBuffer byteBuffer = (ByteBuffer) dst; if (byteBuffer.remaining() < colors.length * INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Buffer not large enough for pixels"); } for (int i = 0; i < colors.length; i++) { colors[i] = byteBuffer.getInt(); } }
@Implementation protected void copyPixelsFromBuffer(Buffer dst) { if (isRecycled()) { throw new IllegalStateException("Can't call copyPixelsFromBuffer() on a recycled bitmap"); } // See the related comment in #copyPixelsToBuffer(Buffer). if (getBytesPerPixel(config) != INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Not implemented: only Bitmaps with " + INTERNAL_BYTES_PER_PIXEL + " bytes per pixel are supported"); } if (!(dst instanceof ByteBuffer)) { throw new RuntimeException("Not implemented: unsupported Buffer subclass"); } ByteBuffer byteBuffer = (ByteBuffer) dst; if (byteBuffer.remaining() < colors.length * INTERNAL_BYTES_PER_PIXEL) { throw new RuntimeException("Buffer not large enough for pixels"); } for (int i = 0; i < colors.length; i++) { colors[i] = byteBuffer.getInt(); } }
@Implementation public void setPixel(int x, int y, int color) { if (isRecycled()) { throw new IllegalStateException("Can't call setPixel() on a recycled bitmap"); } else if (!isMutable()) { throw new IllegalStateException("Bitmap is immutable"); } internalCheckPixelAccess(x, y); if (colors == null) { colors = new int[getWidth() * getHeight()]; } colors[y * getWidth() + x] = color; }
@Implementation protected void setPixel(int x, int y, int color) { if (isRecycled()) { throw new IllegalStateException("Can't call setPixel() on a recycled bitmap"); } else if (!isMutable()) { throw new IllegalStateException("Bitmap is immutable"); } internalCheckPixelAccess(x, y); if (colors == null) { colors = new int[getWidth() * getHeight()]; } colors[y * getWidth() + x] = color; }
@Implementation public void setPixel(int x, int y, int color) { if (isRecycled()) { throw new IllegalStateException("Can't call setPixel() on a recycled bitmap"); } else if (!isMutable()) { throw new IllegalStateException("Bitmap is immutable"); } internalCheckPixelAccess(x, y); if (colors == null) { colors = new int[getWidth() * getHeight()]; } colors[y * getWidth() + x] = color; }
@Implementation public void setPixel(int x, int y, int color) { if (isRecycled()) { throw new IllegalStateException("Can't call setPixel() on a recycled bitmap"); } else if (!isMutable()) { throw new IllegalStateException("Bitmap is immutable"); } internalCheckPixelAccess(x, y); if (colors == null) { colors = new int[getWidth() * getHeight()]; } colors[y * getWidth() + x] = color; }