com.jogamp.common.nio.Buffers.remainingBytes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中com.jogamp.common.nio.Buffers.remainingBytes()方法的一些代码示例,展示了Buffers.remainingBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffers.remainingBytes()方法的具体详情如下:
包路径:com.jogamp.common.nio.Buffers
类名称:Buffers
方法名:remainingBytes

Buffers.remainingBytes介绍

[英]Returns the number of remaining bytes of the given anonymous buffer.
[中]返回给定匿名buffer的剩余字节数。

代码示例

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * @param buffer buffer to test for minimum
 * @param minBytesRemaining minimum bytes remaining
 * @throws IllegalArgumentException if <code>buffer</code> is of invalid type.
 * @throws IndexOutOfBoundsException if {@link #remainingBytes(Object)} is &lt; <code>minBytesRemaining<code>.
 */
public static void rangeCheckBytes(final Object buffer, final int minBytesRemaining) throws IllegalArgumentException, IndexOutOfBoundsException {
  if (buffer == null) {
    return;
  }
  final int bytesRemaining = remainingBytes(buffer);
  if (bytesRemaining < minBytesRemaining) {
    throw new IndexOutOfBoundsException("Required " + minBytesRemaining + " remaining bytes in buffer, only had " + bytesRemaining);
  }
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * @param pixelAttributes the desired {@link GLPixelAttributes}
 * @param width in pixels
 * @param height in pixels
 * @param depth in pixels
 * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
 * @param buffer the backing array
 * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
 */
public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final Buffer buffer, final boolean allowRowStride) {
  this.pixelAttributes = pixelAttributes;
  this.width = width;
  this.height = height;
  this.depth = depth;
  this.pack = pack;
  this.buffer = buffer;
  this.byteSize = Buffers.remainingBytes(buffer);
  this.bufferElemSize = Buffers.sizeOfBufferElem(buffer);
  this.allowRowStride = allowRowStride;
}

代码示例来源:origin: org.jogamp.jogl/jogl

/**
 * @param pixelAttributes the desired {@link GLPixelAttributes}
 * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
 *             {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
 * @param width in pixels
 * @param height in pixels
 * @param depth in pixels
 * @param buffer the backing array
 * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
 * @param hostPixelComp the host {@link PixelFormat.Composition}
 */
public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final boolean pack, final int width, final int height, final int depth, final Buffer buffer, final boolean allowRowStride) {
  this.pixelAttributes = pixelAttributes;
  this.width = width;
  this.height = height;
  this.depth = depth;
  this.pack = pack;
  this.buffer = buffer;
  this.byteSize = Buffers.remainingBytes(buffer);
  this.bufferElemSize = Buffers.sizeOfBufferElem(buffer);
  this.allowRowStride = allowRowStride;
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

/**
 * @param pixelAttributes the desired {@link GLPixelAttributes}
 * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
 *             {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
 * @param width in pixels
 * @param height in pixels
 * @param depth in pixels
 * @param buffer the backing array
 * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
 * @param hostPixelComp the host {@link PixelFormat.Composition}
 */
public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final boolean pack, final int width, final int height, final int depth, final Buffer buffer, final boolean allowRowStride) {
  this.pixelAttributes = pixelAttributes;
  this.width = width;
  this.height = height;
  this.depth = depth;
  this.pack = pack;
  this.buffer = buffer;
  this.byteSize = Buffers.remainingBytes(buffer);
  this.bufferElemSize = Buffers.sizeOfBufferElem(buffer);
  this.allowRowStride = allowRowStride;
}

相关文章