1 /*
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
591 * getPixel())
592 */
593 public void rasterRead() {
594 if (fImageInfoInt.get(kNativePixelsChangedIndex) == 1) {
595 syncToJavaPixels();
596 }
597 }
598
599 /**
600 * Invoked before the raster's contents are to be written to (via one of the modifier methods in Raster such as
601 * setPixel())
602 */
603 public void rasterWrite() {
604 if (fImageInfoInt.get(kNativePixelsChangedIndex) == 1) {
605 syncToJavaPixels();
606 }
607
608 fImageInfoInt.put(kNeedToSyncFromJavaPixelsIndex, 1); // the pixels will change
609 }
610
611 // /**
612 // * Invoked when the raster's contents will be taken (via the Raster.getDataBuffer() method)
613 // */
614 // public void rasterStolen() {
615 // fImageInfoInt.put(kImageStolenIndex, 1); // this means we must convert between Java and native pixels every
616 // // single primitive! (very expensive)
617 // if (fImageInfoInt.get(kNativePixelsChangedIndex) == 1) {
618 // syncToJavaPixels();
619 // }
620 //
621 // // we know the pixels have been stolen, no need to listen for changes any more
622 //// if (this.bufImgSunRaster != null) {
623 //// this.bufImgSunRaster.setRasterListener(null);
624 //// }
625 // }
626
627 private native void syncToJavaPixels();
628
629 // we need to refer to rasters often, so cache them
630 void cacheRasters(BufferedImage bim) {
|
1 /*
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
591 * getPixel())
592 */
593 public void rasterRead() {
594 if (fImageInfoInt.get(kNativePixelsChangedIndex) == 1) {
595 syncToJavaPixels();
596 }
597 }
598
599 /**
600 * Invoked before the raster's contents are to be written to (via one of the modifier methods in Raster such as
601 * setPixel())
602 */
603 public void rasterWrite() {
604 if (fImageInfoInt.get(kNativePixelsChangedIndex) == 1) {
605 syncToJavaPixels();
606 }
607
608 fImageInfoInt.put(kNeedToSyncFromJavaPixelsIndex, 1); // the pixels will change
609 }
610
611 private void syncFromCustom() {
612
613 }
614
615 private void syncToCustom() {
616
617 }
618 // /**
619 // * Invoked when the raster's contents will be taken (via the Raster.getDataBuffer() method)
620 // */
621 // public void rasterStolen() {
622 // fImageInfoInt.put(kImageStolenIndex, 1); // this means we must convert between Java and native pixels every
623 // // single primitive! (very expensive)
624 // if (fImageInfoInt.get(kNativePixelsChangedIndex) == 1) {
625 // syncToJavaPixels();
626 // }
627 //
628 // // we know the pixels have been stolen, no need to listen for changes any more
629 //// if (this.bufImgSunRaster != null) {
630 //// this.bufImgSunRaster.setRasterListener(null);
631 //// }
632 // }
633
634 private native void syncToJavaPixels();
635
636 // we need to refer to rasters often, so cache them
637 void cacheRasters(BufferedImage bim) {
|