Example usage for java.awt.image RescaleOp RescaleOp

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

Introduction

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

Prototype

public RescaleOp(float scaleFactor, float offset, RenderingHints hints) 

Source Link

Document

Constructs a new RescaleOp with the desired scale factor and offset.

Usage

From source file:paintbasico2d.VentanaPrincipal.java

private void jSliderBrilloStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSliderBrilloStateChanged
    VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame());

    if (vi != null) {
        BufferedImage ImgSource = vi.getLienzo().getImage();
        if (img == null)
            img = ImgSource;//ww w.ja va 2  s.c  om
        if (ImgSource != null) {
            try {
                float slider = jSliderBrillo.getValue();
                RescaleOp rop = new RescaleOp(1.0F, slider, null);
                BufferedImage imgdest = rop.filter(this.img, null);
                vi.getLienzo().setImage(imgdest);
                vi.getLienzo().repaint();

            } catch (IllegalArgumentException e) {
                System.err.println(e.getLocalizedMessage());
            }
        }
    }
}