Skip to content

Commit

Permalink
* Let Java2DFrameConverter.copy() from ByteBuffer with 4 channel…
Browse files Browse the repository at this point in the history
…s to `BufferedImage.TYPE_INT_RGB` among others (issue #181)
  • Loading branch information
saudet committed Jul 17, 2015
1 parent 2d61e6b commit 4a8d420
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Let `Java2DFrameConverter.copy()` from `ByteBuffer` with 4 channels to `BufferedImage.TYPE_INT_RGB` among others ([issue #181](https://github.com/bytedeco/javacv/issues/181))

### July 11, 2015 version 1.0
* Offer the Apache License, Version 2.0, as a new choice of license, in addition to the GPLv2 with Classpath exception
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/bytedeco/javacv/Java2DFrameConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,12 @@ public static void copy(Frame frame, BufferedImage bufferedImage, double gamma,
flipCopyWithGamma((FloatBuffer)in, frame.imageStride, FloatBuffer.wrap(a, start, a.length - start), step, gamma, false, flipChannels ? channels : 0);
} else if (out instanceof DataBufferInt) {
int[] a = ((DataBufferInt)out).getData();
flipCopyWithGamma((IntBuffer)in, frame.imageStride, IntBuffer.wrap(a, start, a.length - start), step, gamma, false, flipChannels ? channels : 0);
int stride = frame.imageStride;
if (in instanceof ByteBuffer) {
in = ((ByteBuffer)in).order(ByteOrder.BIG_ENDIAN).asIntBuffer();
stride /= 4;
}
flipCopyWithGamma((IntBuffer)in, stride, IntBuffer.wrap(a, start, a.length - start), step, gamma, false, flipChannels ? channels : 0);
} else if (out instanceof DataBufferShort) {
short[] a = ((DataBufferShort)out).getData();
flipCopyWithGamma((ShortBuffer)in, frame.imageStride, ShortBuffer.wrap(a, start, a.length - start), step, true, gamma, false, flipChannels ? channels : 0);
Expand Down

0 comments on commit 4a8d420

Please sign in to comment.