changeset 1285:00a63ce77e97 2.2-b13

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.2/MASTER/jfx//rt
author Yao Wang <yao.w.wang@oracle.com>
date Tue, 12 Jun 2012 10:07:03 -0700
parents a636b9ba88ac 9def6759a1f2
children 6f2d238b4c8b adcda42efa37 0e0923db2a7c
files javafx-ui-common/test/unit/javafx/scene/input/TouchPoint_builder_Test.java
diffstat 54 files changed, 4775 insertions(+), 227 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/Utils.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/com/sun/javafx/Utils.java	Tue Jun 12 10:07:03 2012 -0700
@@ -27,7 +27,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Locale;
 
 import javafx.geometry.BoundingBox;
 import javafx.geometry.Bounds;
@@ -40,8 +39,10 @@
 import javafx.scene.paint.Color;
 import javafx.scene.paint.Stop;
 import javafx.stage.Screen;
+import javafx.stage.Stage;
 import javafx.stage.Window;
-import com.sun.javafx.PlatformUtil;
+
+import com.sun.javafx.stage.StageHelper;
 
 /**
  * Some basic utilities which need to be in java (for shifting operations or
@@ -597,7 +598,10 @@
 
         // ...and then we get the bounds of this screen
         final Screen currentScreen = getScreen(parent);
-        final Rectangle2D screenBounds = currentScreen.getVisualBounds();
+        final Rectangle2D screenBounds =
+                hasFullScreenStage(currentScreen)
+                        ? currentScreen.getBounds()
+                        : currentScreen.getVisualBounds();
 
         // test if this layout will force the node to appear outside
         // of the screens bounds. If so, we must reposition the item to a better position.
@@ -797,6 +801,18 @@
         }
     }
 
+    public static boolean hasFullScreenStage(final Screen screen) {
+        final List<Stage> allStages = StageHelper.getStages();
+
+        for (final Stage stage: allStages) {
+            if (stage.isFullScreen() && (getScreen(stage) == screen)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     /*
      * Returns true if the primary Screen has VGA dimensions, in landscape or portrait mode.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/AlphaType.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+public enum AlphaType {
+    OPAQUE,
+    PREMULTIPLIED,
+    NONPREMULTIPLIED
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/BytePixelAccessor.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+public interface BytePixelAccessor
+    extends BytePixelGetter, BytePixelSetter
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/BytePixelGetter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.ByteBuffer;
+
+public interface BytePixelGetter extends PixelGetter<ByteBuffer> {
+    public int getArgb(byte arr[], int offset);
+    public int getArgbPre(byte arr[], int offset);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/BytePixelSetter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.ByteBuffer;
+
+public interface BytePixelSetter extends PixelSetter<ByteBuffer> {
+    public void setArgb(byte arr[], int offset, int argb);
+    public void setArgbPre(byte arr[], int offset, int argbpre);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/ByteToBytePixelConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.ByteBuffer;
+
+public interface ByteToBytePixelConverter
+    extends PixelConverter<ByteBuffer, ByteBuffer>
+{
+    public void convert(byte       srcarr[], int srcoff, int srcscanbytes,
+                        byte       dstarr[], int dstoff, int dstscanbytes,
+                        int w, int h);
+
+    public void convert(ByteBuffer srcbuf,   int srcoff, int srcscanbytes,
+                        byte       dstarr[], int dstoff, int dstscanbytes,
+                        int w, int h);
+
+    public void convert(byte       srcarr[], int srcoff, int srcscanbytes,
+                        ByteBuffer dstbuf,   int dstoff, int dstscanbytes,
+                        int w, int h);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/ByteToIntPixelConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface ByteToIntPixelConverter
+    extends PixelConverter<ByteBuffer, IntBuffer>
+{
+    public void convert(byte srcarr[], int srcoff, int srcscanbytes,
+                        int  dstarr[], int dstoff, int dstscanints,
+                        int w, int h);
+
+    public void convert(ByteBuffer srcbuf,   int srcoff, int srcscanbytes,
+                        int        dstarr[], int dstoff, int dstscanints,
+                        int w, int h);
+
+    public void convert(byte      srcarr[], int srcoff, int srcscanbytes,
+                        IntBuffer dstbuf,   int dstoff, int dstscanints,
+                        int w, int h);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/IntPixelAccessor.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+public interface IntPixelAccessor
+    extends IntPixelGetter, IntPixelSetter
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/IntPixelGetter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.IntBuffer;
+
+public interface IntPixelGetter extends PixelGetter<IntBuffer> {
+    public int getArgb(int arr[], int offset);
+    public int getArgbPre(int arr[], int offset);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/IntPixelSetter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.IntBuffer;
+
+public interface IntPixelSetter extends PixelSetter<IntBuffer> {
+    public void setArgb(int arr[], int offset, int argb);
+    public void setArgbPre(int arr[], int offset, int argbpre);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/IntToBytePixelConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public interface IntToBytePixelConverter
+    extends PixelConverter<IntBuffer, ByteBuffer>
+{
+    public void convert(int  srcarr[], int srcoff, int srcscanints,
+                        byte dstarr[], int dstoff, int dstscanbytes,
+                        int w, int h);
+
+    public void convert(IntBuffer srcbuf,   int srcoff, int srcscanints,
+                        byte      dstarr[], int dstoff, int dstscanbytes,
+                        int w, int h);
+
+    public void convert(int        srcarr[], int srcoff, int srcscanints,
+                        ByteBuffer dstbuf,   int dstoff, int dstscanbytes,
+                        int w, int h);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/IntToIntPixelConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.IntBuffer;
+
+public interface IntToIntPixelConverter
+    extends PixelConverter<IntBuffer, IntBuffer>
+{
+    public void convert(int srcarr[], int srcoff, int srcscanints,
+                        int dstarr[], int dstoff, int dstscanints,
+                        int w, int h);
+
+    public void convert(IntBuffer srcbuf,   int srcoff, int srcscanints,
+                        int       dstarr[], int dstoff, int dstscanints,
+                        int w, int h);
+
+    public void convert(int       srcarr[], int srcoff, int srcscanints,
+                        IntBuffer dstbuf,   int dstoff, int dstscanints,
+                        int w, int h);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/PixelAccessor.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.Buffer;
+
+public interface PixelAccessor<T extends Buffer>
+    extends PixelGetter<T>, PixelSetter<T>
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/PixelConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.Buffer;
+
+public interface PixelConverter<T extends Buffer, U extends Buffer> {
+    public void convert(T srcbuf, int srcoff, int srcscanbytes,
+                        U dstbuf, int dstoff, int dstscanbytes,
+                        int w, int h);
+
+    public PixelGetter<T> getGetter();
+    public PixelSetter<U> getSetter();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/PixelGetter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.Buffer;
+
+public interface PixelGetter<T extends Buffer> {
+    public AlphaType getAlphaType();
+    public int getNumElements();
+
+    public int getArgb(T buf, int offset);
+    public int getArgbPre(T buf, int offset);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/PixelSetter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import java.nio.Buffer;
+
+public interface PixelSetter<T extends Buffer> {
+    public AlphaType getAlphaType();
+    public int getNumElements();
+
+    public void setArgb(T buf, int offset, int argb);
+    public void setArgbPre(T buf, int offset, int argbpre);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/PixelUtils.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image;
+
+import com.sun.javafx.image.impl.ByteBgra;
+import com.sun.javafx.image.impl.ByteBgraPre;
+import com.sun.javafx.image.impl.ByteRgb;
+import com.sun.javafx.image.impl.General;
+import com.sun.javafx.image.impl.IntArgb;
+import com.sun.javafx.image.impl.IntArgbPre;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+import javafx.scene.image.PixelFormat;
+import javafx.scene.image.WritablePixelFormat;
+
+public class PixelUtils {
+    private PixelUtils() {}
+
+    public static int RgbToGray(int r, int g, int b) {
+        return (int) (r * .3 + g * .59 + b * .11);
+    }
+
+    public static int RgbToGray(int xrgb) {
+        return RgbToGray((xrgb >> 16) & 0xff,
+                         (xrgb >>  8) & 0xff,
+                         (xrgb      ) & 0xff);
+    }
+
+    public static int NonPretoPre(int nonpre, int alpha) {
+        if (alpha == 0xff) return nonpre;
+        if (alpha == 0x00) return 0;
+        return (nonpre * alpha + 0x7f) / 0xff;
+    }
+
+    public static int PreToNonPre(int pre, int alpha) {
+        if (alpha == 0xff || alpha == 0x00) return pre;
+        return (pre >= alpha) ? 0xff : (pre * 0xff + (alpha >> 1)) / alpha;
+    }
+
+    public static int NonPretoPre(int nonpre) {
+        int a = nonpre >>> 24;
+        if (a == 0xff) return nonpre;
+        if (a == 0x00) return 0;
+        int r = (nonpre >> 16) & 0xff;
+        int g = (nonpre >>  8) & 0xff;
+        int b = (nonpre      ) & 0xff;
+        r = (r * a + 0x7f) / 0xff;
+        g = (g * a + 0x7f) / 0xff;
+        b = (b * a + 0x7f) / 0xff;
+        return (a << 24) | (r << 16) | (g << 8) | b;
+    }
+
+    public static int PretoNonPre(int pre) {
+        int a = pre >>> 24;
+        if (a == 0xff || a == 0x00) return pre;
+        int r = (pre >> 16) & 0xff;
+        int g = (pre >>  8) & 0xff;
+        int b = (pre      ) & 0xff;
+        int halfa = a >> 1;
+        r = (r >= a) ? 0xff : (r * 0xff + halfa) / a;
+        g = (g >= a) ? 0xff : (g * 0xff + halfa) / a;
+        b = (b >= a) ? 0xff : (b * 0xff + halfa) / a;
+        return (a << 24) | (r << 16) | (g << 8) | b;
+    }
+
+    public static BytePixelGetter getByteGetter(PixelFormat<ByteBuffer> pf) {
+        switch (pf.getType()) {
+            case BYTE_BGRA:
+                return ByteBgra.getter;
+            case BYTE_BGRA_PRE:
+                return ByteBgraPre.getter;
+            case BYTE_RGB:
+                return ByteRgb.getter;
+            case INT_ARGB:
+            case INT_ARGB_PRE:
+                // Impossible
+        }
+        return null;
+    }
+
+    public static IntPixelGetter getIntGetter(PixelFormat<IntBuffer> pf) {
+        switch (pf.getType()) {
+            case INT_ARGB:
+                return IntArgb.getter;
+            case INT_ARGB_PRE:
+                return IntArgbPre.getter;
+            case BYTE_BGRA:
+            case BYTE_BGRA_PRE:
+            case BYTE_RGB:
+                // Impossible
+        }
+        return null;
+    }
+
+    public static <T extends Buffer> PixelGetter<T> getGetter(PixelFormat<T> pf) {
+        switch (pf.getType()) {
+            case BYTE_BGRA:
+                return (PixelGetter<T>) ByteBgra.getter;
+            case BYTE_BGRA_PRE:
+                return (PixelGetter<T>) ByteBgraPre.getter;
+            case INT_ARGB:
+                return (PixelGetter<T>) IntArgb.getter;
+            case INT_ARGB_PRE:
+                return (PixelGetter<T>) IntArgbPre.getter;
+            case BYTE_RGB:
+                return (PixelGetter<T>) ByteRgb.getter;
+        }
+        return null;
+    }
+
+    public static BytePixelSetter getByteSetter(WritablePixelFormat<ByteBuffer> pf) {
+        switch (pf.getType()) {
+            case BYTE_BGRA:
+                return ByteBgra.setter;
+            case BYTE_BGRA_PRE:
+                return ByteBgraPre.setter;
+            case INT_ARGB:
+            case INT_ARGB_PRE:
+            case BYTE_RGB:
+                // Impossible
+        }
+        return null;
+    }
+
+    public static IntPixelSetter getIntSetter(WritablePixelFormat<IntBuffer> pf) {
+        switch (pf.getType()) {
+            case INT_ARGB:
+                return IntArgb.setter;
+            case INT_ARGB_PRE:
+                return IntArgbPre.setter;
+            case BYTE_BGRA:
+            case BYTE_BGRA_PRE:
+            case BYTE_RGB:
+                // Impossible
+        }
+        return null;
+    }
+
+    public static <T extends Buffer> PixelSetter<T> getSetter(WritablePixelFormat<T> pf) {
+        switch (pf.getType()) {
+            case BYTE_BGRA:
+                return (PixelSetter<T>) ByteBgra.setter;
+            case BYTE_BGRA_PRE:
+                return (PixelSetter<T>) ByteBgraPre.setter;
+            case INT_ARGB:
+                return (PixelSetter<T>) IntArgb.setter;
+            case INT_ARGB_PRE:
+                return (PixelSetter<T>) IntArgbPre.setter;
+            case BYTE_RGB:
+                // Impossible
+        }
+        return null;
+    }
+
+    public static <T extends Buffer, U extends Buffer>
+        PixelConverter<T, U> getConverter(PixelGetter<T> src, PixelSetter<U> dst)
+    {
+        if (src instanceof BytePixelGetter) {
+            if (dst instanceof BytePixelSetter) {
+                return (PixelConverter<T, U>)
+                    getB2BConverter((BytePixelGetter) src, (BytePixelSetter) dst);
+            } else {
+                return (PixelConverter<T, U>)
+                    getB2IConverter((BytePixelGetter) src, (IntPixelSetter) dst);
+            }
+        } else {
+            if (dst instanceof BytePixelSetter) {
+                return (PixelConverter<T, U>)
+                    getI2BConverter((IntPixelGetter) src, (BytePixelSetter) dst);
+            } else {
+                return (PixelConverter<T, U>)
+                    getI2IConverter((IntPixelGetter) src, (IntPixelSetter) dst);
+            }
+        }
+    }
+
+    public static ByteToBytePixelConverter
+        getB2BConverter(PixelGetter<ByteBuffer> src, PixelSetter<ByteBuffer> dst)
+    {
+        if (src ==        ByteBgra.getter) {
+            if (dst ==               ByteBgra.setter) {
+                return    ByteBgra.ToByteBgraConverter;
+            } else if (dst ==        ByteBgraPre.setter) {
+                return    ByteBgra.ToByteBgraPreConverter;
+            }
+        } else if (src == ByteBgraPre.getter) {
+            if (dst ==                  ByteBgra.setter) {
+                return    ByteBgraPre.ToByteBgraConverter;
+            } else if (dst ==           ByteBgraPre.setter) {
+                return    ByteBgraPre.ToByteBgraPreConverter;
+            }
+        } else if (src == ByteRgb.getter) {
+            if (dst ==              ByteBgra.setter) {
+                return    ByteRgb.ToByteBgraConverter;
+            } else if (dst ==       ByteBgraPre.setter) {
+                return    ByteRgb.ToByteBgraPreConverter;
+            }
+        }
+        return General.create((BytePixelGetter) src, (BytePixelSetter) dst);
+    }
+
+    public static ByteToIntPixelConverter
+        getB2IConverter(PixelGetter<ByteBuffer> src, PixelSetter<IntBuffer> dst)
+    {
+        if (src ==        ByteBgra.getter) {
+            if (dst ==               IntArgb.setter) {
+                return    ByteBgra.ToIntArgbConverter;
+            } else if (dst ==        IntArgbPre.setter) {
+                return    ByteBgra.ToIntArgbPreConverter;
+            }
+        } else if (src == ByteBgraPre.getter) {
+            if (dst ==                  IntArgb.setter) {
+                return    ByteBgraPre.ToIntArgbConverter;
+            } else if (dst ==           IntArgbPre.setter) {
+                return    ByteBgraPre.ToIntArgbPreConverter;
+            }
+        } else if (src == ByteRgb.getter) {
+            if (dst ==              IntArgb.setter) {
+                return    ByteRgb.ToIntArgbConverter;
+            } else if (dst ==       IntArgbPre.setter) {
+                return    ByteRgb.ToIntArgbPreConverter;
+            }
+        }
+        return General.create((BytePixelGetter) src, (IntPixelSetter) dst);
+    }
+
+    public static IntToBytePixelConverter
+        getI2BConverter(PixelGetter<IntBuffer> src, PixelSetter<ByteBuffer> dst)
+    {
+        if (src ==        IntArgb.getter) {
+            if (dst ==              ByteBgra.setter) {
+                return    IntArgb.ToByteBgraConverter;
+            } else if (dst ==       ByteBgraPre.setter) {
+                return    IntArgb.ToByteBgraPreConverter;
+            }
+        } else if (src == IntArgbPre.getter) {
+            if (dst ==                 ByteBgra.setter) {
+                return    IntArgbPre.ToByteBgraConverter;
+            } else if (dst ==          ByteBgraPre.setter) {
+                return    IntArgbPre.ToByteBgraPreConverter;
+            }
+        }
+        return General.create((IntPixelGetter) src, (BytePixelSetter) dst);
+    }
+
+    public static IntToIntPixelConverter
+        getI2IConverter(PixelGetter<IntBuffer> src, PixelSetter<IntBuffer> dst)
+    {
+        if (src ==        IntArgb.getter) {
+            if (dst ==              IntArgb.setter) {
+                return    IntArgb.ToIntArgbConverter;
+            } else if (dst ==       IntArgbPre.setter) {
+                return    IntArgb.ToIntArgbPreConverter;
+            }
+        } else if (src == IntArgbPre.getter) {
+            if (dst ==                 IntArgb.setter) {
+                return    IntArgbPre.ToIntArgbConverter;
+            } else if (dst ==          IntArgbPre.setter) {
+                return    IntArgbPre.ToIntArgbPreConverter;
+            }
+        }
+        return General.create((IntPixelGetter) src, (IntPixelSetter) dst);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/BaseByteToByteConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import java.nio.ByteBuffer;
+
+abstract class BaseByteToByteConverter
+    implements ByteToBytePixelConverter
+{
+    protected final BytePixelGetter getter;
+    protected final BytePixelSetter setter;
+    protected final int nSrcElems;
+    protected final int nDstElems;
+
+    BaseByteToByteConverter(BytePixelGetter getter, BytePixelSetter setter) {
+        this.getter = getter;
+        this.setter = setter;
+        this.nSrcElems = getter.getNumElements();
+        this.nDstElems = setter.getNumElements();
+    }
+
+    @Override
+    public final BytePixelGetter getGetter() {
+        return getter;
+    }
+
+    @Override
+    public final BytePixelSetter getSetter() {
+        return setter;
+    }
+
+    abstract void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                            byte dstarr[], int dstoff, int dstscanbytes,
+                            int w, int h);
+
+    abstract void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                            ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                            int w, int h);
+
+    @Override
+    public final void convert(byte srcarr[], int srcoff, int srcscanbytes,
+                              byte dstarr[], int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        doConvert(srcarr, srcoff, srcscanbytes,
+                  dstarr, dstoff, dstscanbytes,
+                  w, h);
+    }
+
+    @Override
+    public final void convert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                              ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray() && dstbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanbytes,
+                      dstbuf.array(), dstoff, dstscanbytes,
+                      w, h);
+        } else {
+            doConvert(srcbuf, srcoff, srcscanbytes,
+                      dstbuf, dstoff, dstscanbytes,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(ByteBuffer srcbuf,   int srcoff, int srcscanbytes,
+                              byte       dstarr[], int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanbytes,
+                      dstarr, dstoff, dstscanbytes,
+                      w, h);
+        } else {
+            ByteBuffer dstbuf = ByteBuffer.wrap(dstarr);
+            doConvert(srcbuf, srcoff, srcscanbytes,
+                      dstbuf, dstoff, dstscanbytes,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(byte       srcarr[], int srcoff, int srcscanbytes,
+                              ByteBuffer dstbuf,   int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (dstbuf.hasArray()) {
+            doConvert(srcarr, srcoff, srcscanbytes,
+                      dstbuf.array(), dstbuf.arrayOffset(), dstscanbytes,
+                      w, h);
+        } else {
+            ByteBuffer srcbuf = ByteBuffer.wrap(srcarr);
+            doConvert(srcbuf, srcoff, srcscanbytes,
+                      dstbuf, dstoff, dstscanbytes,
+                      w, h);
+        }
+    }
+
+    static ByteToBytePixelConverter create(BytePixelAccessor fmt) {
+        return new ByteAnyToSameConverter(fmt);
+    }
+
+    static class ByteAnyToSameConverter extends BaseByteToByteConverter {
+        ByteAnyToSameConverter(BytePixelAccessor fmt) {
+            super(fmt, fmt);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            while (--h >= 0) {
+                System.arraycopy(srcarr, srcoff, dstarr, dstoff, w * nSrcElems);
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            int srclimit = srcbuf.limit();
+            int origsrcpos = srcbuf.position();
+            int origdstpos = dstbuf.position();
+            try {
+                while (--h >= 0) {
+                    int newlimit = srcoff + w * nSrcElems;
+                    if (newlimit > srclimit) {
+                        throw new IndexOutOfBoundsException("" + srclimit);
+                    }
+                    srcbuf.limit(newlimit);
+                    srcbuf.position(srcoff);
+                    dstbuf.position(dstoff);
+                    dstbuf.put(srcbuf);
+                    srcoff += srcscanbytes;
+                    dstoff += dstscanbytes;
+                }
+            } finally {
+                srcbuf.limit(srclimit);
+                srcbuf.position(origsrcpos);
+                dstbuf.position(origdstpos);
+            }
+        }
+    }
+
+    public static ByteToBytePixelConverter
+        createReorderer(BytePixelGetter getter, BytePixelSetter setter,
+                        int c0, int c1, int c2, int c3)
+    {
+        return new FourByteReorderer(getter, setter, c0, c1, c2, c3);
+    }
+
+    static class FourByteReorderer extends BaseByteToByteConverter {
+        private final int c0, c1, c2, c3;
+
+        FourByteReorderer(BytePixelGetter getter, BytePixelSetter setter,
+                          int c0, int c1, int c2, int c3)
+        {
+            super(getter, setter);
+            this.c0 = c0;
+            this.c1 = c1;
+            this.c2 = c2;
+            this.c3 = c3;
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    // load all then store in case the buffers point to
+                    // the same memory
+                    byte b0 = srcarr[srcoff + c0];
+                    byte b1 = srcarr[srcoff + c1];
+                    byte b2 = srcarr[srcoff + c2];
+                    byte b3 = srcarr[srcoff + c3];
+                    dstarr[dstoff++] = b0;
+                    dstarr[dstoff++] = b1;
+                    dstarr[dstoff++] = b2;
+                    dstarr[dstoff++] = b3;
+                    srcoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    // load all then store in case the buffers point to
+                    // the same memory
+                    byte b0 = srcbuf.get(srcoff + c0);
+                    byte b1 = srcbuf.get(srcoff + c1);
+                    byte b2 = srcbuf.get(srcoff + c2);
+                    byte b3 = srcbuf.get(srcoff + c3);
+                    dstbuf.put(dstoff    , b0);
+                    dstbuf.put(dstoff + 1, b1);
+                    dstbuf.put(dstoff + 2, b2);
+                    dstbuf.put(dstoff + 3, b3);
+                    srcoff += 4;
+                    dstoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/BaseByteToIntConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.IntPixelSetter;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public abstract class BaseByteToIntConverter
+    implements ByteToIntPixelConverter
+{
+    protected final BytePixelGetter getter;
+    protected final IntPixelSetter  setter;
+    protected final int nSrcElems;
+
+    BaseByteToIntConverter(BytePixelGetter getter, IntPixelSetter setter) {
+        this.getter = getter;
+        this.setter = setter;
+        this.nSrcElems = getter.getNumElements();
+    }
+
+    @Override
+    public final BytePixelGetter getGetter() {
+        return getter;
+    }
+
+    @Override
+    public final IntPixelSetter getSetter() {
+        return setter;
+    }
+
+    abstract void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                            int  dstarr[], int dstoff, int dstscanints,
+                            int w, int h);
+
+    abstract void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                            IntBuffer  dstbuf, int dstoff, int dstscanints,
+                            int w, int h);
+
+    @Override
+    public final void convert(byte srcarr[], int srcoff, int srcscanbytes,
+                              int  dstarr[], int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanints  == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        doConvert(srcarr, srcoff, srcscanbytes,
+                  dstarr, dstoff, dstscanints,
+                  w, h);
+    }
+
+    @Override
+    public final void convert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                              IntBuffer  dstbuf, int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanints  == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray() && dstbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanbytes,
+                      dstbuf.array(), dstoff, dstscanints,
+                      w, h);
+        } else {
+            doConvert(srcbuf, srcoff, srcscanbytes,
+                      dstbuf, dstoff, dstscanints,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(ByteBuffer srcbuf,   int srcoff, int srcscanbytes,
+                              int        dstarr[], int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanints  == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanbytes,
+                      dstarr, dstoff, dstscanints,
+                      w, h);
+        } else {
+            IntBuffer dstbuf = IntBuffer.wrap(dstarr);
+            doConvert(srcbuf, srcoff, srcscanbytes,
+                      dstbuf, dstoff, dstscanints,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(byte      srcarr[], int srcoff, int srcscanbytes,
+                              IntBuffer dstbuf,   int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanbytes == w * nSrcElems &&
+            dstscanints  == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (dstbuf.hasArray()) {
+            doConvert(srcarr, srcoff, srcscanbytes,
+                      dstbuf.array(), dstoff, dstscanints,
+                      w, h);
+        } else {
+            ByteBuffer srcbuf = ByteBuffer.wrap(srcarr);
+            doConvert(srcbuf, srcoff, srcscanbytes,
+                      dstbuf, dstoff, dstscanints,
+                      w, h);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/BaseIntToByteConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.IntPixelGetter;
+import com.sun.javafx.image.IntToBytePixelConverter;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public abstract class BaseIntToByteConverter
+    implements IntToBytePixelConverter
+{
+    protected final IntPixelGetter  getter;
+    protected final BytePixelSetter setter;
+    protected final int nDstElems;
+
+    BaseIntToByteConverter(IntPixelGetter getter, BytePixelSetter setter) {
+        this.getter = getter;
+        this.setter = setter;
+        this.nDstElems = setter.getNumElements();
+    }
+
+    @Override
+    public final IntPixelGetter getGetter() {
+        return getter;
+    }
+
+    @Override
+    public final BytePixelSetter getSetter() {
+        return setter;
+    }
+
+    abstract void doConvert(int  srcarr[], int srcoff, int srcscanints,
+                            byte dstarr[], int dstoff, int dstscanbytes,
+                            int w, int h);
+
+    abstract void doConvert(IntBuffer  srcbuf, int srcoff, int srcscanints,
+                            ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                            int w, int h);
+
+    @Override
+    public final void convert(int  srcarr[], int srcoff, int srcscanints,
+                              byte dstarr[], int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints  == w &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        doConvert(srcarr, srcoff, srcscanints,
+                  dstarr, dstoff, dstscanbytes,
+                  w, h);
+    }
+
+    @Override
+    public final void convert(IntBuffer  srcbuf, int srcoff, int srcscanints,
+                              ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints  == w &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray() && dstbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanints,
+                      dstbuf.array(), dstoff, dstscanbytes,
+                      w, h);
+        } else {
+            doConvert(srcbuf, srcoff, srcscanints,
+                      dstbuf, dstoff, dstscanbytes,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(IntBuffer srcbuf,   int srcoff, int srcscanints,
+                              byte      dstarr[], int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints  == w &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanints,
+                      dstarr, dstoff, dstscanbytes,
+                      w, h);
+        } else {
+            ByteBuffer dstbuf = ByteBuffer.wrap(dstarr);
+            doConvert(srcbuf, srcoff, srcscanints,
+                      dstbuf, dstoff, dstscanbytes,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(int        srcarr[], int srcoff, int srcscanints,
+                              ByteBuffer dstbuf,   int dstoff, int dstscanbytes,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints  == w &&
+            dstscanbytes == w * nDstElems)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (dstbuf.hasArray()) {
+            doConvert(srcarr, srcoff, srcscanints,
+                      dstbuf.array(), dstoff, dstscanbytes,
+                      w, h);
+        } else {
+            IntBuffer srcbuf = IntBuffer.wrap(srcarr);
+            doConvert(srcbuf, srcoff, srcscanints,
+                      dstbuf, dstoff, dstscanbytes,
+                      w, h);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/BaseIntToIntConverter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.IntPixelAccessor;
+import com.sun.javafx.image.IntPixelGetter;
+import com.sun.javafx.image.IntPixelSetter;
+import com.sun.javafx.image.IntToIntPixelConverter;
+import java.nio.IntBuffer;
+
+public abstract class BaseIntToIntConverter
+    implements IntToIntPixelConverter
+{
+    protected final IntPixelGetter getter;
+    protected final IntPixelSetter setter;
+
+    public BaseIntToIntConverter(IntPixelGetter getter, IntPixelSetter setter) {
+        this.getter = getter;
+        this.setter = setter;
+    }
+
+    @Override
+    public final IntPixelGetter getGetter() {
+        return getter;
+    }
+
+    @Override
+    public final IntPixelSetter getSetter() {
+        return setter;
+    }
+
+    abstract void doConvert(int srcarr[], int srcoff, int srcscanints,
+                            int dstarr[], int dstoff, int dstscanints,
+                            int w, int h);
+
+    abstract void doConvert(IntBuffer srcbuf, int srcoff, int srcscanints,
+                            IntBuffer dstbuf, int dstoff, int dstscanints,
+                            int w, int h);
+
+    @Override
+    public final void convert(int srcarr[], int srcoff, int srcscanints,
+                              int dstarr[], int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints == w &&
+            dstscanints == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        doConvert(srcarr, srcoff, srcscanints,
+                  dstarr, dstoff, dstscanints,
+                  w, h);
+    }
+
+    @Override
+    public final void convert(IntBuffer srcbuf, int srcoff, int srcscanints,
+                              IntBuffer dstbuf, int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints == w &&
+            dstscanints == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray() && dstbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanints,
+                      dstbuf.array(), dstoff, dstscanints,
+                      w, h);
+        } else {
+            doConvert(srcbuf, srcoff, srcscanints,
+                      dstbuf, dstoff, dstscanints,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(IntBuffer srcbuf,   int srcoff, int srcscanints,
+                              int       dstarr[], int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints == w &&
+            dstscanints == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (srcbuf.hasArray()) {
+            doConvert(srcbuf.array(), srcoff, srcscanints,
+                      dstarr, dstoff, dstscanints,
+                      w, h);
+        } else {
+            IntBuffer dstbuf = IntBuffer.wrap(dstarr);
+            doConvert(srcbuf, srcoff, srcscanints,
+                      dstbuf, dstoff, dstscanints,
+                      w, h);
+        }
+    }
+
+    @Override
+    public final void convert(int       srcarr[], int srcoff, int srcscanints,
+                              IntBuffer dstbuf,   int dstoff, int dstscanints,
+                              int w, int h)
+    {
+        if (w <= 0 || h <= 0) return;
+        if (srcscanints == w &&
+            dstscanints == w)
+        {
+            w *= h;
+            h = 1;
+        }
+        if (dstbuf.hasArray()) {
+            doConvert(srcarr, srcoff, srcscanints,
+                      dstbuf.array(), dstoff, dstscanints,
+                      w, h);
+        } else {
+            IntBuffer srcbuf = IntBuffer.wrap(srcarr);
+            doConvert(srcbuf, srcoff, srcscanints,
+                      dstbuf, dstoff, dstscanints,
+                      w, h);
+        }
+    }
+
+    static IntToIntPixelConverter create(IntPixelAccessor fmt) {
+        return new IntAnyToSameConverter(fmt);
+    }
+
+    static class IntAnyToSameConverter extends BaseIntToIntConverter {
+        IntAnyToSameConverter(IntPixelAccessor fmt) {
+            super(fmt, fmt);
+        }
+
+        @Override
+        void doConvert(int srcarr[], int srcoff, int srcscanints,
+                       int dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            while (--h >= 0) {
+                System.arraycopy(srcarr, srcoff, dstarr, dstoff, w);
+                srcoff += srcscanints;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer srcbuf, int srcoff, int srcscanints,
+                       IntBuffer dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            int srclimit = srcbuf.limit();
+            int origsrcpos = srcbuf.position();
+            int origdstpos = dstbuf.position();
+            try {
+                while (--h >= 0) {
+                    int newlimit = srcoff + w;
+                    if (newlimit > srclimit) {
+                        throw new IndexOutOfBoundsException("" + srclimit);
+                    }
+                    srcbuf.limit(newlimit);
+                    srcbuf.position(srcoff);
+                    dstbuf.position(dstoff);
+                    dstbuf.put(srcbuf);
+                    srcoff += srcscanints;
+                    dstoff += dstscanints;
+                }
+            } finally {
+                srcbuf.limit(srclimit);
+                srcbuf.position(origsrcpos);
+                dstbuf.position(origdstpos);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteArgb.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+
+public class ByteArgb {
+    public static final BytePixelGetter     getter = Accessor.instance;
+    public static final BytePixelSetter     setter = Accessor.instance;
+    public static final BytePixelAccessor accessor = Accessor.instance;
+
+    static class Accessor implements BytePixelAccessor {
+        static final BytePixelAccessor instance = new Accessor();
+        private Accessor() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.NONPREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 4;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            return (((arr[offset    ]       ) << 24) |
+                    ((arr[offset + 1] & 0xff) << 16) |
+                    ((arr[offset + 2] & 0xff) <<  8) |
+                    ((arr[offset + 3] & 0xff)      ));
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            return PixelUtils.NonPretoPre(getArgb(arr, offset));
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buf, int offset) {
+            return (((buf.get(offset    )       ) << 24) |
+                    ((buf.get(offset + 1) & 0xff) << 16) |
+                    ((buf.get(offset + 2) & 0xff) <<  8) |
+                    ((buf.get(offset + 3) & 0xff)      ));
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buf, int offset) {
+            return PixelUtils.NonPretoPre(getArgb(buf, offset));
+        }
+
+        @Override
+        public void setArgb(byte arr[], int offset, int argb) {
+            arr[offset    ] = (byte) (argb >> 24);
+            arr[offset + 1] = (byte) (argb >> 16);
+            arr[offset + 2] = (byte) (argb >>  8);
+            arr[offset + 3] = (byte) (argb      );
+        }
+
+        @Override
+        public void setArgbPre(byte arr[], int offset, int argbpre) {
+            setArgb(arr, offset, PixelUtils.PretoNonPre(argbpre));
+        }
+
+        @Override
+        public void setArgb(ByteBuffer buf, int offset, int argb) {
+            buf.put(offset    , (byte) (argb >> 24));
+            buf.put(offset + 1, (byte) (argb >> 16));
+            buf.put(offset + 2, (byte) (argb >>  8));
+            buf.put(offset + 3, (byte) (argb      ));
+        }
+
+        @Override
+        public void setArgbPre(ByteBuffer buf, int offset, int argbpre) {
+            setArgb(buf, offset, PixelUtils.PretoNonPre(argbpre));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteBgra.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class ByteBgra {
+    public static final BytePixelGetter     getter = Accessor.instance;
+    public static final BytePixelSetter     setter = Accessor.instance;
+    public static final BytePixelAccessor accessor = Accessor.instance;
+
+    public static final ByteToBytePixelConverter ToByteBgraConverter =
+        BaseByteToByteConverter.create(accessor);
+    public static final ByteToBytePixelConverter ToByteBgraPreConverter =
+        ByteBgra.ToByteBgraPreConv.instance;
+    public static final ByteToIntPixelConverter ToIntArgbConverter =
+        ByteBgra.ToIntArgbSameConv.nonpremul;
+    public static final ByteToIntPixelConverter ToIntArgbPreConverter =
+        ByteBgra.ToIntArgbPreConv.instance;
+
+    static class Accessor implements BytePixelAccessor {
+        static final BytePixelAccessor instance = new Accessor();
+        private Accessor() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.NONPREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 4;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            return (((arr[offset    ] & 0xff)      ) |
+                    ((arr[offset + 1] & 0xff) <<  8) |
+                    ((arr[offset + 2] & 0xff) << 16) |
+                    ((arr[offset + 3]       ) << 24));
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            return PixelUtils.NonPretoPre(getArgb(arr, offset));
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buf, int offset) {
+            return (((buf.get(offset    ) & 0xff)      ) |
+                    ((buf.get(offset + 1) & 0xff) <<  8) |
+                    ((buf.get(offset + 2) & 0xff) << 16) |
+                    ((buf.get(offset + 3)       ) << 24));
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buf, int offset) {
+            return PixelUtils.NonPretoPre(getArgb(buf, offset));
+        }
+
+        @Override
+        public void setArgb(byte arr[], int offset, int argb) {
+            arr[offset    ] = (byte) (argb      );
+            arr[offset + 1] = (byte) (argb >>  8);
+            arr[offset + 2] = (byte) (argb >> 16);
+            arr[offset + 3] = (byte) (argb >> 24);
+        }
+
+        @Override
+        public void setArgbPre(byte arr[], int offset, int argbpre) {
+            setArgb(arr, offset, PixelUtils.PretoNonPre(argbpre));
+        }
+
+        @Override
+        public void setArgb(ByteBuffer buf, int offset, int argb) {
+            buf.put(offset    , (byte) (argb      ));
+            buf.put(offset + 1, (byte) (argb >>  8));
+            buf.put(offset + 2, (byte) (argb >> 16));
+            buf.put(offset + 3, (byte) (argb >> 24));
+        }
+
+        @Override
+        public void setArgbPre(ByteBuffer buf, int offset, int argbpre) {
+            setArgb(buf, offset, PixelUtils.PretoNonPre(argbpre));
+        }
+    }
+
+    static class ToByteBgraPreConv extends BaseByteToByteConverter {
+        static final ByteToBytePixelConverter instance =
+            new ToByteBgraPreConv();
+
+        private ToByteBgraPreConv() {
+            super(ByteBgra.getter, ByteBgraPre.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte b = srcarr[srcoff++];
+                    byte g = srcarr[srcoff++];
+                    byte r = srcarr[srcoff++];
+                    int  a = srcarr[srcoff++] & 0xff;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (byte) (((b & 0xff) * a + 0x7f) / 0xff);
+                            g = (byte) (((g & 0xff) * a + 0x7f) / 0xff);
+                            r = (byte) (((r & 0xff) * a + 0x7f) / 0xff);
+                        }
+                    }
+                    dstarr[dstoff++] = b;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = r;
+                    dstarr[dstoff++] = (byte) a;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte b = srcbuf.get(srcoff    );
+                    byte g = srcbuf.get(srcoff + 1);
+                    byte r = srcbuf.get(srcoff + 2);
+                    int  a = srcbuf.get(srcoff + 3) & 0xff;
+                    srcoff += 4;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (byte) (((b & 0xff) * a + 0x7f) / 0xff);
+                            g = (byte) (((g & 0xff) * a + 0x7f) / 0xff);
+                            r = (byte) (((r & 0xff) * a + 0x7f) / 0xff);
+                        }
+                    }
+                    dstbuf.put(dstoff    , b);
+                    dstbuf.put(dstoff + 1, g);
+                    dstbuf.put(dstoff + 2, r);
+                    dstbuf.put(dstoff + 3, (byte) a);
+                    dstoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ToIntArgbSameConv extends BaseByteToIntConverter {
+        static final ByteToIntPixelConverter nonpremul = new ToIntArgbSameConv(false);
+        static final ByteToIntPixelConverter    premul = new ToIntArgbSameConv(true);
+
+        private ToIntArgbSameConv(boolean isPremult) {
+            super(isPremult ? ByteBgra.getter : ByteBgraPre.getter,
+                  isPremult ?  IntArgb.setter :  IntArgbPre.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanints -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstarr[dstoff++] =
+                        ((srcarr[srcoff++] & 0xff)      ) |
+                        ((srcarr[srcoff++] & 0xff) <<  8) |
+                        ((srcarr[srcoff++] & 0xff) << 16) |
+                        ((srcarr[srcoff++]       ) << 24);
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstbuf.put(dstoff + x,
+                               ((srcbuf.get(srcoff    ) & 0xff)      ) |
+                               ((srcbuf.get(srcoff + 1) & 0xff) <<  8) |
+                               ((srcbuf.get(srcoff + 2) & 0xff) << 16) |
+                               ((srcbuf.get(srcoff + 3)       ) << 24));
+                    srcoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+    }
+
+    static class ToIntArgbPreConv extends BaseByteToIntConverter {
+        public static final ByteToIntPixelConverter instance =
+            new ToIntArgbPreConv();
+
+        private ToIntArgbPreConv() {
+            super(ByteBgra.getter, IntArgbPre.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanints  -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int b = srcarr[srcoff++] & 0xff;
+                    int g = srcarr[srcoff++] & 0xff;
+                    int r = srcarr[srcoff++] & 0xff;
+                    int a = srcarr[srcoff++] & 0xff;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (b * a + 0x7f) / 0xff;
+                            g = (g * a + 0x7f) / 0xff;
+                            r = (r * a + 0x7f) / 0xff;
+                        }
+                    }
+                    dstarr[dstoff++] =
+                        (a << 24) | (r << 16) | (g << 8) | b;
+                }
+                dstoff += dstscanints;
+                srcoff += srcscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int b = srcbuf.get(srcoff    ) & 0xff;
+                    int g = srcbuf.get(srcoff + 1) & 0xff;
+                    int r = srcbuf.get(srcoff + 2) & 0xff;
+                    int a = srcbuf.get(srcoff + 3) & 0xff;
+                    srcoff += 4;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (b * a + 0x7f) / 0xff;
+                            g = (g * a + 0x7f) / 0xff;
+                            r = (r * a + 0x7f) / 0xff;
+                        }
+                    }
+                    dstbuf.put(dstoff + x, (a << 24) | (r << 16) | (g << 8) | b);
+                }
+                dstoff += dstscanints;
+                srcoff += srcscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteBgraPre.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class ByteBgraPre {
+    public static final BytePixelGetter     getter = Accessor.instance;
+    public static final BytePixelSetter     setter = Accessor.instance;
+    public static final BytePixelAccessor accessor = Accessor.instance;
+
+    public static final ByteToBytePixelConverter ToByteBgraConverter =
+        ByteBgraPre.ToByteBgraConv.instance;
+    public static final ByteToBytePixelConverter ToByteBgraPreConverter =
+        BaseByteToByteConverter.create(accessor);
+    public static final ByteToIntPixelConverter ToIntArgbConverter =
+        ByteBgraPre.ToIntArgbConv.instance;
+    public static final ByteToIntPixelConverter ToIntArgbPreConverter =
+        ByteBgra.ToIntArgbSameConv.premul;
+
+    static class Accessor implements BytePixelAccessor {
+        static final BytePixelAccessor instance = new Accessor();
+        private Accessor() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.PREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 4;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            return PixelUtils.PretoNonPre(getArgbPre(arr, offset));
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            return (((arr[offset    ] & 0xff)      ) |
+                    ((arr[offset + 1] & 0xff) <<  8) |
+                    ((arr[offset + 2] & 0xff) << 16) |
+                    ((arr[offset + 3]       ) << 24));
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buffer, int offset) {
+            return PixelUtils.PretoNonPre(getArgbPre(buffer, offset));
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buffer, int offset) {
+            return (((buffer.get(offset    ) & 0xff)      ) |
+                    ((buffer.get(offset + 1) & 0xff) <<  8) |
+                    ((buffer.get(offset + 2) & 0xff) << 16) |
+                    ((buffer.get(offset + 3)       ) << 24));
+        }
+
+        @Override
+        public void setArgb(byte arr[], int offset, int argb) {
+            setArgbPre(arr, offset, PixelUtils.NonPretoPre(argb));
+        }
+
+        @Override
+        public void setArgbPre(byte arr[], int offset, int argbpre) {
+            arr[offset    ] = (byte) (argbpre      );
+            arr[offset + 1] = (byte) (argbpre >>  8);
+            arr[offset + 2] = (byte) (argbpre >> 16);
+            arr[offset + 3] = (byte) (argbpre >> 24);
+        }
+
+        @Override
+        public void setArgb(ByteBuffer buffer, int offset, int argb) {
+            setArgbPre(buffer, offset, PixelUtils.NonPretoPre(argb));
+        }
+
+        @Override
+        public void setArgbPre(ByteBuffer buffer, int offset, int argbpre) {
+            buffer.put(offset    , (byte) (argbpre      ));
+            buffer.put(offset + 1, (byte) (argbpre >>  8));
+            buffer.put(offset + 2, (byte) (argbpre >> 16));
+            buffer.put(offset + 3, (byte) (argbpre >> 24));
+        }
+    }
+
+    public static class ToByteBgraConv extends BaseByteToByteConverter {
+        public static final ByteToBytePixelConverter instance =
+            new ToByteBgraConv();
+
+        private ToByteBgraConv() {
+            super(ByteBgraPre.getter, ByteBgra.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte b = srcarr[srcoff++];
+                    byte g = srcarr[srcoff++];
+                    byte r = srcarr[srcoff++];
+                    int  a = srcarr[srcoff++] & 0xff;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        b = (byte) (((b & 0xff) * 0xff + halfa) / a);
+                        g = (byte) (((g & 0xff) * 0xff + halfa) / a);
+                        r = (byte) (((r & 0xff) * 0xff + halfa) / a);
+                    }
+                    dstarr[dstoff++] = b;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = r;
+                    dstarr[dstoff++] = (byte) a;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte b = srcbuf.get(srcoff    );
+                    byte g = srcbuf.get(srcoff + 1);
+                    byte r = srcbuf.get(srcoff + 2);
+                    int  a = srcbuf.get(srcoff + 3) & 0xff;
+                    srcoff += 4;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        b = (byte) (((b & 0xff) * 0xff + halfa) / a);
+                        g = (byte) (((g & 0xff) * 0xff + halfa) / a);
+                        r = (byte) (((r & 0xff) * 0xff + halfa) / a);
+                    }
+                    dstbuf.put(dstoff    , b);
+                    dstbuf.put(dstoff + 1, g);
+                    dstbuf.put(dstoff + 2, r);
+                    dstbuf.put(dstoff + 3, (byte) a);
+                    dstoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    public static class ToIntArgbConv extends BaseByteToIntConverter {
+        public static final ByteToIntPixelConverter instance =
+            new ToIntArgbConv();
+
+        private ToIntArgbConv() {
+            super(ByteBgraPre.getter, IntArgb.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanints  -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int b = srcarr[srcoff++] & 0xff;
+                    int g = srcarr[srcoff++] & 0xff;
+                    int r = srcarr[srcoff++] & 0xff;
+                    int a = srcarr[srcoff++] & 0xff;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        r = (r * 0xff + halfa) / a;
+                        g = (g * 0xff + halfa) / a;
+                        b = (b * 0xff + halfa) / a;
+                    }
+                    dstarr[dstoff++] =
+                        (a << 24) | (r << 16) | (g << 8) | b;
+                }
+                dstoff += dstscanints;
+                srcoff += srcscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int b = srcbuf.get(srcoff    ) & 0xff;
+                    int g = srcbuf.get(srcoff + 1) & 0xff;
+                    int r = srcbuf.get(srcoff + 2) & 0xff;
+                    int a = srcbuf.get(srcoff + 3) & 0xff;
+                    srcoff += 4;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        r = (r * 0xff + halfa) / a;
+                        g = (g * 0xff + halfa) / a;
+                        b = (b * 0xff + halfa) / a;
+                    }
+                    dstbuf.put(dstoff + x, (a << 24) | (r << 16) | (g << 8) | b);
+                }
+                dstoff += dstscanints;
+                srcoff += srcscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteGray.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.IntPixelSetter;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class ByteGray {
+    public static final BytePixelGetter getter = Getter.instance;
+
+    public static final ByteToBytePixelConverter ToByteBgraConverter =
+        ByteRgb.ToByteBgrfConv.nonpremult;
+    public static final ByteToBytePixelConverter ToByteBgraPreConverter =
+        ByteRgb.ToByteBgrfConv.premult;
+    public static final ByteToIntPixelConverter ToIntArgbConverter =
+        ByteRgb.ToIntFrgbConv.nonpremult;
+    public static final ByteToIntPixelConverter ToIntArgbPreConverter =
+        ByteRgb.ToIntFrgbConv.premult;
+
+    static class Getter implements BytePixelGetter {
+        static final BytePixelGetter instance = new Getter();
+        private Getter() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.OPAQUE;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 1;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            int g = arr[offset] & 0xff;
+            return (0xff000000 | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            int g = arr[offset] & 0xff;
+            return (0xff000000 | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buf, int offset) {
+            int g = buf.get(offset) & 0xff;
+            return (0xff000000 | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buf, int offset) {
+            int g = buf.get(offset) & 0xff;
+            return (0xff000000 | (g << 16) | (g << 8) | g);
+        }
+    }
+
+    static class ToByteBgrfConv extends BaseByteToByteConverter {
+        public static final ByteToBytePixelConverter nonpremult =
+            new ToByteBgrfConv(ByteBgra.setter);
+        public static final ByteToBytePixelConverter    premult =
+            new ToByteBgrfConv(ByteBgraPre.setter);
+
+        ToByteBgrfConv(BytePixelSetter setter) {
+            super(ByteGray.getter, setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte g = srcarr[srcoff + x];
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = (byte) 0xff;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte g = srcbuf.get(srcoff + x);
+                    dstbuf.put(dstoff    , g);
+                    dstbuf.put(dstoff + 1, g);
+                    dstbuf.put(dstoff + 2, g);
+                    dstbuf.put(dstoff + 3, (byte) 0xff);
+                    dstoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ToIntFrgbConv extends BaseByteToIntConverter {
+        public static final ByteToIntPixelConverter nonpremult =
+            new ToIntFrgbConv(IntArgb.setter);
+        public static final ByteToIntPixelConverter    premult =
+            new ToIntFrgbConv(IntArgbPre.setter);
+
+        private ToIntFrgbConv(IntPixelSetter setter) {
+            super(ByteRgb.getter, setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int g = srcarr[srcoff + x] & 0xff;
+                    dstarr[dstoff + x] = 0xff000000 | (g << 16) | (g << 8) | g;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int g = srcbuf.get(srcoff + x) & 0xff;
+                    dstbuf.put(dstoff + x, 0xff000000 | (g << 16) | (g << 8) | g);
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteGrayAlpha.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+
+public class ByteGrayAlpha {
+    public static final BytePixelGetter     getter = Accessor.nonpremul;
+    public static final BytePixelSetter     setter = Accessor.nonpremul;
+    public static final BytePixelAccessor accessor = Accessor.nonpremul;
+
+    public static final ByteToBytePixelConverter ToByteGrayAlphaPre =
+        ToByteGrayAlphaPreConv.instance;
+    public static final ByteToBytePixelConverter ToByteBgra =
+        ToByteBgraSameConv.nonpremul;
+
+    static class Accessor implements BytePixelAccessor {
+        static final BytePixelAccessor nonpremul = new Accessor(false);
+        static final BytePixelAccessor    premul = new Accessor(true);
+
+        private boolean isPremult;
+        private Accessor(boolean isPremult) {
+            this.isPremult = isPremult;
+        }
+
+        @Override
+        public AlphaType getAlphaType() {
+            return isPremult ? AlphaType.PREMULTIPLIED : AlphaType.NONPREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 2;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            int g = arr[offset    ] & 0xff;
+            int a = arr[offset + 1] & 0xff;
+            if (isPremult) g = PixelUtils.PreToNonPre(g, a);
+            return ((a << 24) | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            int g = arr[offset    ] & 0xff;
+            int a = arr[offset + 1] & 0xff;
+            if (!isPremult) g = PixelUtils.NonPretoPre(g, a);
+            return ((a << 24) | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buf, int offset) {
+            int g = buf.get(offset    ) & 0xff;
+            int a = buf.get(offset + 1) & 0xff;
+            if (isPremult) g = PixelUtils.PreToNonPre(g, a);
+            return ((a << 24) | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buf, int offset) {
+            int g = buf.get(offset    ) & 0xff;
+            int a = buf.get(offset + 1) & 0xff;
+            if (!isPremult) g = PixelUtils.NonPretoPre(g, a);
+            return ((a << 24) | (g << 16) | (g << 8) | g);
+        }
+
+        @Override
+        public void setArgb(byte arr[], int offset, int argb) {
+            int g = PixelUtils.RgbToGray(argb);
+            int a = (argb >>> 24);
+            if (isPremult) g = PixelUtils.NonPretoPre(g, a);
+            arr[offset    ] = (byte) g;
+            arr[offset + 1] = (byte) a;
+        }
+
+        @Override
+        public void setArgbPre(byte arr[], int offset, int argbpre) {
+            int g = PixelUtils.RgbToGray(argbpre);
+            int a = (argbpre >>> 24);
+            if (!isPremult) g = PixelUtils.PreToNonPre(g, a);
+            arr[offset    ] = (byte) g;
+            arr[offset + 1] = (byte) a;
+        }
+
+        @Override
+        public void setArgb(ByteBuffer buf, int offset, int argb) {
+            int g = PixelUtils.RgbToGray(argb);
+            int a = (argb >>> 24);
+            if (isPremult) g = PixelUtils.NonPretoPre(g, a);
+            buf.put(offset    , (byte) g);
+            buf.put(offset + 1, (byte) a);
+        }
+
+        @Override
+        public void setArgbPre(ByteBuffer buf, int offset, int argbpre) {
+            int g = PixelUtils.RgbToGray(argbpre);
+            int a = (argbpre >>> 24);
+            if (!isPremult) g = PixelUtils.PreToNonPre(g, a);
+            buf.put(offset    , (byte) g);
+            buf.put(offset + 1, (byte) a);
+        }
+    }
+
+    static class ToByteGrayAlphaPreConv extends BaseByteToByteConverter {
+        static final ByteToBytePixelConverter instance =
+            new ToByteGrayAlphaPreConv();
+
+        private ToByteGrayAlphaPreConv() {
+            super(ByteGrayAlpha.getter, ByteGrayAlphaPre.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 2;
+            dstscanbytes -= w * 2;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int g = srcarr[srcoff++] & 0xff;
+                    int a = srcarr[srcoff++];
+                    if (a != -1) {
+                        if (a == 0) {
+                            g = 0;
+                        } else {
+                            g = (g * (a & 0xff) + 0x7f) / 0xff;
+                        }
+                    }
+                    dstarr[dstoff++] = (byte) g;
+                    dstarr[dstoff++] = (byte) a;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 2;
+            dstscanbytes -= w * 2;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int g = srcbuf.get(srcoff++) & 0xff;
+                    int a = srcbuf.get(srcoff++);
+                    if (a != -1) {
+                        if (a == 0) {
+                            g = 0;
+                        } else {
+                            g = (g * (a & 0xff) + 0x7f) / 0xff;
+                        }
+                    }
+                    dstbuf.put(dstoff++, (byte) g);
+                    dstbuf.put(dstoff++, (byte) a);
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ToByteBgraSameConv extends BaseByteToByteConverter {
+        static final ByteToBytePixelConverter nonpremul =
+            new ToByteBgraSameConv(false);
+        static final ByteToBytePixelConverter    premul =
+            new ToByteBgraSameConv(true);
+
+        private ToByteBgraSameConv(boolean isPremult) {
+            super(isPremult ? ByteGrayAlphaPre.getter : ByteGrayAlpha.getter,
+                  isPremult ?      ByteBgraPre.setter :      ByteBgra.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 2;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte g = srcarr[srcoff++];
+                    byte a = srcarr[srcoff++];
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = a;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 2;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte g = srcbuf.get(srcoff++);
+                    byte a = srcbuf.get(srcoff++);
+                    dstbuf.put(dstoff++, g);
+                    dstbuf.put(dstoff++, g);
+                    dstbuf.put(dstoff++, g);
+                    dstbuf.put(dstoff++, a);
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteGrayAlphaPre.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+
+public class ByteGrayAlphaPre {
+    public static final BytePixelGetter     getter = ByteGrayAlpha.Accessor.premul;
+    public static final BytePixelSetter     setter = ByteGrayAlpha.Accessor.premul;
+    public static final BytePixelAccessor accessor = ByteGrayAlpha.Accessor.premul;
+
+    public static final ByteToBytePixelConverter ToByteBgraPre =
+        ByteGrayAlpha.ToByteBgraSameConv.premul;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteRgb.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.IntPixelSetter;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class ByteRgb {
+    public static final BytePixelGetter getter = Getter.instance;
+
+    public static final ByteToBytePixelConverter ToByteBgraConverter =
+        ByteRgb.ToByteBgrfConv.nonpremult;
+    public static final ByteToBytePixelConverter ToByteBgraPreConverter =
+        ByteRgb.ToByteBgrfConv.premult;
+    public static final ByteToIntPixelConverter ToIntArgbConverter =
+        ByteRgb.ToIntFrgbConv.nonpremult;
+    public static final ByteToIntPixelConverter ToIntArgbPreConverter =
+        ByteRgb.ToIntFrgbConv.premult;
+    public static final ByteToBytePixelConverter ToByteArgbConverter =
+        ByteRgb.ToByteFrgbConv.nonpremult;
+
+    static class Getter implements BytePixelGetter {
+        static final BytePixelGetter instance = new Getter();
+        private Getter() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.OPAQUE;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 3;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            return (((arr[offset + 2] & 0xff)      ) |
+                    ((arr[offset + 1] & 0xff) <<  8) |
+                    ((arr[offset    ] & 0xff) << 16) |
+                    ((                  0xff) << 24));
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            return (((arr[offset + 2] & 0xff)      ) |
+                    ((arr[offset + 1] & 0xff) <<  8) |
+                    ((arr[offset    ] & 0xff) << 16) |
+                    ((                  0xff) << 24));
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buffer, int offset) {
+            return (((buffer.get(offset + 2) & 0xff)      ) |
+                    ((buffer.get(offset + 1) & 0xff) <<  8) |
+                    ((buffer.get(offset    ) & 0xff) << 16) |
+                    ((                         0xff) << 24));
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buffer, int offset) {
+            return (((buffer.get(offset + 2) & 0xff)      ) |
+                    ((buffer.get(offset + 1) & 0xff) <<  8) |
+                    ((buffer.get(offset    ) & 0xff) << 16) |
+                    ((                         0xff) << 24));
+        }
+    }
+
+    static class ToByteBgrfConv extends BaseByteToByteConverter {
+        public static final ByteToBytePixelConverter nonpremult =
+            new ToByteBgrfConv(ByteBgra.setter);
+        public static final ByteToBytePixelConverter    premult =
+            new ToByteBgrfConv(ByteBgraPre.setter);
+
+        private ToByteBgrfConv(BytePixelSetter setter) {
+            super(ByteRgb.getter, setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 3;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstarr[dstoff++] = srcarr[srcoff + 2];
+                    dstarr[dstoff++] = srcarr[srcoff + 1];
+                    dstarr[dstoff++] = srcarr[srcoff    ];
+                    dstarr[dstoff++] = (byte) 0xff;
+                    srcoff += 3;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 3;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstbuf.put(dstoff    , srcbuf.get(srcoff + 2));
+                    dstbuf.put(dstoff + 1, srcbuf.get(srcoff + 1));
+                    dstbuf.put(dstoff + 2, srcbuf.get(srcoff    ));
+                    dstbuf.put(dstoff + 3, (byte) 0xff);
+                    srcoff += 3;
+                    dstoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ToIntFrgbConv extends BaseByteToIntConverter {
+        public static final ByteToIntPixelConverter nonpremult =
+            new ToIntFrgbConv(IntArgb.setter);
+        public static final ByteToIntPixelConverter    premult =
+            new ToIntFrgbConv(IntArgbPre.setter);
+
+        private ToIntFrgbConv(IntPixelSetter setter) {
+            super(ByteRgb.getter, setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 3;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int r = srcarr[srcoff++] & 0xff;
+                    int g = srcarr[srcoff++] & 0xff;
+                    int b = srcarr[srcoff++] & 0xff;
+                    dstarr[dstoff + x] = 0xff000000 | (r << 16) | (g << 8) | b;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 3;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int r = srcbuf.get(srcoff    ) & 0xff;
+                    int g = srcbuf.get(srcoff + 1) & 0xff;
+                    int b = srcbuf.get(srcoff + 2) & 0xff;
+                    srcoff += 3;
+                    dstbuf.put(dstoff + x, 0xff000000 | (r << 16) | (g << 8) | b);
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+    }
+
+    static class ToByteFrgbConv extends BaseByteToByteConverter {
+        static final ByteToBytePixelConverter nonpremult =
+            new ToByteFrgbConv(ByteArgb.setter);
+
+        private ToByteFrgbConv(BytePixelSetter setter) {
+            super(ByteRgb.getter, setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 3;
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstarr[dstoff++] = (byte) 0xff;
+                    dstarr[dstoff++] = srcarr[srcoff++];
+                    dstarr[dstoff++] = srcarr[srcoff++];
+                    dstarr[dstoff++] = srcarr[srcoff++];
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 3;
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstbuf.put(dstoff++, (byte) 0xff);
+                    dstbuf.put(dstoff++, srcbuf.get(srcoff++));
+                    dstbuf.put(dstoff++, srcbuf.get(srcoff++));
+                    dstbuf.put(dstoff++, srcbuf.get(srcoff++));
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/ByteRgba.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelAccessor;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class ByteRgba {
+    public static final BytePixelGetter     getter = Accessor.instance;
+    public static final BytePixelSetter     setter = Accessor.instance;
+    public static final BytePixelAccessor accessor = Accessor.instance;
+
+    public static final ByteToBytePixelConverter ToByteRgbaConverter =
+        BaseByteToByteConverter.create(accessor);
+    public static final ByteToBytePixelConverter ToByteBgraConverter =
+        BaseByteToByteConverter.createReorderer(getter, ByteBgra.setter,
+                                                2, 1, 0, 3);
+//    public static final ByteToBytePixelConverter ToByteBgraPreConverter =
+//        ByteRgba.ToByteBgraPreConv.instance;
+
+    static class Accessor implements BytePixelAccessor {
+        static final BytePixelAccessor instance = new Accessor();
+        private Accessor() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.NONPREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 4;
+        }
+
+        @Override
+        public int getArgb(byte arr[], int offset) {
+            return (((arr[offset + 2] & 0xff)      ) |
+                    ((arr[offset + 1] & 0xff) <<  8) |
+                    ((arr[offset    ] & 0xff) << 16) |
+                    ((arr[offset + 3]       ) << 24));
+        }
+
+        @Override
+        public int getArgbPre(byte arr[], int offset) {
+            return PixelUtils.NonPretoPre(getArgb(arr, offset));
+        }
+
+        @Override
+        public int getArgb(ByteBuffer buf, int offset) {
+            return (((buf.get(offset + 2) & 0xff)      ) |
+                    ((buf.get(offset + 1) & 0xff) <<  8) |
+                    ((buf.get(offset    ) & 0xff) << 16) |
+                    ((buf.get(offset + 3)       ) << 24));
+        }
+
+        @Override
+        public int getArgbPre(ByteBuffer buf, int offset) {
+            return PixelUtils.NonPretoPre(getArgb(buf, offset));
+        }
+
+        @Override
+        public void setArgb(byte arr[], int offset, int argb) {
+            arr[offset    ] = (byte) (argb >> 24);
+            arr[offset + 1] = (byte) (argb >>  8);
+            arr[offset + 2] = (byte) (argb      );
+            arr[offset + 3] = (byte) (argb >> 24);
+        }
+
+        @Override
+        public void setArgbPre(byte arr[], int offset, int argbpre) {
+            setArgb(arr, offset, PixelUtils.PretoNonPre(argbpre));
+        }
+
+        @Override
+        public void setArgb(ByteBuffer buf, int offset, int argb) {
+            buf.put(offset    , (byte) (argb >> 16));
+            buf.put(offset + 1, (byte) (argb >>  8));
+            buf.put(offset + 2, (byte) (argb      ));
+            buf.put(offset + 3, (byte) (argb >> 24));
+        }
+
+        @Override
+        public void setArgbPre(ByteBuffer buf, int offset, int argbpre) {
+            setArgb(buf, offset, PixelUtils.PretoNonPre(argbpre));
+        }
+    }
+
+    static class ToByteBgraPreConv extends BaseByteToByteConverter {
+        static final ByteToBytePixelConverter instance =
+            new ToByteBgraPreConv();
+
+        private ToByteBgraPreConv() {
+            super(ByteRgba.getter, ByteBgraPre.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte r = srcarr[srcoff++];
+                    byte g = srcarr[srcoff++];
+                    byte b = srcarr[srcoff++];
+                    int  a = srcarr[srcoff++] & 0xff;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (byte) (((b & 0xff) * a + 0x7f) / 0xff);
+                            g = (byte) (((g & 0xff) * a + 0x7f) / 0xff);
+                            r = (byte) (((r & 0xff) * a + 0x7f) / 0xff);
+                        }
+                    }
+                    dstarr[dstoff++] = b;
+                    dstarr[dstoff++] = g;
+                    dstarr[dstoff++] = r;
+                    dstarr[dstoff++] = (byte) a;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    byte r = srcbuf.get(srcoff    );
+                    byte g = srcbuf.get(srcoff + 1);
+                    byte b = srcbuf.get(srcoff + 2);
+                    int  a = srcbuf.get(srcoff + 3) & 0xff;
+                    srcoff += 4;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (byte) (((b & 0xff) * a + 0x7f) / 0xff);
+                            g = (byte) (((g & 0xff) * a + 0x7f) / 0xff);
+                            r = (byte) (((r & 0xff) * a + 0x7f) / 0xff);
+                        }
+                    }
+                    dstbuf.put(dstoff    , b);
+                    dstbuf.put(dstoff + 1, g);
+                    dstbuf.put(dstoff + 2, r);
+                    dstbuf.put(dstoff + 3, (byte) a);
+                    dstoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ToIntArgbSameConv extends BaseByteToIntConverter {
+        static final ByteToIntPixelConverter nonpremul = new ToIntArgbSameConv(false);
+        static final ByteToIntPixelConverter    premul = new ToIntArgbSameConv(true);
+
+        private ToIntArgbSameConv(boolean isPremult) {
+            super(isPremult ? ByteBgraPre.getter : ByteRgba.getter,
+                  isPremult ?  IntArgbPre.setter :  IntArgb.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanints -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstarr[dstoff++] =
+                        ((srcarr[srcoff++] & 0xff)      ) |
+                        ((srcarr[srcoff++] & 0xff) <<  8) |
+                        ((srcarr[srcoff++] & 0xff) << 16) |
+                        ((srcarr[srcoff++]       ) << 24);
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    dstbuf.put(dstoff + x,
+                               ((srcbuf.get(srcoff    ) & 0xff)      ) |
+                               ((srcbuf.get(srcoff + 1) & 0xff) <<  8) |
+                               ((srcbuf.get(srcoff + 2) & 0xff) << 16) |
+                               ((srcbuf.get(srcoff + 3)       ) << 24));
+                    srcoff += 4;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanints;
+            }
+        }
+    }
+
+    static class ToIntArgbPreConv extends BaseByteToIntConverter {
+        public static final ByteToIntPixelConverter instance =
+            new ToIntArgbPreConv();
+
+        private ToIntArgbPreConv() {
+            super(ByteRgba.getter, IntArgbPre.setter);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            dstscanints  -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int b = srcarr[srcoff++] & 0xff;
+                    int g = srcarr[srcoff++] & 0xff;
+                    int r = srcarr[srcoff++] & 0xff;
+                    int a = srcarr[srcoff++] & 0xff;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (b * a + 0x7f) / 0xff;
+                            g = (g * a + 0x7f) / 0xff;
+                            r = (r * a + 0x7f) / 0xff;
+                        }
+                    }
+                    dstarr[dstoff++] =
+                        (a << 24) | (r << 16) | (g << 8) | b;
+                }
+                dstoff += dstscanints;
+                srcoff += srcscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int b = srcbuf.get(srcoff    ) & 0xff;
+                    int g = srcbuf.get(srcoff + 1) & 0xff;
+                    int r = srcbuf.get(srcoff + 2) & 0xff;
+                    int a = srcbuf.get(srcoff + 3) & 0xff;
+                    srcoff += 4;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = (b * a + 0x7f) / 0xff;
+                            g = (g * a + 0x7f) / 0xff;
+                            r = (r * a + 0x7f) / 0xff;
+                        }
+                    }
+                    dstbuf.put(dstoff + x, (a << 24) | (r << 16) | (g << 8) | b);
+                }
+                dstoff += dstscanints;
+                srcoff += srcscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/General.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.ByteToIntPixelConverter;
+import com.sun.javafx.image.IntPixelGetter;
+import com.sun.javafx.image.IntPixelSetter;
+import com.sun.javafx.image.IntToBytePixelConverter;
+import com.sun.javafx.image.IntToIntPixelConverter;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class General {
+    public static ByteToBytePixelConverter create(BytePixelGetter src,
+                                                  BytePixelSetter dst)
+    {
+        return new ByteToByteGeneralConverter(src, dst);
+    }
+
+    public static ByteToIntPixelConverter create(BytePixelGetter src,
+                                                 IntPixelSetter  dst)
+    {
+        return new ByteToIntGeneralConverter(src, dst);
+    }
+
+    public static IntToBytePixelConverter create(IntPixelGetter  src,
+                                                 BytePixelSetter dst)
+    {
+        return new IntToByteGeneralConverter(src, dst);
+    }
+
+    public static IntToIntPixelConverter create(IntPixelGetter src,
+                                                IntPixelSetter dst)
+    {
+        return new IntToIntGeneralConverter(src, dst);
+    }
+
+    static class ByteToByteGeneralConverter extends BaseByteToByteConverter {
+        boolean usePremult;
+
+        ByteToByteGeneralConverter(BytePixelGetter getter, BytePixelSetter setter) {
+            super(getter, setter);
+            usePremult = (getter.getAlphaType() != AlphaType.NONPREMULTIPLIED &&
+                          setter.getAlphaType() != AlphaType.NONPREMULTIPLIED);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= nSrcElems * w;
+            dstscanbytes -= nDstElems * w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstarr, dstoff, getter.getArgbPre(srcarr, srcoff));
+                    } else {
+                        setter.setArgb(dstarr, dstoff, getter.getArgb(srcarr, srcoff));
+                    }
+                    srcoff += nSrcElems;
+                    dstoff += nDstElems;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= nSrcElems * w;
+            dstscanbytes -= nDstElems * w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstbuf, dstoff, getter.getArgbPre(srcbuf, srcoff));
+                    } else {
+                        setter.setArgb(dstbuf, dstoff, getter.getArgb(srcbuf, srcoff));
+                    }
+                    srcoff += nSrcElems;
+                    dstoff += nDstElems;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ByteToIntGeneralConverter extends BaseByteToIntConverter {
+        boolean usePremult;
+
+        ByteToIntGeneralConverter(BytePixelGetter getter, IntPixelSetter setter) {
+            super(getter, setter);
+            usePremult = (getter.getAlphaType() != AlphaType.NONPREMULTIPLIED &&
+                          setter.getAlphaType() != AlphaType.NONPREMULTIPLIED);
+        }
+
+        @Override
+        void doConvert(byte srcarr[], int srcoff, int srcscanbytes,
+                       int  dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= nSrcElems * w;
+            dstscanbytes -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstarr, dstoff, getter.getArgbPre(srcarr, srcoff));
+                    } else {
+                        setter.setArgb(dstarr, dstoff, getter.getArgb(srcarr, srcoff));
+                    }
+                    srcoff += nSrcElems;
+                    dstoff++;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(ByteBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer  dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= nSrcElems * w;
+            dstscanbytes -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstbuf, dstoff, getter.getArgbPre(srcbuf, srcoff));
+                    } else {
+                        setter.setArgb(dstbuf, dstoff, getter.getArgb(srcbuf, srcoff));
+                    }
+                    srcoff += nSrcElems;
+                    dstoff++;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+    static class IntToByteGeneralConverter extends BaseIntToByteConverter {
+        boolean usePremult;
+
+        public IntToByteGeneralConverter(IntPixelGetter getter, BytePixelSetter setter) {
+            super(getter, setter);
+            usePremult = (getter.getAlphaType() != AlphaType.NONPREMULTIPLIED &&
+                          setter.getAlphaType() != AlphaType.NONPREMULTIPLIED);
+        }
+
+        @Override
+        void doConvert(int  srcarr[], int srcoff, int srcscanbytes,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w;
+            dstscanbytes -= nDstElems * w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstarr, dstoff, getter.getArgbPre(srcarr, srcoff));
+                    } else {
+                        setter.setArgb(dstarr, dstoff, getter.getArgb(srcarr, srcoff));
+                    }
+                    srcoff++;
+                    dstoff += nDstElems;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer  srcbuf, int srcoff, int srcscanbytes,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w;
+            dstscanbytes -= nDstElems * w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstbuf, dstoff, getter.getArgbPre(srcbuf, srcoff));
+                    } else {
+                        setter.setArgb(dstbuf, dstoff, getter.getArgb(srcbuf, srcoff));
+                    }
+                    srcoff++;
+                    dstoff += nDstElems;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+    static class IntToIntGeneralConverter extends BaseIntToIntConverter {
+        boolean usePremult;
+
+        public IntToIntGeneralConverter(IntPixelGetter getter, IntPixelSetter setter) {
+            super(getter, setter);
+            usePremult = (getter.getAlphaType() != AlphaType.NONPREMULTIPLIED &&
+                          setter.getAlphaType() != AlphaType.NONPREMULTIPLIED);
+        }
+
+        @Override
+        void doConvert(int srcarr[], int srcoff, int srcscanbytes,
+                       int dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w;
+            dstscanbytes -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstarr, dstoff, getter.getArgbPre(srcarr, srcoff));
+                    } else {
+                        setter.setArgb(dstarr, dstoff, getter.getArgb(srcarr, srcoff));
+                    }
+                    srcoff++;
+                    dstoff++;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer srcbuf, int srcoff, int srcscanbytes,
+                       IntBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanbytes -= w;
+            dstscanbytes -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    if (usePremult) {
+                        setter.setArgbPre(dstbuf, dstoff, getter.getArgbPre(srcbuf, srcoff));
+                    } else {
+                        setter.setArgb(dstbuf, dstoff, getter.getArgb(srcbuf, srcoff));
+                    }
+                    srcoff++;
+                    dstoff++;
+                }
+                srcoff += srcscanbytes;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/IntArgb.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.IntPixelAccessor;
+import com.sun.javafx.image.IntPixelGetter;
+import com.sun.javafx.image.IntPixelSetter;
+import com.sun.javafx.image.IntToBytePixelConverter;
+import com.sun.javafx.image.IntToIntPixelConverter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class IntArgb {
+    public static final IntPixelGetter     getter = Accessor.instance;
+    public static final IntPixelSetter     setter = Accessor.instance;
+    public static final IntPixelAccessor accessor = Accessor.instance;
+
+    public static final IntToBytePixelConverter ToByteBgraConverter =
+        IntArgb.ToByteBgraSameConv.nonpremul;
+    public static final IntToBytePixelConverter ToByteBgraPreConverter =
+        IntArgb.ToByteBgraPreConv.instance;
+    public static final IntToIntPixelConverter ToIntArgbConverter =
+        BaseIntToIntConverter.create(accessor);
+    public static final IntToIntPixelConverter ToIntArgbPreConverter =
+        IntArgb.ToIntArgbPreConv.instance;
+
+    static class Accessor implements IntPixelAccessor {
+        static final IntPixelAccessor instance = new Accessor();
+        private Accessor() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.NONPREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 1;
+        }
+
+        @Override
+        public int getArgb(int arr[], int offset) {
+            return arr[offset];
+        }
+
+        @Override
+        public int getArgbPre(int arr[], int offset) {
+            return PixelUtils.NonPretoPre(arr[offset]);
+        }
+
+        @Override
+        public int getArgb(IntBuffer buffer, int offset) {
+            return buffer.get(offset);
+        }
+
+        @Override
+        public int getArgbPre(IntBuffer buffer, int offset) {
+            return PixelUtils.NonPretoPre(buffer.get(offset));
+        }
+
+        @Override
+        public void setArgb(int arr[], int offset, int argb) {
+            arr[offset] = argb;
+        }
+
+        @Override
+        public void setArgbPre(int arr[], int offset, int argbpre) {
+            arr[offset] = PixelUtils.PretoNonPre(argbpre);
+        }
+
+        @Override
+        public void setArgb(IntBuffer buffer, int offset, int argb) {
+            buffer.put(offset, argb);
+        }
+
+        @Override
+        public void setArgbPre(IntBuffer buffer, int offset, int argbpre) {
+            buffer.put(offset, PixelUtils.PretoNonPre(argbpre));
+        }
+    }
+
+    public static class ToIntArgbPreConv extends BaseIntToIntConverter {
+        public static final IntToIntPixelConverter instance =
+            new ToIntArgbPreConv();
+
+        private ToIntArgbPreConv() {
+            super(IntArgb.getter, IntArgbPre.setter);
+        }
+
+        @Override
+        void doConvert(int srcarr[], int srcoff, int srcscanints,
+                       int dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanints -= w;
+            dstscanints -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcarr[srcoff++];
+                    int a = pixel >>> 24;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            pixel = 0;
+                        } else {
+                            int r = (((pixel >> 16) & 0xff) * a + 0x7f) / 0xff;
+                            int g = (((pixel >>  8) & 0xff) * a + 0x7f) / 0xff;
+                            int b = (((pixel      ) & 0xff) * a + 0x7f) / 0xff;
+                            pixel = (a << 24) | (r << 16) | (g << 8) | b;
+                        }
+                    }
+                    dstarr[dstoff++] = pixel;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer srcbuf, int srcoff, int srcscanints,
+                       IntBuffer dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcbuf.get(srcoff + x);
+                    int a = pixel >>> 24;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            pixel = 0;
+                        } else {
+                            int r = (((pixel >> 16) & 0xff) * a + 0x7f) / 0xff;
+                            int g = (((pixel >>  8) & 0xff) * a + 0x7f) / 0xff;
+                            int b = (((pixel      ) & 0xff) * a + 0x7f) / 0xff;
+                            pixel = (a << 24) | (r << 16) | (g << 8) | b;
+                        }
+                    }
+                    dstbuf.put(dstoff + x, pixel);
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanints;
+            }
+        }
+    }
+
+    static class ToByteBgraSameConv extends BaseIntToByteConverter {
+        static final IntToBytePixelConverter nonpremul = new ToByteBgraSameConv(false);
+        static final IntToBytePixelConverter premul = new ToByteBgraSameConv(true);
+
+        private ToByteBgraSameConv(boolean isPremult) {
+            super(isPremult ?  IntArgbPre.getter :  IntArgb.getter,
+                  isPremult ? ByteBgraPre.setter : ByteBgra.setter);
+        }
+
+        @Override
+        void doConvert(int  srcarr[], int srcoff, int srcscanints,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanints -= w;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcarr[srcoff++];
+                    dstarr[dstoff++] = (byte) (pixel      );
+                    dstarr[dstoff++] = (byte) (pixel >>  8);
+                    dstarr[dstoff++] = (byte) (pixel >> 16);
+                    dstarr[dstoff++] = (byte) (pixel >> 24);
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer  srcbuf, int srcoff, int srcscanints,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcbuf.get(srcoff + x);
+                    dstbuf.put(dstoff    , (byte) (pixel      ));
+                    dstbuf.put(dstoff + 1, (byte) (pixel >>  8));
+                    dstbuf.put(dstoff + 2, (byte) (pixel >> 16));
+                    dstbuf.put(dstoff + 3, (byte) (pixel >> 24));
+                    dstoff += 4;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+
+    static class ToByteBgraPreConv extends BaseIntToByteConverter {
+        public static final IntToBytePixelConverter instance =
+            new ToByteBgraPreConv();
+
+        private ToByteBgraPreConv() {
+            super(IntArgb.getter, ByteBgraPre.setter);
+        }
+
+        @Override
+        void doConvert(int  srcarr[], int srcoff, int srcscanints,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanints -= w;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcarr[srcoff++];
+                    int a = pixel >>> 24;
+                    int r = pixel >>  16;
+                    int g = pixel >>   8;
+                    int b = pixel       ;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = ((b & 0xff) * a + 0x7f) / 0xff;
+                            g = ((g & 0xff) * a + 0x7f) / 0xff;
+                            r = ((r & 0xff) * a + 0x7f) / 0xff;
+                        }
+                    }
+                    dstarr[dstoff++] = (byte) b;
+                    dstarr[dstoff++] = (byte) g;
+                    dstarr[dstoff++] = (byte) r;
+                    dstarr[dstoff++] = (byte) a;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer  srcbuf, int srcoff, int srcscanints,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcbuf.get(srcoff + x);
+                    int a = pixel >>> 24;
+                    int r = pixel >>  16;
+                    int g = pixel >>   8;
+                    int b = pixel       ;
+                    if (a < 0xff) {
+                        if (a == 0) {
+                            b = g = r = 0;
+                        } else {
+                            b = ((b & 0xff) * a + 0x7f) / 0xff;
+                            g = ((g & 0xff) * a + 0x7f) / 0xff;
+                            r = ((r & 0xff) * a + 0x7f) / 0xff;
+                        }
+                    }
+                    dstbuf.put(dstoff    , (byte) b);
+                    dstbuf.put(dstoff + 1, (byte) g);
+                    dstbuf.put(dstoff + 2, (byte) r);
+                    dstbuf.put(dstoff + 3, (byte) a);
+                    dstoff += 4;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-common/src/com/sun/javafx/image/impl/IntArgbPre.java	Tue Jun 12 10:07:03 2012 -0700
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.image.impl;
+
+import com.sun.javafx.image.AlphaType;
+import com.sun.javafx.image.IntPixelAccessor;
+import com.sun.javafx.image.IntPixelGetter;
+import com.sun.javafx.image.IntPixelSetter;
+import com.sun.javafx.image.IntToBytePixelConverter;
+import com.sun.javafx.image.IntToIntPixelConverter;
+import com.sun.javafx.image.PixelUtils;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+public class IntArgbPre {
+    public static final IntPixelGetter     getter = IntArgb.Accessor.instance;
+    public static final IntPixelSetter     setter = IntArgb.Accessor.instance;
+    public static final IntPixelAccessor accessor = IntArgb.Accessor.instance;
+
+    public static final IntToBytePixelConverter ToByteBgraConverter =
+        IntArgbPre.ToByteBgraConv.instance;
+    public static final IntToBytePixelConverter ToByteBgraPreConverter =
+        IntArgb.ToByteBgraSameConv.premul;
+    public static final IntToIntPixelConverter ToIntArgbConverter =
+        IntArgbPre.ToIntArgbConv.instance;
+    public static final IntToIntPixelConverter ToIntArgbPreConverter =
+        BaseIntToIntConverter.create(accessor);
+
+    static class Accessor implements IntPixelAccessor {
+        static final IntPixelAccessor instance = new Accessor();
+        private Accessor() {}
+
+        @Override
+        public AlphaType getAlphaType() {
+            return AlphaType.PREMULTIPLIED;
+        }
+
+        @Override
+        public int getNumElements() {
+            return 1;
+        }
+
+        @Override
+        public int getArgb(int arr[], int offset) {
+            return PixelUtils.PretoNonPre(arr[offset]);
+        }
+
+        @Override
+        public int getArgbPre(int arr[], int offset) {
+            return arr[offset];
+        }
+
+        @Override
+        public int getArgb(IntBuffer buffer, int offset) {
+            return PixelUtils.PretoNonPre(buffer.get(offset));
+        }
+
+        @Override
+        public int getArgbPre(IntBuffer buffer, int offset) {
+            return buffer.get(offset);
+        }
+
+        @Override
+        public void setArgb(int arr[], int offset, int argb) {
+            arr[offset] = PixelUtils.NonPretoPre(argb);
+        }
+
+        @Override
+        public void setArgbPre(int arr[], int offset, int argbpre) {
+            arr[offset] = argbpre;
+        }
+
+        @Override
+        public void setArgb(IntBuffer buffer, int offset, int argb) {
+            buffer.put(offset, PixelUtils.NonPretoPre(argb));
+        }
+
+        @Override
+        public void setArgbPre(IntBuffer buffer, int offset, int argbpre) {
+            buffer.put(offset, argbpre);
+        }
+    }
+
+    public static class ToIntArgbConv extends BaseIntToIntConverter {
+        public static final IntToIntPixelConverter instance =
+            new ToIntArgbConv();
+
+        private ToIntArgbConv() {
+            super(IntArgbPre.getter, IntArgb.setter);
+        }
+
+        @Override
+        void doConvert(int srcarr[], int srcoff, int srcscanints,
+                       int dstarr[], int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            srcscanints -= w;
+            dstscanints -= w;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcarr[srcoff++];
+                    int a = pixel >>> 24;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        int r = (((pixel >> 16) & 0xff) * 0xff + halfa) / a;
+                        int g = (((pixel >>  8) & 0xff) * 0xff + halfa) / a;
+                        int b = (((pixel      ) & 0xff) * 0xff + halfa) / a;
+                        pixel = (a << 24) | (r << 16) | (g << 8) | b;
+                    }
+                    dstarr[dstoff++] = pixel;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanints;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer srcbuf, int srcoff, int srcscanints,
+                       IntBuffer dstbuf, int dstoff, int dstscanints,
+                       int w, int h)
+        {
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcbuf.get(srcoff + x);
+                    int a = pixel >>> 24;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        int r = (((pixel >> 16) & 0xff) * 0xff + halfa) / a;
+                        int g = (((pixel >>  8) & 0xff) * 0xff + halfa) / a;
+                        int b = (((pixel      ) & 0xff) * 0xff + halfa) / a;
+                        pixel = (a << 24) | (r << 16) | (g << 8) | b;
+                    }
+                    dstbuf.put(dstoff + x, pixel);
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanints;
+            }
+        }
+    }
+
+    static class ToByteBgraConv extends BaseIntToByteConverter {
+        public static final IntToBytePixelConverter instance =
+            new ToByteBgraConv();
+
+        private ToByteBgraConv() {
+            super(IntArgbPre.getter, ByteBgra.setter);
+        }
+
+        @Override
+        void doConvert(int  srcarr[], int srcoff, int srcscanints,
+                       byte dstarr[], int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            srcscanints -= w;
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcarr[srcoff++];
+                    int a = pixel >>> 24;
+                    int r = (pixel >> 16) & 0xff;
+                    int g = (pixel >>  8) & 0xff;
+                    int b = (pixel      ) & 0xff;
+                    if (a > 0 && a < 0xff) {
+                        int halfa = a >> 1;
+                        r = (r * 0xff + halfa) / a;
+                        g = (g * 0xff + halfa) / a;
+                        b = (b * 0xff + halfa) / a;
+                    }
+                    dstarr[dstoff++] = (byte) b;
+                    dstarr[dstoff++] = (byte) g;
+                    dstarr[dstoff++] = (byte) r;
+                    dstarr[dstoff++] = (byte) a;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanbytes;
+            }
+        }
+
+        @Override
+        void doConvert(IntBuffer  srcbuf, int srcoff, int srcscanints,
+                       ByteBuffer dstbuf, int dstoff, int dstscanbytes,
+                       int w, int h)
+        {
+            dstscanbytes -= w * 4;
+            while (--h >= 0) {
+                for (int x = 0; x < w; x++) {
+                    int pixel = srcbuf.get(srcoff + x);
+                    int a = pixel >>> 24;
+                    int r = (pixel >> 16) & 0xff;
+                    int g = (pixel >>  8) & 0xff;
+                    int b = (pixel      ) & 0xff;
+                    if (a > 0 && a < 0xff) {
+                        r = (r * a + 0x7f) / 0xff;
+                        g = (g * a + 0x7f) / 0xff;
+                        b = (b * a + 0x7f) / 0xff;
+                    }
+                    dstbuf.put(dstoff    , (byte) b);
+                    dstbuf.put(dstoff + 1, (byte) g);
+                    dstbuf.put(dstoff + 2, (byte) r);
+                    dstbuf.put(dstoff + 3, (byte) a);
+                    dstoff += 4;
+                }
+                srcoff += srcscanints;
+                dstoff += dstscanbytes;
+            }
+        }
+    }
+}
--- a/javafx-ui-common/src/com/sun/javafx/scene/input/InputEventUtils.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/com/sun/javafx/scene/input/InputEventUtils.java	Tue Jun 12 10:07:03 2012 -0700
@@ -56,14 +56,24 @@
             if (oldSourceNode != null) {
                 Point2D pt = oldSourceNode.localToScene(newX, newY);
                 pt = newSourceNode.sceneToLocal(pt);
-                newX = pt.getX();
-                newY = pt.getY();
+                if (pt != null) {
+                    newX = pt.getX();
+                    newY = pt.getY();
+                } else {
+                    newX = Double.NaN;
+                    newY = Double.NaN;
+                }
             } else {
                 // assume that since no node was in the evt, then it was in
                 // terms of the scene
                 Point2D pt = newSourceNode.sceneToLocal(newX, newY);
-                newX = pt.getX();
-                newY = pt.getY();
+                if (pt != null) {
+                    newX = pt.getX();
+                    newY = pt.getY();
+                } else {
+                    newX = Double.NaN;
+                    newY = Double.NaN;
+                }
             }
         } else {
             if (oldSourceNode != null) {
--- a/javafx-ui-common/src/com/sun/javafx/tk/PlatformImage.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/com/sun/javafx/tk/PlatformImage.java	Tue Jun 12 10:07:03 2012 -0700
@@ -26,7 +26,10 @@
 package com.sun.javafx.tk;
 
 import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
 import javafx.scene.image.PixelFormat;
+import javafx.scene.image.PixelReader;
 import javafx.scene.image.WritablePixelFormat;
 
 /**
@@ -50,21 +53,6 @@
     public void setArgb(int x, int y, int argb);
 
     /**
-     * @param x X coordinate of pixel
-     * @param y Y coordinate of pixel
-     * @return the premultiplied pixel in integer ARGB component ordering.
-     */
-    public int getArgbPre(int x, int y);
-
-    /**
-     * @param x X coordinate of pixel
-     * @param y Y coordinate of pixel
-     * @param argbpre premultiplied pixel data to store in integer ARGB
-     *  component ordering
-     */
-    public void setArgbPre(int x, int y, int argbpre);
-
-    /**
      * @return the PixelFormat to use for the pixel data transfer methods
      * getPixels() and setPixels().
      */
@@ -73,13 +61,30 @@
     public boolean isWritable();
     public PlatformImage promoteToWritableImage();
 
-    public <T extends Buffer>
-        void getPixels(int x, int y, int w, int h,
-                       T pixels, WritablePixelFormat<T> pixelformat,
-                       int scanlineBytes);
-    
-    public <T extends Buffer>
-        void setPixels(int x, int y, int w, int h,
-                       T pixels, PixelFormat<T> pixelformat,
-                       int scanlineBytes);
+    public <T extends Buffer> void getPixels(int x, int y, int w, int h,
+                                             WritablePixelFormat<T> pixelformat,
+                                             T pixels, int scanlineElems);
+
+    public void getPixels(int x, int y, int w, int h,
+                          WritablePixelFormat<ByteBuffer> pixelformat,
+                          byte pixels[], int offset, int scanlineBytes);
+
+    public void getPixels(int x, int y, int w, int h,
+                          WritablePixelFormat<IntBuffer> pixelformat,
+                          int pixels[], int offset, int scanlineInts);
+
+    public <T extends Buffer> void setPixels(int x, int y, int w, int h,
+                                             PixelFormat<T> pixelformat,
+                                             T pixels, int scanlineBytes);
+
+    public void setPixels(int x, int y, int w, int h,
+                          PixelFormat<ByteBuffer> pixelformat,
+                          byte pixels[], int offset, int scanlineBytes);
+
+    public void setPixels(int x, int y, int w, int h,
+                          PixelFormat<IntBuffer> pixelformat,
+                          int pixels[], int offset, int scanlineInts);
+
+    public void setPixels(int dstx, int dsty, int w, int h,
+                          PixelReader reader, int srcx, int srcy);
 }
--- a/javafx-ui-common/src/javafx/scene/Node.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/Node.java	Tue Jun 12 10:07:03 2012 -0700
@@ -6151,7 +6151,7 @@
      */
     final class FocusedProperty extends ReadOnlyBooleanPropertyBase {
         private boolean value;
-        private boolean valid;
+        private boolean valid = true;
         private boolean needsChangeEvent = false;
 
         public void store(final boolean value) {
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Tue Jun 12 10:07:03 2012 -0700
@@ -1051,7 +1051,10 @@
      */
     @Deprecated
     public Object renderToImage(Object platformImage, float scale) {
-        Toolkit.getToolkit().checkFxUserThread();
+        if (!paused) {
+            Toolkit.getToolkit().checkFxUserThread();
+        }
+
         // NOTE: that we no longer use the passed in platform image. Since this
         // API is deprecated and will be removed in 3.0 this is not a concern.
         // Also, we used to return a TK image loader and now we return
@@ -1234,7 +1237,10 @@
      * @return the rendered image
      */
     public WritableImage snapshot(WritableImage image) {
-        Toolkit.getToolkit().checkFxUserThread();
+        if (!paused) {
+            Toolkit.getToolkit().checkFxUserThread();
+        }
+
         return  doSnapshot(image, 1.0f);
     }
 
@@ -1635,6 +1641,10 @@
                         break;
                 }
 
+                for (TouchPoint t : touchPoints) {
+                    t.impl_reset();
+                }
+
                 TouchEvent te = TouchEvent.impl_touchEvent(type, tp, touchList,
                         touchEventSetId, e.isShiftDown(), e.isControlDown(),
                         e.isAltDown(), e.isMetaDown());
@@ -2451,7 +2461,8 @@
                 throw new RuntimeException("Too many touch points reported");
             }
 
-            touchPoints[order] = new TouchPoint(id, state, x, y, xAbs, yAbs);
+            touchPoints[order] = TouchPoint.impl_touchPoint(id, state,
+                    x, y, xAbs, yAbs);
         }
 
         @Override
--- a/javafx-ui-common/src/javafx/scene/canvas/Canvas.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/canvas/Canvas.java	Tue Jun 12 10:07:03 2012 -0700
@@ -251,7 +251,9 @@
     @Deprecated
     @Override
     public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx) {
-        return new RectBounds(0f, 0f, (float) getWidth(), (float) getHeight());
+        bounds = new RectBounds(0f, 0f, (float) getWidth(), (float) getHeight());  
+        bounds = tx.transform(bounds, bounds);
+        return bounds;
     }
 
     /**
--- a/javafx-ui-common/src/javafx/scene/canvas/GraphicsContext.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/canvas/GraphicsContext.java	Tue Jun 12 10:07:03 2012 -0700
@@ -29,6 +29,15 @@
 import com.sun.javafx.geom.PathIterator;
 import com.sun.javafx.geom.transform.Affine2D;
 import com.sun.javafx.geom.transform.NoninvertibleTransformException;
+import com.sun.javafx.image.BytePixelGetter;
+import com.sun.javafx.image.BytePixelSetter;
+import com.sun.javafx.image.ByteToBytePixelConverter;
+import com.sun.javafx.image.IntPixelGetter;
+import com.sun.javafx.image.IntToBytePixelConverter;
+import com.sun.javafx.image.PixelConverter;
+import com.sun.javafx.image.PixelGetter;
+import com.sun.javafx.image.PixelUtils;
+import com.sun.javafx.image.impl.ByteBgraPre;
 import com.sun.javafx.sg.GrowableDataBuffer;
 import com.sun.javafx.sg.PGCanvas;
 import java.nio.Buffer;
@@ -788,10 +797,25 @@
     }
 
     /**
-     * Sets the current TextAlignment attribute
+     * Defines horizontal text alignment, relative to the text {@code x} origin.
+     * <p>
+     * Let horizontal bounds represent the logical width of a single line of
+     * text. Where each line of text has a separate horizontal bounds.
+     * <p>
+     * Then TextAlignment is specified as:
+     * <ul>
+     * <li>Left: the left edge of the horizontal bounds will be at {@code x}.
+     * <li>Center: the center, halfway between left and right edge, of the 
+     * horizontal bounds will be at {@code x}.
+     * <li>Right: the right edge of the horizontal bounds will be at {@code x}.
+     * </ul>
+     * <p>
+     *
+     * Note: Canvas does not support line wrapping, therefore the text
+     * alignment Justify is identical to left aligned text.
+     * <p>
      * 
-     * @param align {@code TextAlignment} with values of Left, Center, Right, or
-     * Justify.
+     * @param align {@code TextAlignment} with values of Left, Center, Right.
      */
     public void setTextAlign(TextAlignment align) {
         if (curState.textalign != align) {
@@ -1655,6 +1679,10 @@
                     return PixelFormat.getByteBgraPreInstance();
                 }
 
+                private BytePixelSetter getSetter() {
+                    return ByteBgraPre.setter;
+                }
+
                 @Override
                 public void setArgb(int x, int y, int argb) {
                     GrowableDataBuffer buf = getBuffer();
@@ -1673,18 +1701,98 @@
                     setArgb(x, y, (a << 24) | (r << 16) | (g << 8) | b);
                 }
 
+                private void writePixelBuffer(int x, int y, int w, int h,
+                                              byte[] pixels)
+                {
+                    GrowableDataBuffer buf = getBuffer();
+                    buf.putByte(PGCanvas.PUT_ARGBPRE_BUF);
+                    buf.putInt(x);
+                    buf.putInt(y);
+                    buf.putInt(w);
+                    buf.putInt(h);
+                    buf.putObject(pixels);
+                }
+
+                private int[] checkBounds(int x, int y, int w, int h,
+                                          PixelFormat pf, int scan)
+                {
+                    // assert (w >= 0 && h >= 0) - checked by caller
+                    int cw = (int) theCanvas.getWidth();
+                    int ch = (int) theCanvas.getHeight();
+                    if (x >= 0 && y >= 0 && x+w <= cw && y+h <= ch) {
+                        return null;
+                    }
+                    int offset = 0;
+                    if (x < 0) {
+                        w += x;
+                        if (w < 0) return null;
+                        if (pf != null) {
+                            switch (pf.getType()) {
+                                case BYTE_BGRA:
+                                case BYTE_BGRA_PRE:
+                                    offset -= x * 4;
+                                    break;
+                                case BYTE_RGB:
+                                    offset -= x * 3;
+                                    break;
+                                case BYTE_INDEXED:
+                                case INT_ARGB:
+                                case INT_ARGB_PRE:
+                                    offset -= x;
+                                    break;
+                                default:
+                                    throw new InternalError("unknown Pixel Format");
+                            }
+                        }
+                        x = 0;
+                    }
+                    if (y < 0) {
+                        h += y;
+                        if (h < 0) return null;
+                        offset -= y * scan;
+                        y = 0;
+                    }
+                    if (x + w > cw) {
+                        w = cw - x;
+                        if (w < 0) return null;
+                    }
+                    if (y + h > ch) {
+                        h = ch - y;
+                        if (h < 0) return null;
+                    }
+                    return new int[] {
+                        x, y, w, h, offset
+                    };
+                }
+
                 @Override
                 public <T extends Buffer> void
                     setPixels(int x, int y, int w, int h,
                               PixelFormat<T> pixelformat,
                               T buffer, int scan)
                 {
-                    for (int j = 0; j < h; j++) {
-                        for (int i = 0; i < w; i++) {
-                            int argb = pixelformat.getArgb(buffer, i, j, scan);
-                            setArgb(x + i, y + j, argb);
-                        }
+                    if (w <= 0 || h <= 0) return;
+                    int offset = buffer.position();
+                    int adjustments[] = checkBounds(x, y, w, h,
+                                                    pixelformat, scan);
+                    if (adjustments != null) {
+                        x = adjustments[0];
+                        y = adjustments[1];
+                        w = adjustments[2];
+                        h = adjustments[3];
+                        offset += adjustments[4];
                     }
+
+                    byte pixels[] = new byte[w * h * 4];
+                    ByteBuffer dst = ByteBuffer.wrap(pixels);
+
+                    PixelGetter<T> getter = PixelUtils.getGetter(pixelformat);
+                    PixelConverter<T, ByteBuffer> converter =
+                        PixelUtils.getConverter(getter, getSetter());
+                    converter.convert(buffer, offset, scan,
+                                      dst, 0, w * 4,
+                                      w, h);
+                    writePixelBuffer(x, y, w, h, pixels);
                 }
 
                 @Override
@@ -1692,9 +1800,26 @@
                                       PixelFormat<ByteBuffer> pixelformat,
                                       byte[] buffer, int offset, int scanlineStride)
                 {
-                    ByteBuffer bytebuf = ByteBuffer.wrap(buffer);
-                    bytebuf.position(offset);
-                    setPixels(x, y, w, h, pixelformat, bytebuf, scanlineStride);
+                    if (w <= 0 || h <= 0) return;
+                    int adjustments[] = checkBounds(x, y, w, h,
+                                                    pixelformat, scanlineStride);
+                    if (adjustments != null) {
+                        x = adjustments[0];
+                        y = adjustments[1];
+                        w = adjustments[2];
+                        h = adjustments[3];
+                        offset += adjustments[4];
+                    }
+
+                    byte pixels[] = new byte[w * h * 4];
+
+                    BytePixelGetter getter = PixelUtils.getByteGetter(pixelformat);
+                    ByteToBytePixelConverter converter =
+                        PixelUtils.getB2BConverter(getter, getSetter());
+                    converter.convert(buffer, offset, scanlineStride,
+                                      pixels, 0, w * 4,
+                                      w, h);
+                    writePixelBuffer(x, y, w, h, pixels);
                 }
 
                 @Override
@@ -1702,21 +1827,50 @@
                                       PixelFormat<IntBuffer> pixelformat,
                                       int[] buffer, int offset, int scanlineStride)
                 {
-                    IntBuffer bytebuf = IntBuffer.wrap(buffer);
-                    bytebuf.position(offset);
-                    setPixels(x, y, w, h, pixelformat, bytebuf, scanlineStride);
+                    if (w <= 0 || h <= 0) return;
+                    int adjustments[] = checkBounds(x, y, w, h,
+                                                    pixelformat, scanlineStride);
+                    if (adjustments != null) {
+                        x = adjustments[0];
+                        y = adjustments[1];
+                        w = adjustments[2];
+                        h = adjustments[3];
+                        offset += adjustments[4];
+                    }
+
+                    byte pixels[] = new byte[w * h * 4];
+
+                    IntPixelGetter getter = PixelUtils.getIntGetter(pixelformat);
+                    IntToBytePixelConverter converter =
+                        PixelUtils.getI2BConverter(getter, getSetter());
+                    converter.convert(buffer, offset, scanlineStride,
+                                      pixels, 0, w * 4,
+                                      w, h);
+                    writePixelBuffer(x, y, w, h, pixels);
                 }
 
                 @Override
                 public void setPixels(int dstx, int dsty, int w, int h,
                                       PixelReader reader, int srcx, int srcy)
                 {
-                    for (int j = 0; j < h; j++) {
-                        for (int i = 0; i < w; i++) {
-                            int argb = reader.getArgb(srcx + i, srcy + j);
-                            setArgb(dstx + i, dsty + j, argb);
-                        }
+                    if (w <= 0 || h <= 0) return;
+                    int adjustments[] = checkBounds(dstx, dsty, w, h, null, 0);
+                    if (adjustments != null) {
+                        int newx = adjustments[0];
+                        int newy = adjustments[1];
+                        srcx += newx - dstx;
+                        srcy += newy - dsty;
+                        dstx = newx;
+                        dsty = newy;
+                        w = adjustments[2];
+                        h = adjustments[3];
                     }
+
+                    byte pixels[] = new byte[w * h * 4];
+                    reader.getPixels(srcx, srcy, w, h,
+                                     PixelFormat.getByteBgraPreInstance(),
+                                     pixels, 0, w * 4);
+                    writePixelBuffer(dstx, dsty, w, h, pixels);
                 }
             };
         }
--- a/javafx-ui-common/src/javafx/scene/image/Image.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/image/Image.java	Tue Jun 12 10:07:03 2012 -0700
@@ -647,18 +647,18 @@
     }
 
     /**
-     * Construct a new empty {@code Image} with the specified dimensions
-     * filled with transparent pixels to be used with the
-     * {@link #setArgb(int, int, int) setArgb()}
-     * and
-     * {@link #setColor(int, int, javafx.scene.paint.Color) setColor()}
-     * methods to create a completely custom image.
+     * Package private internal constructor used only by {@link WritableImage}.
+     * The dimensions must both be positive numbers <code>(&gt;&nbsp;0)</code>.
      * 
      * @param width the width of the empty image
      * @param height the height of the empty image
+     * @throws IllegalArgumentException if either dimension is negative or zero.
      */
     Image(int width, int height) {
         this(null, null, width, height, false, false, false);
+        if (width <= 0 || height <= 0) {
+            throw new IllegalArgumentException("Image dimensions must be positive (w,h > 0)");
+        }
         initialize(Toolkit.getToolkit().createPlatformImage(width, height));
     }
 
@@ -1091,7 +1091,7 @@
      * 
      * @return the {@code PixelReader} for reading the pixel data of the image
      */
-    public PixelReader getPixelReader() {
+    public final PixelReader getPixelReader() {
         if (!pixelsReadable()) {
             return null;
         }
@@ -1100,9 +1100,6 @@
                 @Override
                 public PixelFormat getPixelFormat() {
                     PlatformImage pimg = platformImage.get();
-//                    if (pimg == null) {
-//                        return null;
-//                    }
                     return pimg.getPlatformPixelFormat();
                 }
 
@@ -1129,14 +1126,8 @@
                                    T buffer, int scanlineStride)
                 {
                     PlatformImage pimg = platformImage.get();
-                    for (int j = 0; j < h; j++) {
-                        for (int i = 0; i < w; i++) {
-                            pixelformat.setArgb(buffer, i, j, scanlineStride,
-                                                pimg.getArgb(x+i, y+j));
-                        }
-                    }
-//                    checkPixelAccess(true, false).getPixels(x, y, w, h,
-//                                                            buffer, pixelformat, scanlineStride);
+                    pimg.getPixels(x, y, w, h, pixelformat,
+                                   buffer, scanlineStride);
                 }
 
                 @Override
@@ -1144,11 +1135,9 @@
                                     WritablePixelFormat<ByteBuffer> pixelformat,
                                     byte buffer[], int offset, int scanlineStride)
                 {
-                    ByteBuffer bytebuf = ByteBuffer.wrap(buffer);
-                    bytebuf.position(offset);
-                    getPixels(x, y, w, h, pixelformat, bytebuf, scanlineStride);
-//                    checkPixelAccess(true, false).getPixels(x, y, w, h,
-//                                                            buffer, pixelformat, scanlineStride);
+                    PlatformImage pimg = platformImage.get();
+                    pimg.getPixels(x, y, w, h, pixelformat,
+                                   buffer, offset, scanlineStride);
                 }
 
                 @Override
@@ -1156,11 +1145,9 @@
                                     WritablePixelFormat<IntBuffer> pixelformat,
                                     int buffer[], int offset, int scanlineStride)
                 {
-                    IntBuffer intbuf = IntBuffer.wrap(buffer);
-                    intbuf.position(offset);
-                    getPixels(x, y, w, h, pixelformat, intbuf, scanlineStride);
-//                    checkPixelAccess(true, false).getPixels(x, y, w, h,
-//                                                            buffer, pixelformat, scanlineStride);
+                    PlatformImage pimg = platformImage.get();
+                    pimg.getPixels(x, y, w, h, pixelformat,
+                                   buffer, offset, scanlineStride);
                 }
             };
         }
@@ -1171,6 +1158,7 @@
         PlatformImage pimg = platformImage.get();
         if (!pimg.isWritable()) {
             pimg = pimg.promoteToWritableImage();
+            // assert pimg.isWritable();
             platformImage.set(pimg);
         }
         return pimg;
--- a/javafx-ui-common/src/javafx/scene/image/WritableImage.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/image/WritableImage.java	Tue Jun 12 10:07:03 2012 -0700
@@ -62,9 +62,11 @@
      * Images constructed this way will always be readable and writable
      * so the corresponding getPixelReader() and getPixelWriter() will
      * always return valid objects.
+     * The dimensions must both be positive numbers <code>(&gt;&nbsp;0)</code>.
      * 
      * @param width the desired width of the writable image
      * @param height the desired height of the desired image
+     * @throws IllegalArgumentException if either dimension is negative or zero.
      */
     public WritableImage(int width, int height) {
         super(width, height);
@@ -81,6 +83,7 @@
      * Images constructed this way will always be readable and writable
      * so the corresponding getPixelReader() and getPixelWriter() will
      * always return valid objects.
+     * The dimensions must both be positive numbers <code>(&gt;&nbsp;0)</code>.
      * 
      * @param width the desired width of the writable image and the
      *        width of the region to be read from the {@code reader}
@@ -88,6 +91,7 @@
      *        width of the region to be read from the {@code reader}
      * @throws ArrayIndexOutOfBoundsException if the {@code reader} does
      *         not access a surface of at least the requested dimensions
+     * @throws IllegalArgumentException if either dimension is negative or zero.
      */
     public WritableImage(PixelReader reader, int width, int height) {
         super(width, height);
@@ -105,6 +109,7 @@
      * Images constructed this way will always be readable and writable
      * so the corresponding getPixelReader() and getPixelWriter() will
      * always return valid objects.
+     * The dimensions must both be positive numbers <code>(&gt;&nbsp;0)</code>.
      * 
      * @param x the X coordinate of the upper left corner of the region to
      *        read from the {@code reader}
@@ -116,6 +121,7 @@
      *        width of the region to be read from the {@code reader}
      * @throws ArrayIndexOutOfBoundsException if the {@code reader} does
      *         not access a surface containing at least the indicated region
+     * @throws IllegalArgumentException if either dimension is negative or zero.
      */
     public WritableImage(PixelReader reader,
                          int x, int y, int width, int height)
@@ -141,7 +147,7 @@
      * 
      * @return the {@code PixelWriter} for writing pixels to the image
      */
-    public PixelWriter getPixelWriter() {
+    public final PixelWriter getPixelWriter() {
         if (getProgress() < 1.0 || isError()) {
             return null;
         }
@@ -178,15 +184,8 @@
                                    T buffer, int scanlineStride)
                 {
                     PlatformImage pimg = getWritablePlatformImage();
-                    for (int j = 0; j < h; j++) {
-                        for (int i = 0; i < w; i++) {
-                            int argb = pixelformat.getArgb(buffer, i, j,
-                                                           scanlineStride);
-                            pimg.setArgb(x+i, y+j, argb);
-                        }
-                    }
-//                    checkPixelAccess(true, true).setPixels(x, y, w, h,
-//                                                           buffer, pixelformat, scanlineStride);
+                    pimg.setPixels(x, y, w, h, pixelformat,
+                                   buffer, scanlineStride);
                     pixelsDirty();
                 }
 
@@ -195,11 +194,10 @@
                                       PixelFormat<ByteBuffer> pixelformat,
                                       byte buffer[], int offset, int scanlineStride)
                 {
-                    ByteBuffer bytebuf = ByteBuffer.wrap(buffer);
-                    bytebuf.position(offset);
-                    setPixels(x, y, w, h, pixelformat, bytebuf, scanlineStride);
-//                    checkPixelAccess(true, false).getPixels(x, y, w, h,
-//                                                            buffer, pixelformat, scanlineStride);
+                    PlatformImage pimg = getWritablePlatformImage();
+                    pimg.setPixels(x, y, w, h, pixelformat,
+                                   buffer, offset, scanlineStride);
+                    pixelsDirty();
                 }
 
                 @Override
@@ -207,23 +205,19 @@
                                       PixelFormat<IntBuffer> pixelformat,
                                       int buffer[], int offset, int scanlineStride)
                 {
-                    IntBuffer intbuf = IntBuffer.wrap(buffer);
-                    intbuf.position(offset);
-                    setPixels(x, y, w, h, pixelformat, intbuf, scanlineStride);
-//                    checkPixelAccess(true, false).getPixels(x, y, w, h,
-//                                                            buffer, pixelformat, scanlineStride);
+                    PlatformImage pimg = getWritablePlatformImage();
+                    pimg.setPixels(x, y, w, h, pixelformat,
+                                   buffer, offset, scanlineStride);
+                    pixelsDirty();
                 }
 
                 @Override
                 public void setPixels(int writex, int writey, int w, int h,
                                       PixelReader reader, int readx, int ready)
                 {
-                    for (int y = 0; y < h; y++) {
-                        for (int x = 0; x < w; x++) {
-                            setArgb(writex + x, writey + y,
-                                    reader.getArgb(readx + x, ready + y));
-                        }
-                    }
+                    PlatformImage pimg = getWritablePlatformImage();
+                    pimg.setPixels(writex, writey, w, h, reader, readx, ready);
+                    pixelsDirty();
                 }
             };
         }
--- a/javafx-ui-common/src/javafx/scene/input/ContextMenuEvent.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/input/ContextMenuEvent.java	Tue Jun 12 10:07:03 2012 -0700
@@ -81,12 +81,10 @@
     private void recomputeCoordinatesToSource(ContextMenuEvent newEvent, Object newSource) {
 
         final Point2D newCoordinates = InputEventUtils.recomputeCoordinates(
-                new Point2D(x, y), source, newSource);
+                new Point2D(sceneX, sceneY), null, newSource);
 
         newEvent.x = newCoordinates.getX();
         newEvent.y = newCoordinates.getY();
-        newEvent.sceneX = getSceneX();
-        newEvent.sceneY = getSceneY();
     }
 
     @Override
--- a/javafx-ui-common/src/javafx/scene/input/DragEvent.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/input/DragEvent.java	Tue Jun 12 10:07:03 2012 -0700
@@ -409,7 +409,7 @@
         }
 
         final Point2D newCoordinates = InputEventUtils.recomputeCoordinates(
-                new Point2D(x, y), source, newSource);
+                new Point2D(sceneX, sceneY), null, newSource);
 
         newEvent.x = newCoordinates.getX();
         newEvent.y = newCoordinates.getY();
--- a/javafx-ui-common/src/javafx/scene/input/GestureEvent.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/input/GestureEvent.java	Tue Jun 12 10:07:03 2012 -0700
@@ -91,12 +91,10 @@
     private void recomputeCoordinatesToSource(GestureEvent newEvent, Object newSource) {
 
         final Point2D newCoordinates = InputEventUtils.recomputeCoordinates(
-                new Point2D(x, y), source, newSource);
+                new Point2D(sceneX, sceneY), null, newSource);
 
         newEvent.x = newCoordinates.getX();
         newEvent.y = newCoordinates.getY();
-        newEvent.sceneX = getSceneX();
-        newEvent.sceneY = getSceneY();
     }
 
     /**
--- a/javafx-ui-common/src/javafx/scene/input/MouseEvent.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/input/MouseEvent.java	Tue Jun 12 10:07:03 2012 -0700
@@ -272,12 +272,10 @@
     private void recomputeCoordinatesToSource(MouseEvent newEvent, Object newSource) {
 
         final Point2D newCoordinates = InputEventUtils.recomputeCoordinates(
-                new Point2D(x, y), source, newSource);
+                new Point2D(sceneX, sceneY), null, newSource);
 
         newEvent.x = newCoordinates.getX();
         newEvent.y = newCoordinates.getY();
-        newEvent.sceneX = getSceneX();
-        newEvent.sceneY = getSceneY();
     }
 
     /**
@@ -352,6 +350,9 @@
                         : (EventType<? extends MouseEvent>)
                                 evt.getEventType()));
 
+        copyEvent.sceneX = evt.sceneX;
+        copyEvent.sceneY = evt.sceneY;
+
         evt.recomputeCoordinatesToSource(copyEvent, source);
         return copyEvent;
     }
--- a/javafx-ui-common/src/javafx/scene/input/TouchPoint.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/input/TouchPoint.java	Tue Jun 12 10:07:03 2012 -0700
@@ -53,7 +53,7 @@
     private EventTarget target;
     private Object source;
 
-    public TouchPoint(int id, State state, double x, double y, double screenX,
+    private TouchPoint(int id, State state, double x, double y, double screenX,
             double screenY) {
         this.target = null;
         this.id = id;
@@ -75,7 +75,7 @@
     void recomputeToSource(Object oldSource, Object newSource) {
 
         final Point2D newCoordinates = InputEventUtils.recomputeCoordinates(
-                new Point2D(x, y), oldSource, newSource);
+                new Point2D(sceneX, sceneY), null, newSource);
 
         x = newCoordinates.getX();
         y = newCoordinates.getY();
@@ -120,6 +120,16 @@
         this.target = target;
     }
 
+    /**
+     * @treatAsPrivate implementation detail
+     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+     */
+    @Deprecated
+    public void impl_reset() {
+        x = sceneX;
+        y = sceneY;
+    }
+
     private EventTarget grabbed = null;
 
     /**
@@ -283,6 +293,16 @@
     }
 
     /**
+     * @treatAsPrivate implementation detail
+     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+     */
+    @Deprecated
+    public static TouchPoint impl_touchPoint(
+            int id, State state, double x, double y, double screenX, double screenY) {
+        return new TouchPoint(id, state, x, y, screenX, screenY);
+    }
+
+    /**
      * Represents current state of the touch point
      */
     public enum State {
--- a/javafx-ui-common/src/javafx/scene/text/Font.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/scene/text/Font.java	Tue Jun 12 10:07:03 2012 -0700
@@ -386,7 +386,7 @@
      * <code>Font</code> object will be returned.
      * <p>
      * Any failure such as abbreviated input, or an unsupported font format
-     * will result in a code>null</code> return. It is the application's
+     * will result in a <code>null</code> return. It is the application's
      * responsibility to check this before use.
      * <p>
      * On a successful (non-null) return the font will be registered
--- a/javafx-ui-common/src/javafx/stage/PopupWindow.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/src/javafx/stage/PopupWindow.java	Tue Jun 12 10:07:03 2012 -0700
@@ -339,6 +339,9 @@
 
     private void showImpl(final Window owner) {
         if (isShowing()) {
+            if (autofixHandler != null) {
+                autofixHandler.adjustPosition();
+            }
             return;
         }
 
@@ -349,8 +352,7 @@
         }
 
         // It is required that the root window exist and be visible to show the popup.
-        Window rootWindow = getRootWindow(getOwnerWindow());
-        if (rootWindow != null && rootWindow.isShowing()) {
+        if (getRootWindow(owner).isShowing()) {
             // We do show() first so that the width and height of the
             // popup window are initialized. This way the x,y location of the
             // popup calculated below uses the right width and height values for
@@ -397,7 +399,7 @@
         }
     }
 
-    private Window focusGrabWindow;
+    private Window rootWindow;
 
     /**
      * @treatAsPrivate implementation detail
@@ -413,6 +415,8 @@
 
         final Window ownerWindowValue = getOwnerWindow();
         if (visible) {
+            rootWindow = getRootWindow(ownerWindowValue);
+
             startMonitorOwnerEvents(ownerWindowValue);
             // currently we consider popup window to be focused when it is
             // visible and its owner window is focused (we need to track
@@ -421,17 +425,15 @@
             // track focus state across multiple windows
             bindOwnerFocusedProperty(ownerWindowValue);
             setFocused(ownerWindowValue.isFocused());
-            focusGrabWindow = increaseFocusGrabInRootWindow(ownerWindowValue);
             handleAutofixActivation(true, isAutoFix());
+            rootWindow.impl_increaseFocusGrabCounter();
         } else {
             stopMonitorOwnerEvents(ownerWindowValue);
             unbindOwnerFocusedProperty(ownerWindowValue);
             setFocused(false);
-            if (focusGrabWindow != null) {
-                focusGrabWindow.impl_decreaseFocusGrabCounter();
-                focusGrabWindow = null;
-            }
             handleAutofixActivation(false, isAutoFix());
+            rootWindow.impl_decreaseFocusGrabCounter();
+            rootWindow = null;
         }
 
         PerformanceTracker.logEvent("PopupWindow.storeVisible for [PopupWindow] finished");
@@ -506,15 +508,6 @@
         parentEventRedirector.removeEventDispatcher(getEventDispatcher());
     }
 
-    private Window increaseFocusGrabInRootWindow(final Window ownerWindow) {
-        final Window rootWindow = getRootWindow(ownerWindow);
-        if (rootWindow != null) {
-            rootWindow.impl_increaseFocusGrabCounter();
-        }
-
-        return rootWindow;
-    }
-
     private ChangeListener<Boolean> ownerFocusedListener;
 
     private void bindOwnerFocusedProperty(final Window ownerWindowValue) {
@@ -607,7 +600,10 @@
         public void adjustPosition() {
             final Screen currentScreen =
                     Utils.getScreenForPoint(getX(), getY());
-            final Rectangle2D screenBounds = currentScreen.getVisualBounds();
+            final Rectangle2D screenBounds =
+                    Utils.hasFullScreenStage(currentScreen)
+                            ? currentScreen.getBounds()
+                            : currentScreen.getVisualBounds();
             double _x = Math.min(getX(), screenBounds.getMaxX() - getWidth());
             double _y = Math.min(getY(), screenBounds.getMaxY() - getHeight());
             _x = Math.max(_x, screenBounds.getMinX());
--- a/javafx-ui-common/test/unit/javafx/scene/MouseTest.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/test/unit/javafx/scene/MouseTest.java	Tue Jun 12 10:07:03 2012 -0700
@@ -911,7 +911,7 @@
     }
 
     @Test
-    public void NodeMovementsWithStillMouseShouldFireEnteredExited() {
+    public void nodeMovementsWithStillMouseShouldFireEnteredExited() {
         SimpleTestScene scene = new SimpleTestScene();
         MouseEventGenerator generator = new MouseEventGenerator();
 
@@ -934,6 +934,34 @@
         assertTrue(scene.smallSquareTracker.enteredMe);
     }
 
+    @Test
+    public void nodeWithNoninvertibleTransformShouldGetNanCoords() {
+        SimpleTestScene scene = new SimpleTestScene();
+        MouseEventGenerator generator = new MouseEventGenerator();
+
+        scene.processEvent(generator.generateMouseEvent(
+                MouseEvent.MOUSE_PRESSED, 250, 250));
+        scene.smallSquareTracker.clear();
+
+        scene.smallSquareTracker.node.addEventHandler(MouseEvent.MOUSE_RELEASED,
+                new EventHandler<MouseEvent>() {
+
+            @Override public void handle(MouseEvent event) {
+                assertEquals(Double.NaN, event.getX(), 0.0001);
+                assertEquals(Double.NaN, event.getY(), 0.0001);
+                assertEquals(251.0, event.getSceneX(), 0.0001);
+                assertEquals(251.0, event.getSceneY(), 0.0001);
+            }
+        });
+
+        ((Rectangle) scene.smallSquareTracker.node).setScaleX(0);
+
+        scene.processEvent(generator.generateMouseEvent(
+                MouseEvent.MOUSE_RELEASED, 251, 251));
+
+        assertTrue(scene.smallSquareTracker.released);
+    }
+
     private static class SimpleTestScene {
 
         MouseEventTracker sceneTracker;
--- a/javafx-ui-common/test/unit/javafx/scene/canvas/CanvasTest.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/test/unit/javafx/scene/canvas/CanvasTest.java	Tue Jun 12 10:07:03 2012 -0700
@@ -25,7 +25,14 @@
 package javafx.scene.canvas;
 
 import javafx.scene.NodeTest;
+import javafx.scene.effect.BlendMode;
+import javafx.scene.paint.Color;
 import javafx.scene.shape.ArcType;
+import javafx.scene.shape.StrokeLineCap;
+import javafx.scene.shape.StrokeLineJoin;
+import javafx.scene.transform.Affine;
+import javafx.scene.transform.Rotate;
+import javafx.scene.transform.Transform;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
@@ -200,13 +207,165 @@
     
     
     
-    @Test public void testGCState_basic() throws Exception {
-        //need getters
+    @Test public void testGCState_Translate() throws Exception {
         Canvas node = new Canvas();
         GraphicsContext gc = node.getGraphicsContext2D();
         
         gc.translate(50, 50);
+        Affine result = gc.getTransform();
+        Affine expected = new Affine();
+        
+        expected.setTx(50);
+        expected.setTy(50);
+        
+        assertMatrix(result, expected);
     }
     
-            
+    @Test public void testGCState_Scale() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        gc.scale(3, 3);
+        Affine result = gc.getTransform();
+        Affine expected = new Affine();
+        
+        expected.setMxx(3);
+        expected.setMyy(3);
+        
+        assertMatrix(result, expected);
+    }
+
+    @Test public void testGCState_Rotate() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        gc.rotate(45.0);
+        Affine result = gc.getTransform();
+        
+        Rotate expected = new Rotate(45, 0, 0);
+                
+        assertMatrix(result, expected);
+    }
+
+    @Test public void testGCState_getTransform() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+
+        Affine expected = new Affine();
+        gc.setTransform(expected);
+        Affine result = gc.getTransform();
+        
+        assertMatrix(result, expected);
+        
+        gc.setTransform(expected.getMxx(), expected.getMyx(), expected.getMxy(), 
+                expected.getMyy(), expected.getTx(), expected.getTy());
+        
+        Affine result2 = gc.getTransform();
+        
+        assertMatrix(result2, expected);        
+    }
+
+    @Test public void testGCState_FillStrokeSaveRestore() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        Affine expected = new Affine();
+        gc.setTransform(expected);
+        Affine result = gc.getTransform();
+        
+        assertMatrix(result, expected);
+        
+        gc.setFill(Color.BLACK);
+        assertEquals(Color.BLACK, gc.getFill());
+        gc.save();
+        gc.setFill(Color.RED);
+        assertEquals(gc.getFill(), Color.RED);
+        gc.restore();
+        assertEquals(Color.BLACK, gc.getFill());
+        gc.setStroke(Color.BLACK);
+        assertEquals(Color.BLACK, gc.getStroke());
+        gc.save();
+        gc.setStroke(Color.RED);
+        assertEquals(gc.getStroke(), Color.RED);
+        gc.restore();
+        assertEquals(Color.BLACK, gc.getStroke());
+        assertMatrix(result, expected);
+    }
+
+    @Test public void testGCState_Line() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        gc.setLineCap(StrokeLineCap.BUTT);
+        gc.setLineJoin(StrokeLineJoin.MITER);
+        gc.setLineWidth(5);
+        gc.setMiterLimit(3);
+        
+        gc.save();
+        gc.setLineCap(StrokeLineCap.ROUND);
+        gc.setLineJoin(StrokeLineJoin.BEVEL);
+        gc.setLineWidth(1);
+        gc.setMiterLimit(1);
+        assertEquals(gc.getLineCap(), StrokeLineCap.ROUND);
+        assertEquals(gc.getLineJoin(), StrokeLineJoin.BEVEL);
+        assertEquals(gc.getLineWidth(), 1, 0.00001);
+        assertEquals(gc.getMiterLimit(), 1, 0.00001);
+        gc.restore();
+        
+        assertEquals(gc.getLineCap(), StrokeLineCap.BUTT);
+        assertEquals(gc.getLineJoin(), StrokeLineJoin.MITER);
+        assertEquals(gc.getLineWidth(), 5, 0.00001);
+        assertEquals(gc.getMiterLimit(), 3, 0.00001);
+    }
+
+    @Test (expected=NullPointerException.class) 
+    public void testGCState_LineNull() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        gc.setLineCap(null);     
+    }
+
+    @Test (expected=NullPointerException.class) 
+    public void testGCState_LineNull2() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        gc.setLineJoin(null);      
+    }
+
+    @Test public void testGCState_BlendMode() throws Exception {
+        Canvas node = new Canvas();
+        GraphicsContext gc = node.getGraphicsContext2D();
+        
+        gc.setGlobalBlendMode(BlendMode.ADD);
+        gc.setGlobalAlpha(0);
+        
+        gc.save();
+        gc.setGlobalAlpha(0.5);
+        gc.setGlobalBlendMode(BlendMode.COLOR_BURN);
+        assertEquals(gc.getGlobalBlendMode(), BlendMode.COLOR_BURN);
+        assertEquals(gc.getGlobalAlpha(), 0.5, 0.000001);
+        gc.restore();
+        
+        assertEquals(BlendMode.ADD, gc.getGlobalBlendMode());
+        assertEquals(0, gc.getGlobalAlpha(), 0.000001);       
+    }
+
+    public static void assertMatrix(Transform expected,
+            Transform result) {
+        assertEquals(expected.getMxx(), result.getMxx(), 0.00001);
+        assertEquals(expected.getMxy(), result.getMxy(), 0.00001);
+        assertEquals(expected.getMxz(), result.getMxz(), 0.00001);
+        assertEquals(expected.getTx(), result.getTx(), 0.00001);
+        assertEquals(expected.getMyx(), result.getMyx(), 0.00001);
+        assertEquals(expected.getMyy(), result.getMyy(), 0.00001);
+        assertEquals(expected.getMyz(), result.getMyz(), 0.00001);
+        assertEquals(expected.getTy(), result.getTy(), 0.00001);
+        assertEquals(expected.getMzx(), result.getMzx(), 0.00001);
+        assertEquals(expected.getMzy(), result.getMzy(), 0.00001);
+        assertEquals(expected.getMzz(), result.getMzz(), 0.00001);
+        assertEquals(expected.getTz(), result.getTz(), 0.00001);
+    }  
 }
--- a/javafx-ui-common/test/unit/javafx/scene/input/TouchEventTest.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/test/unit/javafx/scene/input/TouchEventTest.java	Tue Jun 12 10:07:03 2012 -0700
@@ -1110,6 +1110,70 @@
     }
 
     @Test
+    public void pointsShouldBeTransformedCorrectly() {
+        Scene scene = createScene();
+        Rectangle rect =
+                (Rectangle) scene.getRoot().getChildrenUnmodifiable().get(0);
+        rect.setTranslateX(15);
+        rect.setTranslateY(5);
+
+        touched = 0;
+        rect.addEventHandler(TouchEvent.ANY, new EventHandler<TouchEvent>() {
+            @Override public void handle(TouchEvent event) {
+                touched++;
+                switch(touched) {
+                    case 1:
+                        assertEquals(115.0, event.getTouchPoint().getX(), 0.0001);
+                        assertEquals(125.0, event.getTouchPoint().getY(), 0.0001);
+                        assertEquals(130.0, event.getTouchPoint().getSceneX(), 0.0001);
+                        assertEquals(130.0, event.getTouchPoint().getSceneY(), 0.0001);
+                        break;
+                    case 2:
+                    case 3:
+                    case 4:
+                    case 5:
+                        assertEquals(115.0, event.getTouchPoints().get(0).getX(), 0.0001);
+                        assertEquals(125.0, event.getTouchPoints().get(0).getY(), 0.0001);
+                        assertEquals(130.0, event.getTouchPoints().get(0).getSceneX(), 0.0001);
+                        assertEquals(130.0, event.getTouchPoints().get(0).getSceneY(), 0.0001);
+                        assertEquals(125.0, event.getTouchPoints().get(1).getX(), 0.0001);
+                        assertEquals(135.0, event.getTouchPoints().get(1).getY(), 0.0001);
+                        assertEquals(140.0, event.getTouchPoints().get(1).getSceneX(), 0.0001);
+                        assertEquals(140.0, event.getTouchPoints().get(1).getSceneY(), 0.0001);
+                        break;
+                    default:
+                        fail("Wrong touch point id " + event.getTouchPoint().getId());
+                }
+            }
+        });
+
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventBegin(
+                System.currentTimeMillis(), 1, true, true, false, true, false);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventNext(
+                TouchPoint.State.PRESSED, 1, 130, 130, 130, 130);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventEnd();
+
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventBegin(
+                System.currentTimeMillis(), 2, true, true, false, true, false);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventNext(
+                TouchPoint.State.STATIONARY, 1, 130, 130, 130, 130);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventNext(
+                TouchPoint.State.PRESSED, 2, 140, 140, 140, 140);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventEnd();
+
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventBegin(
+                System.currentTimeMillis(), 2, true, true, false, true, false);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventNext(
+                TouchPoint.State.RELEASED, 1, 130, 130, 130, 130);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventNext(
+                TouchPoint.State.RELEASED, 2, 140, 140, 140, 140);
+        ((StubScene) scene.impl_getPeer()).getListener().touchEventEnd();
+
+
+        assertEquals(5, touched);
+    }
+
+    @Test
     public void shouldIgnoreIndirectTouchEvents() {
         Scene scene = createScene();
         Rectangle rect =
--- a/javafx-ui-common/test/unit/javafx/scene/input/TouchPoint_builder_Test.java	Tue Jun 12 16:55:59 2012 +1200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javafx.scene.input;
-
-import com.sun.javafx.test.BuilderTestBase;
-import java.util.Arrays;
-import java.util.Collection;
-import javafx.scene.shape.Rectangle;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public final class TouchPoint_builder_Test extends BuilderTestBase {
-    @Parameters
-    public static Collection data() {
-        BuilderTestBase.Configuration cfg = new BuilderTestBase.Configuration(TouchPoint.class);
-
-        cfg.addProperty("x", 1.0);
-        cfg.addProperty("y", 1.0);
-        cfg.addProperty("screenX", 1.0);
-        cfg.addProperty("screenY", 1.0);
-        cfg.addProperty("state", TouchPoint.State.MOVED);
-        cfg.addProperty("id", 1);
-
-        return Arrays.asList(new Object[] {
-            config(cfg)
-        });
-    }
-
-    public TouchPoint_builder_Test(final Configuration configuration) {
-        super(configuration);
-    }
-}
--- a/javafx-ui-common/test/unit/javafx/stage/PopupTest.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-common/test/unit/javafx/stage/PopupTest.java	Tue Jun 12 10:07:03 2012 -0700
@@ -67,6 +67,7 @@
 
     @After
     public void tearDown() {
+        stage.hide();
         toolkit.resetScreens();
     }
 
@@ -312,6 +313,25 @@
     }
 
     @Test
+    public void testDoubleShowAutofix() {
+        toolkit.setScreens(
+                new ScreenConfiguration(0, 0, 1920, 1200,
+                                        0, 200, 1920, 1000,
+                                        96));
+
+        final Popup popup = new Popup();
+        popup.getContent().add(new Rectangle(0, 0, 50, 50));
+
+        popup.show(stage, 1900, 100);
+        assertEquals(1920, popup.getX() + popup.getWidth(), 1e-100);
+        assertEquals(200, popup.getY(), 1e-100);
+
+        popup.show(stage, 1900, 100);
+        assertEquals(1920, popup.getX() + popup.getWidth(), 1e-100);
+        assertEquals(200, popup.getY(), 1e-100);
+    }
+
+    @Test
     public void testAutofixActivationAfterShow() {
         toolkit.setScreens(
                 new ScreenConfiguration(0, 0, 1920, 1200,
@@ -372,6 +392,23 @@
     }
 
     @Test
+    public void testAutofixWithFullScreen() {
+        toolkit.setScreens(
+                new ScreenConfiguration(0, 0, 1920, 1200,
+                                        0, 0, 1920, 1172,
+                                        96));
+
+        final Popup popup = new Popup();
+        popup.getContent().add(new Rectangle(0, 0, 50, 50));
+
+        stage.setFullScreen(true);
+        popup.show(stage, 100, 1160);
+
+        assertEquals(100, popup.getX(), 1e-100);
+        assertEquals(1150, popup.getY(), 1e-100);
+    }
+
+    @Test
     public void testSetPopupContentByChangingRootNode() {
         final Popup popup = new Popup();
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/GlobalMenuAdapter.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/GlobalMenuAdapter.java	Tue Jun 12 10:07:03 2012 -0700
@@ -27,9 +27,9 @@
 
 import javafx.beans.InvalidationListener;
 import javafx.beans.Observable;
-import javafx.collections.ObservableList;
 import javafx.collections.ListChangeListener;
 import javafx.collections.ListChangeListener.Change;
+import javafx.collections.ObservableList;
 import javafx.event.ActionEvent;
 import javafx.event.Event;
 import javafx.event.EventHandler;
@@ -170,8 +170,6 @@
         if(target != null && target.getOnMenuValidation() != null) {
             Event.fireEvent(target, new Event(target.MENU_VALIDATION_EVENT));
         }
-        if (!menu.isDisable()) menu.fire();
-        
     }
 
 
@@ -195,9 +193,7 @@
             if(target.getOnMenuValidation() != null) {
                 Event.fireEvent(target, new Event(target.MENU_VALIDATION_EVENT));
             }
-            if (!menuItem.isDisable()) menuItem.fire();
         }
-
     }
 
     private class CheckMenuItemAdapter extends CheckMenuItem implements CheckMenuItemBase {
@@ -221,9 +217,7 @@
             if(target.getOnMenuValidation() != null) {
                 Event.fireEvent(target, new Event(target.MENU_VALIDATION_EVENT));
             }
-            if (!menuItem.isDisable()) menuItem.fire();
         }
-
     }
 
     private class RadioMenuItemAdapter extends RadioMenuItem implements RadioMenuItemBase {
@@ -248,9 +242,7 @@
             if(target.getOnMenuValidation() != null) {
                 Event.fireEvent(target, new Event(target.MENU_VALIDATION_EVENT));
             }
-            if (!menuItem.isDisable()) menuItem.fire();
         }
-
     }
 
     private class SeparatorMenuItemAdapter extends SeparatorMenuItem implements SeparatorMenuItemBase {
@@ -271,9 +263,7 @@
             if(target.getOnMenuValidation() != null) {
                 Event.fireEvent(target, new Event(target.MENU_VALIDATION_EVENT));
             }
-            if (!menuItem.isDisable()) menuItem.fire();
         }
-
     }
 
     private class CustomMenuItemAdapter extends CustomMenuItem implements CustomMenuItemBase {
@@ -294,8 +284,6 @@
             if(target.getOnMenuValidation() != null) {
                 Event.fireEvent(target, new Event(target.MENU_VALIDATION_EVENT));
             }
-            if (!menuItem.isDisable()) menuItem.fire();
         }
-
     }
 }
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubPlatformImage.java	Tue Jun 12 16:55:59 2012 +1200
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubPlatformImage.java	Tue Jun 12 10:07:03 2012 -0700
@@ -27,7 +27,10 @@
 
 import com.sun.javafx.tk.PlatformImage;
 import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
 import javafx.scene.image.PixelFormat;
+import javafx.scene.image.PixelReader;
 import javafx.scene.image.WritablePixelFormat;
 
 public final class StubPlatformImage implements PlatformImage {
@@ -77,33 +80,62 @@
     }
 
     @Override
-    public int getArgbPre(int x, int y) {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
     public void setArgb(int x, int y, int argb) {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
     @Override
-    public void setArgbPre(int x, int y, int argbpre) {
+    public <T extends Buffer> void getPixels(int x, int y, int w, int h,
+                                             WritablePixelFormat<T> pixelformat,
+                                             T pixels, int scanlineBytes)
+    {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
     @Override
-    public <T extends Buffer> void getPixels(int x, int y, int w, int h,
-                                             T pixels,
-                                             WritablePixelFormat<T> pixelformat,
-                                             int scanlineBytes) {
+    public void getPixels(int x, int y, int w, int h,
+                          WritablePixelFormat<ByteBuffer> pixelformat,
+                          byte[] pixels, int offset, int scanlineBytes)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void getPixels(int x, int y, int w, int h,
+                          WritablePixelFormat<IntBuffer> pixelformat,
+                          int[] pixels, int offset, int scanlineInts)
+    {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
     @Override
     public <T extends Buffer> void setPixels(int x, int y, int w, int h,
-                                             T pixels,
                                              PixelFormat<T> pixelformat,
-                                             int scanlineBytes) {
+                                             T pixels, int scanlineBytes)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setPixels(int x, int y, int w, int h,
+                          PixelFormat<ByteBuffer> pixelformat,
+                          byte[] pixels, int offset, int scanlineBytes)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setPixels(int x, int y, int w, int h,
+                          PixelFormat<IntBuffer> pixelformat,
+                          int[] pixels, int offset, int scanlineInts)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setPixels(int dstx, int dsty, int w, int h,
+                          PixelReader reader, int srcx, int srcy)
+    {
         throw new UnsupportedOperationException("Not supported yet.");
     }