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


Java CycleMethod.REFLECT属性代码示例

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


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

示例1: calculateGradientPreview

private void calculateGradientPreview() {

		Color startColor = (Color) gradientStartColorComboBox.getSelectedItem();
		Color endColor = (Color) gradientEndColorComboBox.getSelectedItem();

		if (startColor != null && endColor != null) {

			int width = preview.getWidth() - 1;

			ContinuousColorProvider colorProvider = new ContinuousColorProvider(1, width, startColor, endColor, 255, false);

			// create paint
			float fractions[] = new float[width];
			Color colors[] = new Color[width];

			for (int i = 0; i < width; ++i) {

				float fraction = i / (width - 1.0f);
				double fractionValue = 1 + fraction * (width - 1);
				colors[i] = colorProvider.getColorForValue(fractionValue);
				fractions[i] = fraction;
			}

			Point leftPoint = new Point(0, 0);
			Point rightPoint = new Point(width, 0);

			LinearGradientPaint gradient = new LinearGradientPaint(leftPoint, rightPoint, fractions, colors,
					CycleMethod.REFLECT);
			preview.setGradientPaint(gradient);
			preview.repaint();
		}
	}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:ColorSchemeDialog.java

示例2: makeLinear

private LinearGradientPaint makeLinear(int numColors, boolean alpha) {
    float interval = 1.0f / (numColors - 1);
    float[] fractions = new float[numColors];
    for (int i = 0; i < fractions.length; i++) {
        fractions[i] = i * interval;
    }
    Color[] colors = makeGradientColors(numColors, alpha);
    return new LinearGradientPaint(0.0f, 0.0f,
                                   10.0f, 10.0f,
                                   fractions, colors,
                                   CycleMethod.REFLECT);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:RenderTests.java

示例3: makeRadial

private RadialGradientPaint makeRadial(int numColors, boolean alpha) {
    float interval = 1.0f / (numColors - 1);
    float[] fractions = new float[numColors];
    for (int i = 0; i < fractions.length; i++) {
        fractions[i] = i * interval;
    }
    Color[] colors = makeGradientColors(numColors, alpha);
    return new RadialGradientPaint(0.0f, 0.0f, 10.0f,
                                   fractions, colors,
                                   CycleMethod.REFLECT);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:RenderTests.java

示例4: calculateGradientPreview

private void calculateGradientPreview() {

		Color startColor = (Color) gradientStartColorComboBox.getSelectedItem();
		Color endColor = (Color) gradientEndColorComboBox.getSelectedItem();

		if (startColor != null && endColor != null) {

			int width = preview.getWidth() - 1;

			ContinuousColorProvider colorProvider = new ContinuousColorProvider(1, width, startColor, endColor, 255, false);

			// create paint
			float fractions[] = new float[width];
			Color colors[] = new Color[width];

			for (int i = 0; i < width; ++i) {

				float fraction = (float) i / (width - 1.0f);
				double fractionValue = 1 + fraction * (width - 1);
				colors[i] = colorProvider.getColorForValue(fractionValue);
				fractions[i] = fraction;
			}

			Point leftPoint = new Point(0, 0);
			Point rightPoint = new Point(width, 0);

			LinearGradientPaint gradient = new LinearGradientPaint(leftPoint, rightPoint, fractions, colors, CycleMethod.REFLECT);
			preview.setGradientPaint(gradient);
			preview.repaint();
		}
	}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:31,代码来源:ColorSchemeDialog.java


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