All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.code.appengine.awt.image.BandCombineOp Maven / Gradle / Ivy

The newest version!
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * @author Oleg V. Khaschansky
 *
 * @date: Sep 20, 2005
 */

package com.google.code.appengine.awt.image;

import java.util.Arrays;

import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor;
import org.apache.harmony.awt.internal.nls.Messages;

import com.google.code.appengine.awt.*;
import com.google.code.appengine.awt.geom.Point2D;
import com.google.code.appengine.awt.geom.Rectangle2D;
import com.google.code.appengine.awt.image.ComponentSampleModel;
import com.google.code.appengine.awt.image.DataBuffer;
import com.google.code.appengine.awt.image.ImagingOpException;
import com.google.code.appengine.awt.image.PixelInterleavedSampleModel;
import com.google.code.appengine.awt.image.Raster;
import com.google.code.appengine.awt.image.RasterOp;
import com.google.code.appengine.awt.image.SampleModel;
import com.google.code.appengine.awt.image.SinglePixelPackedSampleModel;
import com.google.code.appengine.awt.image.WritableRaster;


public class BandCombineOp implements RasterOp {
    static final int offsets3c[] = {16, 8, 0};
    static final int offsets4ac[] = {16, 8, 0, 24};
    static final int masks3c[] = {0xFF0000, 0xFF00, 0xFF};
    static final int masks4ac[] = {0xFF0000, 0xFF00, 0xFF, 0xFF000000};
    private static final int piOffsets[] = {0, 1, 2};
    private static final int piInvOffsets[] = {2, 1, 0};

    private static final int TYPE_BYTE3C = 0;
    private static final int TYPE_BYTE4AC = 1;
    private static final int TYPE_USHORT3C = 2;
    private static final int TYPE_SHORT3C = 3;

    private int mxWidth;
    private int mxHeight;
    private float matrix[][];
    private RenderingHints rHints;

    static {
        // XXX - todo
        //System.loadLibrary("imageops");
    }

    public BandCombineOp(float matrix[][], RenderingHints hints) {
        this.mxHeight = matrix.length;
        this.mxWidth = matrix[0].length;
        this.matrix = new float[mxHeight][mxWidth];

        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy