Examples of ColorCurve


Examples of org.photovault.image.ColorCurve

     */
    private void showCurve( int chan ) {
        currentColorCurve = chan;
        if ( colorCurves[chan] == null ) {
            // The curve is not present in current profile
            ColorCurve c = colorCurves[chan] = new ColorCurve();
            c.addPoint( 0.0, 0.0 );
            c.addPoint( 1.0, 1.0 );
        }
        colorCurvePanel1.setCurve( colorCurves[chan], curveColors[chan] );
        colorCurvePanel1.clearReferenceCurves();
        if ( refCurves[chan] != null ) {
            for ( Object c : refCurves[chan] ) {
                if ( c == null ) {
                    c = new ColorCurve();
                }
                colorCurvePanel1.addReferenceCurve( (ColorCurve) c, refCurveColors[chan] );
            }
        }
       
        // Draw also the curves for other channels
        for ( int n = 0 ; n < colorCurves.length ; n++ ) {
            if ( n != chan ) {
                ColorCurve c = colorCurves[n];
                if ( c == null ) {
                    c = new ColorCurve();
                }
                colorCurvePanel1.addReferenceCurve( c, refCurveColors[n] );
            }
        }
        colorCurveSelectionCombo.setSelectedIndex( chan );
View Full Code Here

Examples of org.photovault.image.ColorCurve

        }
       
    }
   
    public ColorCurve getColorChannelCurve(String name) {
        ColorCurve ret = null;
        for ( int n = 0 ; n < colorCurveNames.length ; n++ ) {
            if ( colorCurveNames[n].equals( name ) ) {
                ret = colorCurves[n];
                break;
            }
View Full Code Here

Examples of org.photovault.image.ColorCurve

     Test that dragging a control point works.
     */
    public void testSetCurve() {
        showFrame();
        tester.actionWaitForIdle();
        ColorCurve c = new ColorCurve();
        c.addPoint( 0.0, 0.0 );
        c.addPoint( 1.0, 1.0 );
        cp.setCurve( c );
       
        // Drag the black point
        int startX = 0;
        int startY = cp.getHeight()-1;
        int endX = cp.getWidth() / 10;
        int endY = cp.getHeight() * 8 / 10;
        tester.mousePress( cp, startX, startY );
        tester.mouseMove( cp, endX, endY );
        tester.mouseRelease();
        c = cp.getCurve();
        assertEquals( 0.1, c.getX( 0 ), 0.02 );
        assertEquals( 0.2, c.getY( 0 ), 0.02 );
       
    }
View Full Code Here

Examples of org.photovault.image.ColorCurve

     Test dragging control point outside window.
     */
    public void testDragOutside() {
        showFrame();
        tester.actionWaitForIdle();
        ColorCurve c = new ColorCurve();
        c.addPoint( 0.0, 0.0 );
        c.addPoint( 1.0, 1.0 );
        cp.setCurve( c );
       
        // Drag the black point
        int startX = 0;
        int startY = cp.getHeight()-1;
        tester.mousePress( cp, startX, startY );
        Point endPoint = getPoint( 0.0, 0.1 );
        tester.mouseMove( pane, 0, (int)(endPoint.getY()) + 50 );
        tester.mouseRelease();
        c = cp.getCurve();
        assertEquals( 0.0, c.getX( 0 ) );
        assertEquals( 0.1, c.getY( 0 ), 0.02 );
    }
View Full Code Here

Examples of org.photovault.image.ColorCurve

     existing control points.
     */
    public void testCreateCP() {
        showFrame();
        tester.actionWaitForIdle();
        ColorCurve c = new ColorCurve();
        c.addPoint( 0.0, 0.0 );
        c.addPoint( 1.0, 1.0 );
        cp.setCurve( c );
       
        CurvePanelListener l = new CurvePanelListener();
        cp.addListener( l );
        Point start = getCurvePoint( c, 0.3 );
        tester.mousePress( cp, (int)start.getX(), (int)start.getY() );
        Point end = getPoint( 0.6, 0.4 );
        tester.mouseMove( cp, (int)end.getX(), (int)end.getY() );
        assertTrue( l.dragStarted );
        tester.mouseRelease();
        tester.actionWaitForIdle();
        assertTrue( l.dragCompleted );
        c = cp.getCurve();
        assertEquals( 3, c.getPointCount() );
        assertEquals( 0.6, c.getX( 1 ), 0.01 );
        assertEquals( 0.4, c.getY( 1 ), 0.01 );
       
    }
View Full Code Here

Examples of org.photovault.image.ColorCurve

     Test dragging a control point across another point.
     */
    public void testDragCross() {
        showFrame();
        tester.actionWaitForIdle();
        ColorCurve c = new ColorCurve();
        c.addPoint( 0.0, 0.0 );
        c.addPoint( 1.0, 1.0 );
        c.addPoint( 0.5, 0.5 );
        c.addPoint( 0.6, 0.4 );
        cp.setCurve( c );
        Point start = getCurvePoint( c, 0.5 );
        tester.mousePress( cp, (int)start.getX(), (int)start.getY() );
        // Drag CP 1 so that it goes to the other side of CP 2
        Point end = getPoint( 0.65, 0.4 );
        tester.mouseMove( cp, (int)end.getX(), (int)end.getY() );
        tester.mouseRelease();
        c = cp.getCurve();
        assertEquals( 4, c.getPointCount() );
        assertEquals( 0.5, c.getX( 1 ), 0.01 );
        assertEquals( 0.5, c.getY( 1 ), 0.01 );
       
    }
View Full Code Here

Examples of org.photovault.image.ColorCurve

            colorMappingChanged();
        }
        protected Object getModelValue( Object model ) {
            PhotoInfo obj = (PhotoInfo) model;
            ChannelMapOperation cm = obj.getColorChannelMapping();
            ColorCurve ret = null;
            if ( cm != null ) {
                ret = cm.getChannelCurve( name );
            }
            return ret;
        }
View Full Code Here

Examples of org.photovault.image.ColorCurve

        assertEquals( 8.0, p.getFStop() );
        assertEquals( "Digital", p.getFilm() );
        assertEquals( 100, p.getFilmSpeed() );
        assertEquals( 0, p.getQuality() );
        ChannelMapOperation cm = p.getColorChannelMapping();
        ColorCurve c = cm.getChannelCurve( "value" );
        assertEquals( 0.4, c.getY( 1 ) );
        assertEquals( 0.5, c.getX( 1 ) );
        boolean foundOrig = false;
        for ( int n = 0; n < p.getNumInstances(); n++ ) {
            ImageInstance i = p.getInstance( n );
            if ( i.getInstanceType() == ImageInstance.INSTANCE_TYPE_ORIGINAL ) {
                cm = i.getColorChannelMapping();
                c = cm.getChannelCurve( "value" );
                assertEquals( 0.2, c.getY( 1 ) );
                assertEquals( 0.6, c.getX( 1 ) );               
                foundOrig = true;
            }
        }
        assertTrue( foundOrig );
        assertTrue( l.objects.contains( p ) );
View Full Code Here

Examples of org.photovault.image.ColorCurve

     */
    void setColorCurve(String name, ColorCurve c) {
        if ( origImage != null ) {
            if ( c == null ) {
                // Null curve, use identity mapping
                c = new ColorCurve();
            }
            ChannelMapOperation cm = origImage.getColorAdjustment();
            ChannelMapOperationFactory f = new ChannelMapOperationFactory( cm );
            f.setChannelCurve( name, c );
            origImage.setColorAdjustment( f.create() );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.