Example usage for java.awt.image LookupOp LookupOp

List of usage examples for java.awt.image LookupOp LookupOp

Introduction

In this page you can find the example usage for java.awt.image LookupOp LookupOp.

Prototype

public LookupOp(LookupTable lookup, RenderingHints hints) 

Source Link

Document

Constructs a LookupOp object given the lookup table and a RenderingHints object, which might be null .

Usage

From source file:paintbasico2d.VentanaPrincipal.java

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    // TODO add your handling code here:
    VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame());
    if (vi != null) {
        BufferedImage ImgSource = vi.getLienzo().getImage();
        BufferedImage image = convertImageType(ImgSource, BufferedImage.TYPE_INT_RGB);
        if (ImgSource != null) {
            try {
                LookupTable It = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_SFUNCION);
                LookupOp lop = new LookupOp(It, null);
                BufferedImage imgdest = lop.filter(image, null);
                vi.getLienzo().setImage(imgdest);
                vi.getLienzo().repaint();
            } catch (Exception e) {
                System.err.println("Error");
            }//  w ww  . j a  v  a 2  s .c  o m
        }
    }
}

From source file:paintbasico2d.VentanaPrincipal.java

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    // TODO add your handling code here:
    VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame());
    if (vi != null) {
        BufferedImage ImgSource = vi.getLienzo().getImage();
        BufferedImage image = convertImageType(ImgSource, BufferedImage.TYPE_INT_RGB);
        if (ImgSource != null) {
            try {
                LookupTable It = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_LOGARITHM);
                LookupOp lop = new LookupOp(It, null);
                BufferedImage imgdest = lop.filter(image, null);
                vi.getLienzo().setImage(imgdest);
                vi.getLienzo().repaint();
            } catch (Exception e) {
                System.err.println("Error");
            }//www. jav a  2 s.  co m
        }
    }
}

From source file:paintbasico2d.VentanaPrincipal.java

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
    // TODO add your handling code here:
    VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame());
    if (vi != null) {
        BufferedImage ImgSource = vi.getLienzo().getImage();
        BufferedImage image = convertImageType(ImgSource, BufferedImage.TYPE_INT_RGB);
        if (ImgSource != null) {
            try {
                LookupTable It = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_POWER);
                LookupOp lop = new LookupOp(It, null);
                BufferedImage imgdest = lop.filter(image, null);
                vi.getLienzo().setImage(imgdest);
                vi.getLienzo().repaint();
            } catch (Exception e) {
                System.err.println("Error");
            }/*from  www. j a  va2 s  . co m*/
        }
    }
}

From source file:paintbasico2d.VentanaPrincipal.java

private void NegativoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NegativoActionPerformed
    // TODO add your handling code here:
    VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
    if (vi != null) {
        vi.getLienzo().getImage().getType();

        if (vi.getLienzo().getImage().getType() != BufferedImage.TYPE_INT_RGB) {
            BufferedImage img;/*  w w w  .  j  a  v a  2s.c o  m*/
            img = new BufferedImage(vi.getLienzo().getImage().getWidth(), vi.getLienzo().getImage().getHeight(),
                    BufferedImage.TYPE_INT_RGB);
            Graphics2D g2d = img.createGraphics();
            g2d.drawImage(vi.getLienzo().getImage(), 0, 0, null);
            vi.getLienzo().setImage(img);
        }

        if (vi.getLienzo().getImage() != null) {
            LookupTable lk = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_NEGATIVE);
            try {
                LookupOp l = new LookupOp(lk, null);
                BufferedImage imgdest = l.filter(vi.getLienzo().getImage(), null);
                vi.getLienzo().setImage(imgdest);
                vi.getLienzo().repaint();
            } catch (Exception e) {
                System.err.println(e);
            }
        }

    }
}