当前位置: 首页>>代码示例>>Java>>正文


Java IntBuffer.wrap方法代码示例

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


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

示例1: majorVersionBuffer

import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
 * Return an IntBuffer that accesses the major version number.
 * This is used to create a Monitor object for this value.
 *
 * @return IntBuffer - a ByteBuffer that accesses the major version number
 *                     in the instrumentation buffer header.
 */
public IntBuffer majorVersionBuffer() {
    int[] holder = new int[1];
    holder[0] = getMajorVersion();
    IntBuffer ib = IntBuffer.wrap(holder);
    ib.limit(1);
    return ib;
  }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AbstractPerfDataBufferPrologue.java

示例2: minorVersionBuffer

import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
 * Return an IntBuffer that accesses the minor version number.
 * This is used to create a Monitor object for this value.
 *
 * @return IntBuffer - a ByteBuffer that accesses the minor version number
 *                     in the instrumentation buffer header.
 */
public IntBuffer minorVersionBuffer() {
    int[] holder = new int[1];
    holder[0] = getMinorVersion();
    IntBuffer ib = IntBuffer.wrap(holder);
    ib.limit(1);
    return ib;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AbstractPerfDataBufferPrologue.java

示例3: initBuffer

import java.nio.IntBuffer; //导入方法依赖的package包/类
@Override
public IntBuffer initBuffer(int width, int height) {
    int[] pixels = new int[width * height];
    IntBuffer intBuffer = IntBuffer.wrap(pixels);
    intBuffer.position(0);
    return intBuffer;
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:8,代码来源:BitmapOutput.java

示例4: Texture

import java.nio.IntBuffer; //导入方法依赖的package包/类
public Texture(/*final String aName,*/ final Image aImage/*, final int aRepeatMode, final int aMagfilter*/)
{
    m_Name = aImage.getName();

    Debug.log("Texture::Texture(const std::string &aTextureFileName, GFXuint repeatmode, GFXuint magfilter)\n");
    Debug.log("Loading texture: "+m_Name);
    
    //load texture      
    int width = aImage.getData().getWidth(),height = aImage.getData().getHeight();
        
    Debug.log("Dimensons: {"+width+", "+width+"}");

    //.if DESKTOP
    //|int[] data;
    //|data = aImage.getData().getRGB(0, 0, width, height, (int[])null, 0, width);
    //|
    //|//Change from BGRA to RGBA
    //|for(int i = 0, pixel,r,g,b,a; i < data.length; i++)
    //|{
    //|    pixel = data[i];
    //|    a = (pixel >> 24) & 0xff;
    //|    r = (pixel >> 16) & 0xff;
    //|    g = (pixel >> 8) & 0xff;
    //|       b = (pixel >> 0) & 0xff;
    //|    pixel = (b<<16) | (g<<8) | (r<<0) | (a<<24);
    //|    data[i] = pixel;
    //|
    //|}
    //|IntBuffer pngbuffer = IntBuffer.wrap(data);
    //.elseif ANDROID
    //IntBuffer pngbuffer = IntBuffer.allocate(aImage.getData().getHeight()*aImage.getData().getRowBytes());
    //aImage.getData().copyPixelsToBuffer(pngbuffer);

    int x = aImage.getData().getWidth();
    int y = aImage.getData().getHeight();
    int[] data = new int[x * y];
    aImage.getData().getPixels(data, 0, x, 0, 0, x, y);

    for(int i = 0, pixel,r,g,b,a; i < data.length; i++)
    {
        pixel = data[i];
        a = (pixel >> 24) & 0xff;
        r = (pixel >> 16) & 0xff;
        g = (pixel >> 8) & 0xff;
        b = (pixel >> 0) & 0xff;

        pixel = (b<<16) | (g<<8) | (r<<0) | (a<<24);
        data[i] = pixel;

    }

    IntBuffer pngbuffer = IntBuffer.wrap(data);

    //.endif

    Debug.log("This is how long the intbuffer is: "    + pngbuffer.array().length );
    Debug.log("This is the size of a {RGBA} in bits: " + Integer.SIZE             );
        
    //push texture data to video memory
    IntBuffer texturehandle = IntBuffer.allocate(1);
            
    int textureFormat = GL.GL_RGBA;
        
    //Put the texture data in video memory
    GL.glGenTextures( 1, texturehandle );
    GL.glActiveTexture( GL.GL_TEXTURE0 );
    GL.glBindTexture( GL.GL_TEXTURE_2D, texturehandle.get(0) );
    GL.glTexImage2D( GL.GL_TEXTURE_2D, 0, textureFormat, width, height, 0, textureFormat, GL.GL_UNSIGNED_BYTE, pngbuffer );
        
    //Apply parameters
    GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST );
    GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST );
        
    m_TextureHandle = texturehandle.get(0);
    
    Debug.log("Handle is: "+m_TextureHandle);
    
    GL.glBindTexture( GL.GL_TEXTURE_2D,0);//clear the binding

}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:81,代码来源:Texture.java

示例5: tensorInt

import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
 * Creates a TensorFlow Tensor containing data from the given int image.
 * <p>
 * Note that this does _not_ adjust any dimensions. This means that
 * the resulting Tensor will have a shape corresponding to the reversed
 * dimensions of the image.
 * </p><p>
 * Also note that this will use the backing RAI's primitive array when one is
 * available. Otherwise a copy will be made.
 * </p>
 * @param image The image which should be put into the Tensor.
 * @return A Tensor containing the data of the image.
 */
public static Tensor tensorInt(
	final RandomAccessibleInterval<IntType> image)
{
	final int[] value = intArray(image);
	IntBuffer buffer = IntBuffer.wrap(value);
	return Tensor.create(shape(image), buffer);
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:21,代码来源:Tensors.java


注:本文中的java.nio.IntBuffer.wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。