1 /* |
1 /* |
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
39 import static sun.java2d.StateTrackable.State.*; |
39 import static sun.java2d.StateTrackable.State.*; |
40 import sun.java2d.StateTrackableDelegate; |
40 import sun.java2d.StateTrackableDelegate; |
41 |
41 |
42 import sun.awt.image.SunWritableRaster; |
42 import sun.awt.image.SunWritableRaster; |
43 |
43 |
44 import javax.tools.annotation.GenerateNativeHeader; |
44 import java.lang.annotation.Native; |
45 |
45 |
46 /** |
46 /** |
47 * This class exists to wrap one or more data arrays. Each data array in |
47 * This class exists to wrap one or more data arrays. Each data array in |
48 * the DataBuffer is referred to as a bank. Accessor methods for getting |
48 * the DataBuffer is referred to as a bank. Accessor methods for getting |
49 * and setting elements of the DataBuffer's banks exist with and without |
49 * and setting elements of the DataBuffer's banks exist with and without |
65 * image classes use TYPE_BYTE, TYPE_USHORT, TYPE_INT, TYPE_SHORT, |
65 * image classes use TYPE_BYTE, TYPE_USHORT, TYPE_INT, TYPE_SHORT, |
66 * TYPE_FLOAT, and TYPE_DOUBLE DataBuffers to store image data. |
66 * TYPE_FLOAT, and TYPE_DOUBLE DataBuffers to store image data. |
67 * @see java.awt.image.Raster |
67 * @see java.awt.image.Raster |
68 * @see java.awt.image.SampleModel |
68 * @see java.awt.image.SampleModel |
69 */ |
69 */ |
70 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
71 @GenerateNativeHeader |
|
72 public abstract class DataBuffer { |
70 public abstract class DataBuffer { |
73 |
71 |
74 /** Tag for unsigned byte data. */ |
72 /** Tag for unsigned byte data. */ |
75 public static final int TYPE_BYTE = 0; |
73 @Native public static final int TYPE_BYTE = 0; |
76 |
74 |
77 /** Tag for unsigned short data. */ |
75 /** Tag for unsigned short data. */ |
78 public static final int TYPE_USHORT = 1; |
76 @Native public static final int TYPE_USHORT = 1; |
79 |
77 |
80 /** Tag for signed short data. Placeholder for future use. */ |
78 /** Tag for signed short data. Placeholder for future use. */ |
81 public static final int TYPE_SHORT = 2; |
79 @Native public static final int TYPE_SHORT = 2; |
82 |
80 |
83 /** Tag for int data. */ |
81 /** Tag for int data. */ |
84 public static final int TYPE_INT = 3; |
82 @Native public static final int TYPE_INT = 3; |
85 |
83 |
86 /** Tag for float data. Placeholder for future use. */ |
84 /** Tag for float data. Placeholder for future use. */ |
87 public static final int TYPE_FLOAT = 4; |
85 @Native public static final int TYPE_FLOAT = 4; |
88 |
86 |
89 /** Tag for double data. Placeholder for future use. */ |
87 /** Tag for double data. Placeholder for future use. */ |
90 public static final int TYPE_DOUBLE = 5; |
88 @Native public static final int TYPE_DOUBLE = 5; |
91 |
89 |
92 /** Tag for undefined data. */ |
90 /** Tag for undefined data. */ |
93 public static final int TYPE_UNDEFINED = 32; |
91 @Native public static final int TYPE_UNDEFINED = 32; |
94 |
92 |
95 /** The data type of this DataBuffer. */ |
93 /** The data type of this DataBuffer. */ |
96 protected int dataType; |
94 protected int dataType; |
97 |
95 |
98 /** The number of banks in this DataBuffer. */ |
96 /** The number of banks in this DataBuffer. */ |