Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.ByteByReference


                    winLoc.y = win.getY();
                    POINT srcLoc = new POINT();
                    BLENDFUNCTION blend = new BLENDFUNCTION();
                    HWND hWnd = getHWnd(win);
                    // extract current constant alpha setting, if possible
                    ByteByReference bref = new ByteByReference();
                    IntByReference iref = new IntByReference();
                    byte level = getAlpha(win);
                    try {
                        // GetLayeredwindowAttributes supported WinXP and later
                        if (user.GetLayeredWindowAttributes(hWnd, null, bref, iref)
                            && (iref.getValue() & WinUser.LWA_ALPHA) != 0) {
                            level = bref.getValue();
                        }
                    }
                    catch(UnsatisfiedLinkError e) {
                    }
                    blend.SourceConstantAlpha = level;
View Full Code Here


            protected List getFieldOrder() {
                return Arrays.asList(new String[] { "ref" });
            }
      }
      TestStructure s = new TestStructure();
        ByteByReference ref = s.ref = new ByteByReference();
        s.write();
        assertEquals("Value not properly written", ref.getPointer(), s.getPointer().getPointer(0));

      s.ref = null;
      s.write();
        assertNull("Non-null value was written: " + s.getPointer().getPointer(0), s.getPointer().getPointer(0));
    }
View Full Code Here

      }
      TestStructure s = new TestStructure();
        s.read();
        assertNull("Should read null for initial field value", s.ref);

        ByteByReference ref = new ByteByReference();
        s.getPointer().setPointer(0, ref.getPointer());
        s.read();
        assertEquals("Field incorrectly read", ref, s.ref);

        s.getPointer().setPointer(0, null);
        s.read();
View Full Code Here

    public void testNativeMappedWrite() {
      class TestStructure extends Structure {
            public ByteByReference ref;
      }
      TestStructure s = new TestStructure();
        ByteByReference ref = s.ref = new ByteByReference();
        s.write();
        assertEquals("Value not properly written", ref.getPointer(), s.getPointer().getPointer(0));

      s.ref = null;
      s.write();
        assertNull("Non-null value was written: " + s.getPointer().getPointer(0), s.getPointer().getPointer(0));
    }
View Full Code Here

      }
      TestStructure s = new TestStructure();
        s.read();
        assertNull("Should read null for initial field value", s.ref);

        ByteByReference ref = new ByteByReference();
        s.getPointer().setPointer(0, ref.getPointer());
        s.read();
        assertEquals("Field incorrectly read", ref, s.ref);

        s.getPointer().setPointer(0, null);
        s.read();
View Full Code Here

    protected void tearDown() {
        lib = null;
    }

    public void testByteByReference() {
        ByteByReference bref = new ByteByReference();
        lib.incrementInt8ByReference(bref);
        assertEquals("Byte argument not modified", 1, bref.getValue());
    }
View Full Code Here

                    winLoc.y = win.getY();
                    POINT srcLoc = new POINT();
                    BLENDFUNCTION blend = new BLENDFUNCTION();
                    HWND hWnd = getHWnd(win);
                    // extract current constant alpha setting, if possible
                    ByteByReference bref = new ByteByReference();
                    IntByReference iref = new IntByReference();
                    byte level = getAlpha(win);
                    try {
                        // GetLayeredwindowAttributes supported WinXP and later
                        if (user.GetLayeredWindowAttributes(hWnd, null, bref, iref)
                            && (iref.getValue() & WinUser.LWA_ALPHA) != 0) {
                            level = bref.getValue();
                        }
                    }
                    catch(UnsatisfiedLinkError e) {
                    }
                    blend.SourceConstantAlpha = level;
View Full Code Here

       
        if ( coerceArgs && args.length > 0 ){
            originalArgs = Arrays.copyOf(args, args.length);
           
            for ( int i=0; i<args.length; i++ ){
                ByteByReference out = new ByteByReference();
               
                long out2 = (long)msg(methodSignature, "getArgumentTypeAtIndex:", i+2);
                String argumentTypeSignature = new Pointer(out2).getString(0);
                args[i] = TypeMapper.getInstance().jToC(args[i], argumentTypeSignature, TypeMapper.getInstance());
               
View Full Code Here

                } else if ( String.class.isInstance(val)){
                    val = new Byte(Byte.parseByte((String)val)).byteValue();
                } else {
                    throw new RuntimeException("Attempt to pass ineligible value to byte: "+val);
                }
                return new ByteByReference((Byte)val);
            case 'v':
                return null;
            case '^':
            default:
                ////System.out.println("Outputting pointer by reference for value "+val+" and signature "+signature);
View Full Code Here

                    POINT loc = new POINT();
                    loc.x = win.getX();
                    loc.y = win.getY();
                    HWND hWnd = getHWnd(win);
                    // extract current constant alpha setting, if possible
                    ByteByReference bref = new ByteByReference();
                    IntByReference iref = new IntByReference();
                    byte level = getAlpha(win);
                    if (user.GetLayeredWindowAttributes(hWnd, null, bref, iref)
                        && (iref.getValue() & User32.LWA_ALPHA) != 0) {
                        level = bref.getValue();
                    }
                    blend.SourceConstantAlpha = level;
                    blend.AlphaFormat = User32.AC_SRC_ALPHA;
                    user.UpdateLayeredWindow(hWnd, screenDC, loc, size, memDC,
                                             srcLoc, 0, blend, User32.ULW_ALPHA);
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.ByteByReference

Copyright © 2018 www.massapicom. 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.