Examples of LockedArray


Examples of org.apache.harmony.misc.accessors.LockedArray

        byte[] bmpSrcData = ((DataBufferByte) bmpSrc.getData().getDataBuffer()).getData();
        byte[] bmpMaskData = ((DataBufferByte) bmpMask.getData().getDataBuffer()).getData();

        ArrayAccessor arrayAccess = AccessorFactory.getArrayAccessor();
        long wnd = factory.getRootWindow();
        LockedArray larr = arrayAccess.lockArrayShort(bmpSrcData);
        long dataPtr = larr.getAddress();
        long pixmap = x11.XCreateBitmapFromData(display, wnd,
                dataPtr, width, height);
        //System.out.println("source pixmap=" + pixmap);
        larr.release();

        larr = arrayAccess.lockArrayShort(bmpMaskData);
        dataPtr = larr.getAddress();
        long pixmapMask = x11.XCreateBitmapFromData(display, wnd, dataPtr,
                width, height);
        //System.out.println("mask pixmap=" + pixmap);
        larr.release();
        int fgRGB = bufImg.getRGB(0, 0);
        Color fgColor = new Color(fgRGB);
        Color bkColor = getBkColor(bufImg, fgColor);
        X11.XColor bkColorPtr = getXColor(bkColor);
        X11.XColor fgColorPtr = getXColor(fgColor);
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

            r = lastSnapshot.getRaster();

        Object data;
        AwtImageBackdoorAccessor dbAccess = AwtImageBackdoorAccessor.getInstance();
        data = dbAccess.getData(r.getDataBuffer());
        LockedArray lockedData = Utils.arraccess.lockArrayShort(data);

        SampleModel sm = r.getSampleModel();
        int scanlineStride;
        if (sm instanceof ComponentSampleModel) {
            scanlineStride = ((ComponentSampleModel) sm).getScanlineStride();
        } else if (sm instanceof SinglePixelPackedSampleModel) {
            scanlineStride = ((SinglePixelPackedSampleModel) sm).getScanlineStride();
        } else if (sm instanceof MultiPixelPackedSampleModel) {
            scanlineStride = ((MultiPixelPackedSampleModel) sm).getScanlineStride();
        } else {
            return;
        }

        int pad;
        if (data instanceof byte[]) {
            pad = 8;
        } else if (data instanceof short[]) {
            pad = 16;
            scanlineStride *= 2;
        } else if (data instanceof int[]) {
            pad = 32;
            scanlineStride *= 4;
        } else {
            return;
        }

        X11.Visual visual = g2d.xConfig.info.get_visual();

        long xImagePtr = x11.XCreateImage(
                g2d.display,
                visual.lock(),
                g2d.xConfig.info.get_depth(),
                X11Defs.ZPixmap,
                0,
                lockedData.getAddress(),
                r.getWidth(),
                r.getHeight(),
                pad,
                scanlineStride
        );
        visual.unlock();

        g2d.setXClip(clip, g2d.imageGC);

        X11.XImage xImage = x11.createXImage(xImagePtr);
        xImage.set_byte_order(X11Defs.LSBFirst); // Set byte order explicitly

        x11.XPutImage(
                g2d.display,
                g2d.drawable,
                g2d.imageGC,
                xImagePtr,
                0, 0,
                dstX, dstY,
                dstWidth, dstHeight
        );

        g2d.resetXClip(g2d.imageGC);

        lockedData.release();

        xImage.set_data(NativeBridge.getInstance().createInt8Pointer(0, true));
        xImage.get_f().destroy_image(xImage);
    }
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

            fgRgba[2] = (byte) ((fgRgba[2] & 0xFF) * acAlpha * alpha + 0.5);
            // Also use acAlpha
            fgRgba[3] = (byte) ((fgRgba[3] & 0xFF) * acAlpha + 0.5);
        }

        LockedArray lColor = Utils.arraccess.lockArrayShort(fgRgba);
        gl.glColor4ubv(lColor.getAddress());
        lColor.release();

        // If color becomes translucent, probably need to enable blending
        if (opaqueColor != ((fgRgba[3] & 0xFF) == 0xFF)) {
            opaqueColor = (fgRgba[3] & 0xFF) == 0xFF;
            checkComposite();
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

    protected void fillMultiRectAreaColor(MultiRectArea mra) {
        makeCurrent();

        if (((mra.rect[0]-1)) > 0) { // Have something to draw
            int vertices[] = createVertexArray(mra);
            LockedArray lVertices = Utils.arraccess.lockArrayShort(vertices);

            gl.glVertexPointer(2, GLDefs.GL_INT, 0, lVertices.getAddress());

            // At least one configuration (ATI MOBILITY FIRE GL T2 card on win32) has
            // problems with the large arrays, so workaround is used when
            // the number of vertices exceeds 1024
            if (vertices.length < 2048) {
                gl.glDrawArrays(GLDefs.GL_QUADS, 0, vertices.length/2);
            } else {
                int iters = vertices.length / 2048;
                for (int i = 0; i < iters; i++) {
                    gl.glDrawArrays(GLDefs.GL_QUADS, i*1024, 1024);
                }
                gl.glDrawArrays(GLDefs.GL_QUADS, iters*1024, (vertices.length % 2048)/2);
            }

            lVertices.release();
        }

        gl.glFlush();
        getSurface().updateScene();
    }
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

                    glTransformMx[12] = javaTransformMx[4];
                    glTransformMx[13] = javaTransformMx[5];
                    glTransformMx[10] = 1;
                    glTransformMx[15] = 1;

                    LockedArray lMx = Utils.arraccess.lockArrayShort(glTransformMx);
                    gl.glLoadMatrixd(lMx.getAddress());
                    lMx.release();
                }
            }

            // Fix line rasterization
            gl.glTranslated(0.375, 0.375, 0);
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

            vertices[0] = x1;
            vertices[1] = y1;
            vertices[2] = x2;
            vertices[3] = y2;

            LockedArray lVertices = Utils.arraccess.lockArrayShort(vertices);
            gl.glVertexPointer(2, GLDefs.GL_INT, 0, lVertices.getAddress());
            gl.glDrawArrays(GLDefs.GL_LINES, 0, vertices.length/2);
            lVertices.release();

            gl.glFlush();
        } else {
            super.drawLine(x1, y1, x2, y2);
        }
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

        makeCurrent();
/*
        x += glTransform.getTranslateX() + 0.5;
        y += glTransform.getTranslateY() + 0.5;
*/
        LockedArray lBuffer = Utils.arraccess.lockArrayShort(buffer);

        if (topToBottom) {
            // Need to read scanlines one-by-one to make them go from top to bottom.
            // OpenGL allows to read from bottom to top only.
            int sourceRow = winBounds.height-y-1;
            for (int i=0; i<h; i++, sourceRow--) {
                gl.glPixelStorei(GLDefs.GL_PACK_SKIP_ROWS, i);
                gl.glReadPixels(
                        x, sourceRow,
                        w, 1,
                        GLDefs.GL_BGRA, GLDefs.GL_UNSIGNED_INT_8_8_8_8_REV,
                        lBuffer.getAddress()
                );
            }
        } else {
            gl.glReadPixels(
                    x, winBounds.height-y-h,
                    w, h,
                    GLDefs.GL_BGRA, GLDefs.GL_UNSIGNED_INT_8_8_8_8_REV,
                    lBuffer.getAddress()
            );
        }

        lBuffer.release();

        gl.glPixelStorei(GLDefs.GL_PACK_SKIP_ROWS, 0);

        if (currGraphics != null && currGraphics!= this) {
            currGraphics.makeCurrent();
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

            for (int i = 0; i < npoints; i++) {
                vertices[i<<1] = xpoints[i];
                vertices[(i<<1) + 1] = ypoints[i];
            }

            LockedArray lVertices = Utils.arraccess.lockArrayShort(vertices);
            gl.glVertexPointer(2, GLDefs.GL_INT, 0, lVertices.getAddress());
            gl.glDrawArrays(
                    closed ? GLDefs.GL_LINE_LOOP : GLDefs.GL_LINE_STRIP,
                    0,
                    vertices.length / 2
            );
            lVertices.release();

            gl.glFlush();
        } else {
            if (closed) {
                super.drawPolygon(xpoints, ypoints, npoints);
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

        tObjPlane[0] = 0;
        tObjPlane[1] = 1. / heightFactor;
        tObjPlane[2] = 0;
        tObjPlane[3] = -r.getY() / heightFactor;

        LockedArray la = Utils.arraccess.lockArrayShort(sObjPlane);
        gl.glTexGendv(GLDefs.GL_S, GLDefs.GL_OBJECT_PLANE, la.getAddress());
        la.release();
        la = Utils.arraccess.lockArrayShort(tObjPlane);
        gl.glTexGendv(GLDefs.GL_T, GLDefs.GL_OBJECT_PLANE, la.getAddress());
        la.release();

        gl.glEnable(GLDefs.GL_TEXTURE_GEN_S);
        gl.glEnable(GLDefs.GL_TEXTURE_GEN_T);

        gl.glEnable(GLDefs.GL_TEXTURE_2D);
View Full Code Here

Examples of org.apache.harmony.misc.accessors.LockedArray

                GLDefs.GL_TEXTURE_1D,
                GLDefs.GL_TEXTURE_WRAP_S,
                isGPCyclic ? GLDefs.GL_REPEAT : GLDefs.GL_CLAMP_TO_EDGE
        );
        gl.glTexGeni(GLDefs.GL_S, GLDefs.GL_TEXTURE_GEN_MODE, GLDefs.GL_OBJECT_LINEAR);
        LockedArray la = Utils.arraccess.lockArrayShort(gradObjectPlane);
        gl.glTexGendv(GLDefs.GL_S, GLDefs.GL_OBJECT_PLANE, la.getAddress());
        la.release();
        gl.glEnable(GLDefs.GL_TEXTURE_GEN_S);

        // Load data into texture
        la = Utils.arraccess.lockArrayShort(twoPixels);
        gl.glTexImage1D(
                GLDefs.GL_TEXTURE_1D,
                0,
                GLDefs.GL_RGBA,
                2,
                0,
                GLDefs.GL_RGBA,
                GLDefs.GL_UNSIGNED_BYTE,
                la.getAddress()
        );
        la.release();

        // Enable 1D texture
        gl.glEnable(GLDefs.GL_TEXTURE_1D);
    }
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.