// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java
// public static final int PIXMAN_OP_OVER = 0x03;
// 
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java
// public static final int PIXMAN_OP_SRC  = 0x01;
// 
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java
// public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,
//                                                         PIXMAN_TYPE_ARGB,
//                                                         8,
//                                                         8,
//                                                         8,
//                                                         8);


import com.sun.glass.ui.Pixels;
import org.freedesktop.jaccall.JNI;
import org.freedesktop.jaccall.Pointer;
import org.freedesktop.wayland.client.WlBufferProxy;
import org.freedesktop.wayland.client.WlCallbackProxy;
import org.freedesktop.wayland.client.WlCompositorProxy;
import org.freedesktop.wayland.client.WlDisplayProxy;
import org.freedesktop.wayland.client.WlOutputProxy;
import org.freedesktop.wayland.client.WlShellProxy;
import org.freedesktop.wayland.client.WlShellSurfaceEvents;
import org.freedesktop.wayland.client.WlShellSurfaceProxy;
import org.freedesktop.wayland.client.WlSurfaceEventsV4;
import org.freedesktop.wayland.client.WlSurfaceProxy;
import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod;
import org.freedesktop.wayland.shared.WlShmFormat;
import javax.annotation.Nonnull;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.concurrent.CountDownLatch;
import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER;
import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC;
import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8;
            }
            else {
                if (b instanceof ByteBuffer) {
                    final ByteBuffer bb = (ByteBuffer) b;
                    final byte[]     array;
                    if (bb.hasArray()) {
                        array = bb.array();
                    }
                    else {
                        array = new byte[bb.capacity()];
                        bb.rewind();
                        bb.get(array);
                    }
                    pixels = Pointer.nref(array).address;
                }
                else {
                    final IntBuffer ib = ((IntBuffer) b);
                    final int[]     array;
                    if (ib.hasArray()) {
                        array = ib.array();
                    }
                    else {
                        array = new int[ib.capacity()];
                        ib.rewind();
                        ib.get(array);
                    }
                    pixels = Pointer.nref(array).address;
                }
            }

// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java
// public static final int PIXMAN_OP_OVER = 0x03;
// 
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java
// public static final int PIXMAN_OP_SRC  = 0x01;
// 
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java
// public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,
//                                                         PIXMAN_TYPE_ARGB,
//                                                         8,
//                                                         8,
//                                                         8,
//                                                         8);


// Path: src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java
import com.sun.glass.ui.Pixels;
import org.freedesktop.jaccall.JNI;
import org.freedesktop.jaccall.Pointer;
import org.freedesktop.wayland.client.WlBufferProxy;
import org.freedesktop.wayland.client.WlCallbackProxy;
import org.freedesktop.wayland.client.WlCompositorProxy;
import org.freedesktop.wayland.client.WlDisplayProxy;
import org.freedesktop.wayland.client.WlOutputProxy;
import org.freedesktop.wayland.client.WlShellProxy;
import org.freedesktop.wayland.client.WlShellSurfaceEvents;
import org.freedesktop.wayland.client.WlShellSurfaceProxy;
import org.freedesktop.wayland.client.WlSurfaceEventsV4;
import org.freedesktop.wayland.client.WlSurfaceProxy;
import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod;
import org.freedesktop.wayland.shared.WlShmFormat;
import javax.annotation.Nonnull;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.concurrent.CountDownLatch;
import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER;
import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC;
import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8;

            }
            else {
                if (b instanceof ByteBuffer) {
                    final ByteBuffer bb = (ByteBuffer) b;
                    final byte[]     array;
                    if (bb.hasArray()) {
                        array = bb.array();
                    }
                    else {
                        array = new byte[bb.capacity()];
                        bb.rewind();
                        bb.get(array);
                    }
                    pixels = Pointer.nref(array).address;
                }
                else {
                    final IntBuffer ib = ((IntBuffer) b);
                    final int[]     array;
                    if (ib.hasArray()) {
                        array = ib.array();
                    }
                    else {
                        array = new int[ib.capacity()];
                        ib.rewind();
                        ib.get(array);
                    }
                    pixels = Pointer.nref(array).address;
                }
            }

            final long src = Libpixman1.pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8,