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


Java ReadableColor.getGreen方法代码示例

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


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

示例1: initColorMap

import org.lwjgl.util.ReadableColor; //导入方法依赖的package包/类
private static void initColorMap(IntBuffer colorMap, int stepSize, ReadableColor... colors) {
	for ( int n = 0; n < colors.length - 1; n++ ) {
		ReadableColor color = colors[n];
		int r0 = color.getRed();
		int g0 = color.getGreen();
		int b0 = color.getBlue();

		color = colors[n + 1];
		int r1 = color.getRed();
		int g1 = color.getGreen();
		int b1 = color.getBlue();

		int deltaR = r1 - r0;
		int deltaG = g1 - g0;
		int deltaB = b1 - b0;

		for ( int step = 0; step < stepSize; step++ ) {
			float alpha = (float)step / (stepSize - 1);
			int r = (int)(r0 + alpha * deltaR);
			int g = (int)(g0 + alpha * deltaG);
			int b = (int)(b0 + alpha * deltaB);
			colorMap.put((r << 0) | (g << 8) | (b << 16));
		}
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:DemoFractal.java

示例2: interpolate

import org.lwjgl.util.ReadableColor; //导入方法依赖的package包/类
/**
 * Interpolates between the given {@link Color}s according to the given
 * amount.  The amount should be between 0 and 1, all other numbers are produce
 * undefined results.
 * 
 * @param col1 The first {@link Color} in the interpolation.
 * @param col2 The second {@link Color} in the interpolation.
 * @param amt The amount to interpolate.
 * @param out The {@link Color} to store the output in.
 * @return The interpolated {@link Color}.
 */
public static Color interpolate(ReadableColor col1, ReadableColor col2, float amt, Color out) {
  int num = (int) (col1.getAlpha() * (1 - amt) + col2.getAlpha() * amt);
  out.setAlpha(num);
  
  num = (int) (col1.getRed()* (1 - amt) + col2.getRed() * amt);
  out.setRed(num);
  
  num = (int) (col1.getGreen()* (1 - amt) + col2.getGreen() * amt);
  out.setGreen(num);
  
  num = (int) (col1.getBlue()* (1 - amt) + col2.getBlue() * amt);
  out.setBlue(num);
  
  return out;
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:27,代码来源:ColorInterpolator.java


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