• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ReadableColor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: convertColor

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
/**
 * Примечание: по умолчанию метод возвращает белый цвет.
 *
 * @param color Цвет из нашего кастомного enum
 * @return Color, с которым работает LWJGL
 */
private Color convertColor(TpReadableColor color) {
    switch (color){
        case RED:
            return new Color(ReadableColor.RED);
        case GREEN:
            return new Color(ReadableColor.GREEN);
        case BLUE:
            return new Color(ReadableColor.BLUE);
        case AQUA:
            return new Color(ReadableColor.CYAN);
        case YELLOW:
            return new Color(ReadableColor.YELLOW);
        case ORANGE:
            return new Color(ReadableColor.ORANGE);
        case PURPLE:
            return new Color(ReadableColor.PURPLE);
        case BLACK:
            return new Color(ReadableColor.BLACK);
        default:
            return new Color(ReadableColor.WHITE);
    }
}
 
开发者ID:DoKel,项目名称:tprogersTetris,代码行数:29,代码来源:LwjglGraphicsModule.java


示例2: draw

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
    super.draw(renderer, size, renderInfo);

    int color = 0xe0e0e0;
    if (!isEnabled()) {
        color = 0xa0a0a0;
    }

    int boxSize = size.getHeight();
    renderer.drawRect(0, 0, boxSize, boxSize, ReadableColor.BLACK);
    renderer.drawRect(1, 1, boxSize - 2, boxSize - 2, BOX_BACKGROUND_COLOR);

    if(isChecked()) {
        renderer.drawCenteredString(boxSize / 2 + 1, 1, color, "x", true);
    }

    renderer.drawString(boxSize + 2, 2, color, label);
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:20,代码来源:AbstractGuiCheckbox.java


示例3: draw

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
    super.draw(renderer, size, renderInfo);

    FontRenderer fontRenderer = getMinecraft().fontRendererObj;
    int width = size.getWidth();
    int height = size.getHeight();
    int barTotalWidth = width - 2 * BORDER;
    int barDoneWidth = (int) (barTotalWidth * progress);

    renderer.drawRect(0, 0, width, height, ReadableColor.BLACK); // Border
    renderer.drawRect(BORDER, BORDER, barTotalWidth, height - 2 * BORDER, ReadableColor.WHITE); // Background
    renderer.drawRect(BORDER, BORDER, barDoneWidth, height - 2 * BORDER, ReadableColor.GREY); // Progress

    String text = String.format(label, (int)(progress * 100));
    renderer.drawCenteredString(width / 2, size.getHeight() / 2 - fontRenderer.FONT_HEIGHT / 2, ReadableColor.BLACK, text);
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:18,代码来源:AbstractGuiProgressBar.java


示例4: 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


示例5: drawShape

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
@Override
protected void drawShape() {
    GL11.glBegin(GL11.GL_LINE_LOOP);
    GL11.glVertex2f(-width, -height);
    GL11.glVertex2f(+width, -height);
    GL11.glVertex2f(+width, +height);
    GL11.glVertex2f(-width, +height);
    GL11.glEnd();
    final ReadableColor color = getColor();
    if (nonNull(color)) {
        GL11.glColor4f(color.getRed(), color.getGreen(), color.getBlue(), HALF);
    }
    GL11.glBegin(GL11.GL_POLYGON);
    GL11.glVertex2f(-width, -height);
    GL11.glVertex2f(+width, -height);
    GL11.glVertex2f(+width, +height);
    GL11.glVertex2f(-width, +height);
    GL11.glEnd();
}
 
开发者ID:kjkrol,项目名称:bam,代码行数:20,代码来源:Rectangle.java


示例6: create

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void create(final float breadth, final float borderWidth, final float borderHeight) {
    final FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.density = BORDER_WALL_DENSITY;
    fixtureDef.friction = BORDER_WALL_FRICTION;
    fixtureDef.restitution = BORDER_WALL_RESTITUTION;

    bamScene.getBamSceneCreator().addShape(
            new CreateNewRectangleRequest(fixtureDef, ReadableColor.YELLOW, borderWidth, breadth),
            new Vec2(0, borderHeight),
            BodyType.STATIC);
    bamScene.getBamSceneCreator().addShape(
            new CreateNewRectangleRequest(fixtureDef, ReadableColor.YELLOW, borderWidth, breadth),
            new Vec2(0, 0),
            BodyType.STATIC);
    bamScene.getBamSceneCreator().addShape(
            new CreateNewRectangleRequest(fixtureDef, ReadableColor.YELLOW, breadth, borderHeight),
            new Vec2(0, 0),
            BodyType.STATIC);
    bamScene.getBamSceneCreator().addShape(
            new CreateNewRectangleRequest(fixtureDef, ReadableColor.YELLOW, breadth, borderHeight),
            new Vec2(borderWidth, 0),
            BodyType.STATIC);
}
 
开发者ID:kjkrol,项目名称:bam,代码行数:24,代码来源:BorderWall.java


示例7: setVerticalGradient

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void setVerticalGradient(ReadableColor col1, ReadableColor col2) {
  ReadableColor[] cols = new ReadableColor[9];
  
  cols[0] = col1;
  cols[1] = col1;
  cols[2] = col1;
  
  cols[6] = col2;
  cols[7] = col2;
  cols[8] = col2;
  
  Color inter = ColorInterpolator.interpolate(col1, col2, .5f);
  cols[3] = inter;
  cols[4] = inter;
  cols[5] = inter;
  
  setColors(cols);
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:19,代码来源:ColoredDrawable.java


示例8: setCentralGradient

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void setCentralGradient(ReadableColor col1, ReadableColor col2) {
  ReadableColor[] cols = new ReadableColor[9];
  
  cols[4] = col1;
  
  cols[0] = col2;
  cols[2] = col2;
  cols[6] = col2;
  cols[8] = col2;
  
  // ~1/sqrt(2), the factor to adjust the colors by to produce a circular pattern.
  Color temp = ColorInterpolator.interpolate(col1, col2, .707107f);
  
  cols[1] = temp;
  cols[3] = temp;
  cols[5] = temp;
  cols[7] = temp;
  
  setColors(cols);
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:21,代码来源:ColoredDrawable.java


示例9: setHorizontalGradient

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void setHorizontalGradient(ReadableColor col1, ReadableColor col2) {
  ReadableColor[] cols = new ReadableColor[9];
  
  cols[0] = col1;
  cols[3] = col1;
  cols[6] = col1;
  
  cols[1] = col2;
  cols[4] = col2;
  cols[7] = col2;
  
  Color inter = ColorInterpolator.interpolate(col1, col2, .5f);
  cols[2] = inter;
  cols[5] = inter;
  cols[8] = inter;
  
  setColors(cols);
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:19,代码来源:ColoredDrawable.java


示例10: 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


示例11: setValue

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
@Override
public void setValue(double value, ReadableColor color)
{
	if (color == null)
	{
		if (value < 50)
			if (value < 25)
				color = ReadableColor.RED;
			else
				color = ReadableColor.YELLOW;
		else
			color = ReadableColor.GREEN;
	}
	 
	super.setValue(value, color);
}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:17,代码来源:HealthBar.java


示例12: createCheckerTexture

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
private void createCheckerTexture(final ReadableColor a, final ReadableColor b, final int size) {
	int i = 0;
	for ( int y = 0; y < HEIGHT; y++ ) {
		for ( int x = 0; x < WIDTH; x++ ) {
			ReadableColor c = (x / size) % 2 == 0 ? ((y / size) % 2 == 0 ? a : b) : ((y / size) % 2 == 0 ? b : a);
			texture.put(i + 0, c.getRedByte());
			texture.put(i + 1, c.getGreenByte());
			texture.put(i + 2, c.getBlueByte());
			i += 3;
		}
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:BackgroundLoader.java


示例13: createGradientTexture

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
private void createGradientTexture(final ReadableColor a, final ReadableColor b) {
	float l = 0.0f;
	int i = 0;
	for ( int y = 0; y < HEIGHT; y++ ) {
		for ( int x = 0; x < WIDTH; x++ ) {
			texture.put(i + 0, lerp(a.getRed(), b.getRed(), l));
			texture.put(i + 1, lerp(a.getGreen(), b.getGreen(), l));
			texture.put(i + 2, lerp(a.getBlue(), b.getBlue(), l));
			i += 3;
		}
		l += (1.0f / (HEIGHT - 1));
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:BackgroundLoader.java


示例14: draw

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void draw() {
    GL11.glLoadIdentity();
    GL11.glTranslatef(getXPos(), getYPos(), 0);
    final float angle = body.getAngle() * ANGLE_TO_RAD_COEFFICIENT;
    GL11.glRotatef(angle, 0, 0, 1);
    ReadableColor color1 = nonNull(color) ? color : ReadableColor.WHITE;
    GL11.glColor3f(color1.getRed(), color1.getGreen(), color1.getBlue());
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    this.drawShape();
}
 
开发者ID:kjkrol,项目名称:bam,代码行数:11,代码来源:BaseShape.java


示例15: Circle

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public Circle(Body body, FixtureDef fixtureDef, ReadableColor color, float radius) {
    super(body, fixtureDef, color);
    this.radius = radius;
    int initEdges = (int) (radius / FACTOR_FOUR);
    this.numberOfEdges = initEdges < MINIMUM_EDGES_NUMBER ? MINIMUM_EDGES_NUMBER : initEdges;
    this.x = new float[numberOfEdges];
    this.y = new float[numberOfEdges];
    this.tx = new float[numberOfEdges];
    this.ty = new float[numberOfEdges];
    this.init();
}
 
开发者ID:kjkrol,项目名称:bam,代码行数:12,代码来源:Circle.java


示例16: drawShape

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
@Override
protected void drawShape() {

    GL11.glPointSize(FACTOR_FOUR);
    GL11.glBegin(GL11.GL_POINTS);
    GL11.glVertex2f(0, 0);
    GL11.glVertex2f(0, radius);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINE_LOOP);
    GL11.glVertex2f(0, 0);
    GL11.glVertex2f(0, radius);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINE_LOOP);
    for (int index = 0; index < numberOfEdges; ++index) {
        GL11.glVertex2f(x[index], y[index]);
    }
    GL11.glEnd();

    final ReadableColor color = getColor();
    GL11.glBegin(GL11.GL_POLYGON);
    if (nonNull(color)) {
        GL11.glColor4f(color.getRed(), color.getGreen(), color.getBlue(), HALF);
    }
    for (int index = 0; index < numberOfEdges; ++index) {
        GL11.glVertex2f(x[index], y[index]);
    }

    GL11.glEnd();
}
 
开发者ID:kjkrol,项目名称:bam,代码行数:32,代码来源:Circle.java


示例17: setColor

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void setColor(ReadableColor color) {
  for(int i = 0; i < 9; i++) {
    color.writeARGB(colors);
  }
  
  colors.flip();
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:8,代码来源:ColoredDrawable.java


示例18: setGradient

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void setGradient(ReadableColor color1, ReadableColor color2, GradientType type) {
  switch(type) {
    case vertical:
      setVerticalGradient(color1, color2);
      break;
    case horizontal:
      setHorizontalGradient(color1, color2);
      break;
    case center:
      setCentralGradient(color1, color2);
      break;
  }
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:14,代码来源:ColoredDrawable.java


示例19: setColors

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
public void setColors(ReadableColor[] cols) {
  if(cols.length != 9) {
    throw new IllegalArgumentException();
  }
  
  for(ReadableColor c : cols) {
    c.writeARGB(colors);
  }
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:10,代码来源:ColoredDrawable.java


示例20: clear

import org.lwjgl.util.ReadableColor; //导入依赖的package包/类
/**
 * Löscht die Farbe des Bildes und ersetzt sie durch die angegebene Farbe.
 * @param color
 */
public void clear(ReadableColor color)
{
	setColor(color);
	int temp = blendMode;
	setBlendMode(COMPOSITE_ABSOLUT);
	drawRect(0, 0, rect.width, rect.height, true);
	setBlendMode(temp);
}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:13,代码来源:Image.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SBMLDocument类代码示例发布时间:2022-05-22
下一篇:
Java VirtualDiskFlatVer2BackingInfo类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap