Java HasArrayBufferView类的典型用法和代码示例

2019年1月12日 38点热度 0条评论

本文整理汇总了Java中java.nio.HasArrayBufferView的典型用法代码示例。如果您正苦于以下问题:Java HasArrayBufferView类的具体用法?Java HasArrayBufferView怎么用?Java HasArrayBufferView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

HasArrayBufferView类属于java.nio包,在下文中一共展示了HasArrayBufferView类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: glTexImage2D

点赞 3

import java.nio.HasArrayBufferView; //导入依赖的package包/类
@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
	Buffer pixels) {
       if (pixels.limit() > 1) {
           HasArrayBufferView arrayHolder = (HasArrayBufferView) pixels;

           ArrayBufferView webGLArray = arrayHolder.getTypedArray();
           int remainingBytes = pixels.remaining() * 4;

           int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;

           Uint8Array buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);

           gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
       } else {
           Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer)pixels).get(0));
           gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
       }
}
 

开发者ID:basherone,
项目名称:libgdxcn,
代码行数:20,
代码来源:GwtGL20.java

示例2: glTexSubImage2D

点赞 3

import java.nio.HasArrayBufferView; //导入依赖的package包/类
@Override
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
	Buffer pixels) {
       if (pixels.limit() > 1) {
           HasArrayBufferView arrayHolder = (HasArrayBufferView) pixels;

           ArrayBufferView webGLArray = arrayHolder.getTypedArray();
           int remainingBytes = pixels.remaining() * 4;

           int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;

           Uint8Array buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);

           gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, buffer);
       } else {
           Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer) pixels).get(0));
           gl.texSubImage2D(target, level, xoffset, yoffset, width, height, pixmap.getCanvasElement());
       }
}
 

开发者ID:basherone,
项目名称:libgdxcn,
代码行数:20,
代码来源:GwtGL20.java

示例3: glTexImage2D

点赞 3

import java.nio.HasArrayBufferView; //导入依赖的package包/类
@Override
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
                          Buffer pixels) {
    if (pixels.limit() > 1) {
        HasArrayBufferView arrayHolder = (HasArrayBufferView) pixels;

        ArrayBufferView webGLArray = arrayHolder.getTypedArray();
        int remainingBytes = pixels.remaining() * 4;

        int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;

        Uint8Array buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);

        gl.texImage2D(target, level, internalformat, width, height, border, format, type, buffer);
    } else {
        // Put this back later
        Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer)pixels).get(0));
        gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
    }
}
 

开发者ID:neuroradiology,
项目名称:TinyVoxel,
代码行数:21,
代码来源:GwtGL20.java

示例4: glTexSubImage2D

点赞 3

import java.nio.HasArrayBufferView; //导入依赖的package包/类
@Override
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
                             Buffer pixels) {
    if (pixels.limit() > 1) {
        HasArrayBufferView arrayHolder = (HasArrayBufferView) pixels;

        ArrayBufferView webGLArray = arrayHolder.getTypedArray();
        int remainingBytes = pixels.remaining() * 4;

        int byteOffset = webGLArray.byteOffset() + pixels.position() * 4;

        Uint8Array buffer = Uint8ArrayNative.create(webGLArray.buffer(), byteOffset, remainingBytes);

        gl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, buffer);
    } else {
        // Put this back later
        Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer) pixels).get(0));
        gl.texSubImage2D(target, level, xoffset, yoffset, width, height, pixmap.getCanvasElement());
    }
}
 

开发者ID:neuroradiology,
项目名称:TinyVoxel,
代码行数:21,
代码来源:GwtGL20.java

示例5: newMemoryFace

点赞 2

import java.nio.HasArrayBufferView; //导入依赖的package包/类
public Face newMemoryFace (ByteBuffer buffer, int faceIndex) {
	ArrayBufferView buf = ((HasArrayBufferView)buffer).getTypedArray();
	int[] addressToFree = new int[] {0}; // Hacky way to get two return values
	int face = newMemoryFace(address, buf, buffer.remaining(), faceIndex, addressToFree);
	if (face == 0) {
		if (addressToFree[0] != 0) { // 'Zero' would mean allocating the buffer failed
			nativeFree(addressToFree[0]);
		}
		throw new GdxRuntimeException("Couldn't load font");
	} else {
		fontData.put(face, addressToFree[0]);
		return new Face(face, this);
	}
}
 

开发者ID:intrigus,
项目名称:gdx-freetype-gwt,
代码行数:15,
代码来源:FreeType.java

示例6: copy

点赞 2

import java.nio.HasArrayBufferView; //导入依赖的package包/类
public Float32Array copy (FloatBuffer buffer) {
	if (GWT.isProdMode()) {
		return ((Float32Array)((HasArrayBufferView)buffer).getTypedArray()).subarray(buffer.position(), buffer.remaining());
	} else {
		ensureCapacity(buffer);
		for (int i = buffer.position(), j = 0; i < buffer.limit(); i++, j++) {
			floatBuffer.set(j, buffer.get(i));
		}
		return floatBuffer.subarray(0, buffer.remaining());
	}
}
 

开发者ID:basherone,
项目名称:libgdxcn,
代码行数:12,
代码来源:GwtGL20.java

示例7: copy

点赞 2

import java.nio.HasArrayBufferView; //导入依赖的package包/类
public Float32Array copy (FloatBuffer buffer) {
    if (GWT.isProdMode()) {
        return ((Float32Array)((HasArrayBufferView)buffer).getTypedArray()).subarray(buffer.position(), buffer.remaining());
    } else {
        ensureCapacity(buffer);
        for (int i = buffer.position(), j = 0; i < buffer.limit(); i++, j++) {
            floatBuffer.set(j, buffer.get(i));
        }
        return floatBuffer.subarray(0, buffer.remaining());
    }
}
 

开发者ID:neuroradiology,
项目名称:TinyVoxel,
代码行数:12,
代码来源:GwtGL20.java

示例8: putPixelsBack

点赞 2

import java.nio.HasArrayBufferView; //导入依赖的package包/类
public void putPixelsBack (ByteBuffer pixels) {
	if (getWidth() == 0 || getHeight() == 0) return;
	putPixelsBack(((HasArrayBufferView)pixels).getTypedArray(), getWidth(), getHeight(), getContext());

}
 

开发者ID:intrigus,
项目名称:gdx-freetype-gwt,
代码行数:6,
代码来源:FreeTypePixmap.java