当前位置: 首页>>代码示例>>Java>>正文


Java LinearGradientPaint.getColorSpace方法代码示例

本文整理汇总了Java中java.awt.LinearGradientPaint.getColorSpace方法的典型用法代码示例。如果您正苦于以下问题:Java LinearGradientPaint.getColorSpace方法的具体用法?Java LinearGradientPaint.getColorSpace怎么用?Java LinearGradientPaint.getColorSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.LinearGradientPaint的用法示例。


在下文中一共展示了LinearGradientPaint.getColorSpace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isPaintValid

import java.awt.LinearGradientPaint; //导入方法依赖的package包/类
@Override
boolean isPaintValid(SunGraphics2D sg2d) {
    LinearGradientPaint paint = (LinearGradientPaint)sg2d.paint;

    if (paint.getFractions().length == 2 &&
        paint.getCycleMethod() != CycleMethod.REPEAT &&
        paint.getColorSpace() != ColorSpaceType.LINEAR_RGB)
    {
        D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData;
        D3DGraphicsDevice gd = (D3DGraphicsDevice)
            dstData.getDeviceConfiguration().getDevice();
        if (gd.isCapPresent(CAPS_LCD_SHADER)) {
            // we can delegate to the optimized two-color gradient
            // codepath, which should be faster
            return true;
        }
    }

    return super.isPaintValid(sg2d);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:D3DPaints.java

示例2: isPaintValid

import java.awt.LinearGradientPaint; //导入方法依赖的package包/类
@Override
boolean isPaintValid(SunGraphics2D sg2d) {
    LinearGradientPaint paint = (LinearGradientPaint)sg2d.paint;

    if (paint.getFractions().length == 2 &&
        paint.getCycleMethod() != CycleMethod.REPEAT &&
        paint.getColorSpace() != ColorSpaceType.LINEAR_RGB)
    {
        // we can delegate to the optimized two-color gradient
        // codepath, which does not require fragment shader support
        return true;
    }

    return super.isPaintValid(sg2d);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:OGLPaints.java

示例3: darkerLinearGradientPaint

import java.awt.LinearGradientPaint; //导入方法依赖的package包/类
/**
 * Create a new Gradient with its colours darkened.
 *
 * @param paint a <code>LinearGradientPaint</code>
 *
 * @return a darker version of the <code>LinearGradientPaint</code>
 */
private static Paint darkerLinearGradientPaint(LinearGradientPaint paint) {
    final Color[] paintColors = paint.getColors();
    for (int i = 0; i < paintColors.length; i++) {
        paintColors[i] = darker(paintColors[i]);
    }
    return new LinearGradientPaint(paint.getStartPoint(),
            paint.getEndPoint(), paint.getFractions(), paintColors,
            paint.getCycleMethod(), paint.getColorSpace(), 
            paint.getTransform());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:18,代码来源:PaintAlpha.java

示例4: darkerLinearGradientPaint

import java.awt.LinearGradientPaint; //导入方法依赖的package包/类
/**
 * Create a new Gradient with its colours darkened.
 *
 * @param paint a {@code LinearGradientPaint}
 *
 * @return a darker version of the {@code LinearGradientPaint}
 */
private static Paint darkerLinearGradientPaint(LinearGradientPaint paint) {
    final Color[] paintColors = paint.getColors();
    for (int i = 0; i < paintColors.length; i++) {
        paintColors[i] = darker(paintColors[i]);
    }
    return new LinearGradientPaint(paint.getStartPoint(),
            paint.getEndPoint(), paint.getFractions(), paintColors,
            paint.getCycleMethod(), paint.getColorSpace(), 
            paint.getTransform());
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:18,代码来源:PaintAlpha.java

示例5: equal

import java.awt.LinearGradientPaint; //导入方法依赖的package包/类
/**
 * Returns {@code true} if the two {@code Paint} objects are equal 
 * OR both {@code null}.  This method handles
 * {@code GradientPaint}, {@code LinearGradientPaint} and 
 * {@code RadialGradientPaint} as a special cases, since those classes do
 * not override the {@code equals()} method.
 *
 * @param p1  paint 1 ({@code null} permitted).
 * @param p2  paint 2 ({@code null} permitted).
 *
 * @return A boolean.
 */
public static boolean equal(Paint p1, Paint p2) {
    if (p1 == p2) {
        return true;
    }
        
    // handle cases where either or both arguments are null
    if (p1 == null) {
        return (p2 == null);   
    }
    if (p2 == null) {
        return false;   
    }

    // handle GradientPaint as a special case...
    if (p1 instanceof GradientPaint && p2 instanceof GradientPaint) {
        GradientPaint gp1 = (GradientPaint) p1;
        GradientPaint gp2 = (GradientPaint) p2;
        return gp1.getColor1().equals(gp2.getColor1()) 
                && gp1.getColor2().equals(gp2.getColor2())
                && gp1.getPoint1().equals(gp2.getPoint1())    
                && gp1.getPoint2().equals(gp2.getPoint2())
                && gp1.isCyclic() == gp2.isCyclic()
                && gp1.getTransparency() == gp1.getTransparency(); 
    } else if (p1 instanceof LinearGradientPaint 
            && p2 instanceof LinearGradientPaint) {
        LinearGradientPaint lgp1 = (LinearGradientPaint) p1;
        LinearGradientPaint lgp2 = (LinearGradientPaint) p2;
        return lgp1.getStartPoint().equals(lgp2.getStartPoint())
                && lgp1.getEndPoint().equals(lgp2.getEndPoint()) 
                && Arrays.equals(lgp1.getFractions(), lgp2.getFractions())
                && Arrays.equals(lgp1.getColors(), lgp2.getColors())
                && lgp1.getCycleMethod() == lgp2.getCycleMethod()
                && lgp1.getColorSpace() == lgp2.getColorSpace()
                && lgp1.getTransform().equals(lgp2.getTransform());
    } else if (p1 instanceof RadialGradientPaint 
            && p2 instanceof RadialGradientPaint) {
        RadialGradientPaint rgp1 = (RadialGradientPaint) p1;
        RadialGradientPaint rgp2 = (RadialGradientPaint) p2;
        return rgp1.getCenterPoint().equals(rgp2.getCenterPoint())
                && rgp1.getRadius() == rgp2.getRadius() 
                && rgp1.getFocusPoint().equals(rgp2.getFocusPoint())
                && Arrays.equals(rgp1.getFractions(), rgp2.getFractions())
                && Arrays.equals(rgp1.getColors(), rgp2.getColors())
                && rgp1.getCycleMethod() == rgp2.getCycleMethod()
                && rgp1.getColorSpace() == rgp2.getColorSpace()
                && rgp1.getTransform().equals(rgp2.getTransform());
    } else {
        return p1.equals(p2);
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:63,代码来源:PaintUtils.java

示例6: paintsAreEqual

import java.awt.LinearGradientPaint; //导入方法依赖的package包/类
/**
 * Returns {@code true} if the two {@code Paint} objects are equal 
 * OR both {@code null}.  This method handles
 * {@code GradientPaint}, {@code LinearGradientPaint} 
 * and {@code RadialGradientPaint} as special cases, since those classes do
 * not override the {@code equals()} method.
 *
 * @param p1  paint 1 ({@code null} permitted).
 * @param p2  paint 2 ({@code null} permitted).
 *
 * @return A boolean.
 */
private static boolean paintsAreEqual(Paint p1, Paint p2) {
    if (p1 == p2) {
        return true;
    }
        
    // handle cases where either or both arguments are null
    if (p1 == null) {
        return (p2 == null);   
    }
    if (p2 == null) {
        return false;   
    }

    // handle cases...
    if (p1 instanceof Color && p2 instanceof Color) {
        return p1.equals(p2);
    }
    if (p1 instanceof GradientPaint && p2 instanceof GradientPaint) {
        GradientPaint gp1 = (GradientPaint) p1;
        GradientPaint gp2 = (GradientPaint) p2;
        return gp1.getColor1().equals(gp2.getColor1()) 
                && gp1.getColor2().equals(gp2.getColor2())
                && gp1.getPoint1().equals(gp2.getPoint1())    
                && gp1.getPoint2().equals(gp2.getPoint2())
                && gp1.isCyclic() == gp2.isCyclic()
                && gp1.getTransparency() == gp1.getTransparency(); 
    } 
    if (p1 instanceof LinearGradientPaint 
            && p2 instanceof LinearGradientPaint) {
        LinearGradientPaint lgp1 = (LinearGradientPaint) p1;
        LinearGradientPaint lgp2 = (LinearGradientPaint) p2;
        return lgp1.getStartPoint().equals(lgp2.getStartPoint())
                && lgp1.getEndPoint().equals(lgp2.getEndPoint()) 
                && Arrays.equals(lgp1.getFractions(), lgp2.getFractions())
                && Arrays.equals(lgp1.getColors(), lgp2.getColors())
                && lgp1.getCycleMethod() == lgp2.getCycleMethod()
                && lgp1.getColorSpace() == lgp2.getColorSpace()
                && lgp1.getTransform().equals(lgp2.getTransform());
    } 
    if (p1 instanceof RadialGradientPaint 
            && p2 instanceof RadialGradientPaint) {
        RadialGradientPaint rgp1 = (RadialGradientPaint) p1;
        RadialGradientPaint rgp2 = (RadialGradientPaint) p2;
        return rgp1.getCenterPoint().equals(rgp2.getCenterPoint())
                && rgp1.getRadius() == rgp2.getRadius() 
                && rgp1.getFocusPoint().equals(rgp2.getFocusPoint())
                && Arrays.equals(rgp1.getFractions(), rgp2.getFractions())
                && Arrays.equals(rgp1.getColors(), rgp2.getColors())
                && rgp1.getCycleMethod() == rgp2.getCycleMethod()
                && rgp1.getColorSpace() == rgp2.getColorSpace()
                && rgp1.getTransform().equals(rgp2.getTransform());
    }
    return p1.equals(p2);
}
 
开发者ID:jfree,项目名称:fxgraphics2d,代码行数:67,代码来源:FXGraphics2D.java


注:本文中的java.awt.LinearGradientPaint.getColorSpace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。