Package java.nio

Examples of java.nio.IntBuffer.capacity()


    private List<CLTestTask> createTasks(String source, IntBuffer data, int taskCount, int slice) {
        List<CLTestTask> tasks = new ArrayList<CLTestTask>(taskCount);
        for (int i = 0; i < taskCount; i++) {
            IntBuffer subBuffer = Buffers.slice(data, i*slice, slice);
            assertEquals(slice, subBuffer.capacity());
            tasks.add(new CLTestTask(source, subBuffer));
        }
        return tasks;
    }

View Full Code Here


        buf.limit(buf.capacity()).position(0);
        readonly.limit(readonly.capacity()).position(1);
        assertFalse(buf.equals(readonly));

        buf.limit(buf.capacity() - 1).position(0);
        duplicate.limit(duplicate.capacity()).position(0);
        assertFalse(buf.equals(duplicate));
    }

    /*
     * Class under test for int get()
View Full Code Here

        assertEquals(buf.isReadOnly(), slice.isReadOnly());
        assertEquals(buf.isDirect(), slice.isDirect());
        assertEquals(buf.order(), slice.order());
        assertEquals(slice.position(), 0);
        assertEquals(slice.limit(), buf.remaining());
        assertEquals(slice.capacity(), buf.remaining());
        try {
            slice.reset();
            fail("Should throw Exception"); //$NON-NLS-1$
        } catch (InvalidMarkException e) {
            // expected
View Full Code Here

        }

        // slice share the same content with buf
        if (!slice.isReadOnly()) {
            loadTestData1(slice);
            assertContentLikeTestData1(buf, 1, 0, slice.capacity());
            buf.put(2, 500);
            assertEquals(slice.get(1), 500);
        }
    }
View Full Code Here

        }

        IntBuffer buf = IntBuffer.wrap(array, 2, 16);
        assertEquals(buf.position(), 2);
        assertEquals(buf.limit(), 18);
        assertEquals(buf.capacity(), 20);
    }
}
View Full Code Here

    }
    public void testIntBufferArgument() {
        IntBuffer buf  = IntBuffer.allocate(1024);
        final int MAGIC = 0xABEDCF23;
        lib.fillInt32Buffer(buf, 1024, MAGIC);
        for (int i=0;i < buf.capacity();i++) {
            assertEquals("Bad value at index " + i, MAGIC, buf.get(i));
        }
    }
    public void testLongBufferArgument() {
        LongBuffer buf  = LongBuffer.allocate(1024);
View Full Code Here

    public void testDirectIntBufferArgument() {
        ByteBuffer buf  = ByteBuffer.allocateDirect(1024*4).order(ByteOrder.nativeOrder());
        IntBuffer intBuf = buf.asIntBuffer();
        final int MAGIC = 0xABEDCF23;
        lib.fillInt32Buffer(intBuf, 1024, MAGIC);
        for (int i=0;i < intBuf.capacity();i++) {
            assertEquals("Bad value at index " + i, MAGIC, intBuf.get(i));
        }
    }
   
    public void testDirectLongBufferArgument() {
View Full Code Here

            refreshLimits();

            //Switch to OpenGL2 select mode
            int capacity = 1 * 4 * leavesCount;      //Each object take in maximium : 4 * name stack depth
            IntBuffer hitsBuffer = Buffers.newDirectIntBuffer(capacity);
            gl.glSelectBuffer(hitsBuffer.capacity(), hitsBuffer);
            gl.glRenderMode(GL2.GL_SELECT);
            gl.glInitNames();
            gl.glPushName(0);
            gl.glDisable(GL2.GL_CULL_FACE);      //Disable flags
            //Draw the nodes cube in the select buffer
View Full Code Here

        if (visibleLeaves > 0) {
            //Start Picking mode
            int capacity = 1 * 4 * visibleLeaves;      //Each object take in maximium : 4 * name stack depth
            IntBuffer hitsBuffer = Buffers.newDirectIntBuffer(capacity);

            gl.glSelectBuffer(hitsBuffer.capacity(), hitsBuffer);
            gl.glRenderMode(GL2.GL_SELECT);
            gl.glDisable(GL2.GL_CULL_FACE);      //Disable flags

            gl.glInitNames();
            gl.glPushName(0);
View Full Code Here

        throw new GdxRuntimeException ("yHotspot coordinate of " + yHotspot  + " is not within image height bounds: [0, " + pixmap.getHeight() + ").");
      }

      // Convert from RGBA8888 to ARGB8888 and flip vertically
      IntBuffer pixelBuffer = pixmap.getPixels().asIntBuffer();
      int[] pixelsRGBA = new int[pixelBuffer.capacity()];
      pixelBuffer.get(pixelsRGBA);
      int[] pixelsARGBflipped = new int[pixelBuffer.capacity()];
      int pixel;
      if (pixelBuffer.order() == ByteOrder.BIG_ENDIAN) {
        for (int y = 0; y < pixmap.getHeight(); ++y) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.