src/share/native/sun/awt/image/cvutils/img_globals.c

Print this page




  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
  23  * questions.
  24  */
  25 
  26 /*
  27  * This file implements some of the standard utility procedures used
  28  * by the image conversion package.
  29  */
  30 
  31 #include "img_globals.h"
  32 
  33 #include "java_awt_image_IndexColorModel.h"
  34 #include "java_awt_image_DirectColorModel.h"
  35 #include "java_awt_Transparency.h"
  36 
  37 /*
  38  * This function constructs an 8x8 ordered dither array which can be
  39  * used to dither data into an output range with discreet values that
  40  * differ by the value specified as quantum.  A monochrome screen would
  41  * use a dither array constructed with the quantum 256.
  42  * The array values produced are unsigned and intended to be used with
  43  * a lookup table which returns the next color darker than the error
  44  * adjusted color used as the index.
  45  */
  46 void
  47 make_uns_ordered_dither_array(uns_ordered_dither_array oda,
  48                               int quantum)
  49 {
  50     int i, j, k;
  51 
  52     oda[0][0] = 0;
  53     for (k = 1; k < 8; k *= 2) {
  54         for (i = 0; i < k; i++) {




  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
  23  * questions.
  24  */
  25 
  26 /*
  27  * This file implements some of the standard utility procedures used
  28  * by the image conversion package.
  29  */
  30 
  31 #include "img_globals.h"
  32 
  33 #include "java_awt_image_IndexColorModel.h"

  34 #include "java_awt_Transparency.h"
  35 
  36 /*
  37  * This function constructs an 8x8 ordered dither array which can be
  38  * used to dither data into an output range with discreet values that
  39  * differ by the value specified as quantum.  A monochrome screen would
  40  * use a dither array constructed with the quantum 256.
  41  * The array values produced are unsigned and intended to be used with
  42  * a lookup table which returns the next color darker than the error
  43  * adjusted color used as the index.
  44  */
  45 void
  46 make_uns_ordered_dither_array(uns_ordered_dither_array oda,
  47                               int quantum)
  48 {
  49     int i, j, k;
  50 
  51     oda[0][0] = 0;
  52     for (k = 1; k < 8; k *= 2) {
  53         for (i = 0; i < k; i++) {