com.badlogic.gdx.scenes.scene2d.ui.Image.setColor()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setColor()方法的一些代码示例,展示了Image.setColor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.setColor()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Image
类名称:Image
方法名:setColor

Image.setColor介绍

暂无

代码示例

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

private void onBackgroundColorChanged(Color color) {
  imgFill.setColor(color);
}

代码示例来源:origin: kotcrab/vis-editor

@Override
  public void finished (Color newColor) {
    image.setColor(newColor);
  }
});

代码示例来源:origin: Var3D/var3dframe

public void refush() {
  bg.setDrawable(game.getFullTextureRegionDrawable());
  bg.setColor(Color.WHITE);
}

代码示例来源:origin: SquidPony/SquidLib

/**
 * Creates a Image Actor that should look like the glyph '^' in this font, but will be rotate-able.
 * @param color a Color to tint the '^' with
 * @return the Actor, with no position set.
 */
public Image makeDirectionMarker(Color color) {
  if (!initialized) {
    throw new IllegalStateException("This factory has not yet been initialized!");
  }
  Image im = new Image(dirMarker);
  im.setColor(scc.filter(color));
  im.setSize(actualCellWidth, actualCellHeight + (distanceField ? 1 : 0)); //  - lineHeight / actualCellHeight //+ lineTweak * 1f
  im.setOrigin(1); //center
  return im;
}

代码示例来源:origin: SquidPony/SquidLib

/**
 * Converts a TextureRegion into an Image, or if the argument s is null, creates an Image of a solid block. Can be
 * used for preparing images for animation effects. Ensures the returned Image has the given width and height.
 * @param tr a TextureRegion to make into an Actor, which can be null for a solid block.
 * @param color a Color to tint tr with.
 * @return the Actor, with no position set.
 */
public Actor makeActor(TextureRegion tr, Color color, float width, float height) {
  if (!initialized) {
    throw new IllegalStateException("This factory has not yet been initialized!");
  }
  if (tr == null) {
    Image im = new Image(block);
    im.setColor(scc.filter(color));
    im.setSize(width, height);
    // im.setPosition(x - width * 0.5f, y - height * 0.5f, Align.center);
    return im;
  } else {
    Image im = new Image(tr);
    im.setColor(scc.filter(color));
    im.setSize(width, height);
    // im.setPosition(x - width * 0.5f, y - height * 0.5f, Align.center);
    return im;
  }
}

代码示例来源:origin: SquidPony/SquidLib

/**
 * Converts a TextureRegion into an Image, or if the argument s is null, creates an Image of a solid block. Can be
 * used for preparing images for animation effects. Stretches the TextureRegion to match a single cell's dimensions.
 * @param tr a TextureRegion to make into an Actor, which can be null for a solid block.
 * @param color a Color to tint tr with.
 * @return the Actor, with no position set.
 */
public Actor makeActor(TextureRegion tr, Color color) {
  if (!initialized) {
    throw new IllegalStateException("This factory has not yet been initialized!");
  }
  if (tr == null) {
    Image im = new Image(block);
    im.setColor(scc.filter(color));
    im.setSize(width, height);
    // im.setPosition(x - width * 0.5f, y - height * 0.5f, Align.center);
    return im;
  } else {
    Image im = new Image(tr);
    im.setColor(scc.filter(color));
    im.setSize(width, height);
    // im.setPosition(x - width * 0.5f, y - height * 0.5f, Align.center);
    return im;
  }
}

代码示例来源:origin: LonamiWebs/Klooni1010

@Override
public void draw(Batch batch, float parentAlpha) {
  // Always update the style to make sure we're using the right image.
  // This might not always be the case since two buttons can be using
  // the "same" style (except for the image up, i.e. after coming from
  // the customize menu), so make sure to update it always.
  ImageButtonStyle style = getStyle();
  Klooni.theme.updateStyle(style, styleIndex);
  style.imageUp = image;
  getImage().setColor(Klooni.theme.foreground);
  super.draw(batch, parentAlpha);
}

代码示例来源:origin: kotcrab/vis-ui

private void updateImage () {
  Drawable drawable = null;
  if (isDisabled() && style.imageDisabled != null)
    drawable = style.imageDisabled;
  else if (isPressed() && style.imageDown != null)
    drawable = style.imageDown;
  else if (isChecked() && style.imageChecked != null)
    drawable = (style.imageCheckedOver != null && isOver()) ? style.imageCheckedOver : style.imageChecked;
  else if (isOver() && style.imageOver != null)
    drawable = style.imageOver;
  else if (style.imageUp != null)
    drawable = style.imageUp;
  image.setDrawable(drawable);
  if (generateDisabledImage && style.imageDisabled == null && isDisabled())
    image.setColor(Color.GRAY);
  else
    image.setColor(Color.WHITE);
}

代码示例来源:origin: kotcrab/vis-ui

private void updateImage () {
  Drawable drawable = null;
  if (isDisabled() && style.imageDisabled != null)
    drawable = style.imageDisabled;
  else if (isPressed() && style.imageDown != null)
    drawable = style.imageDown;
  else if (isChecked() && style.imageChecked != null)
    drawable = (style.imageCheckedOver != null && isOver()) ? style.imageCheckedOver : style.imageChecked;
  else if (isOver() && style.imageOver != null)
    drawable = style.imageOver;
  else if (style.imageUp != null)
    drawable = style.imageUp;
  image.setDrawable(drawable);
  if (generateDisabledImage && style.imageDisabled == null && isDisabled())
    image.setColor(Color.GRAY);
  else
    image.setColor(Color.WHITE);
}

代码示例来源:origin: SquidPony/SquidLib

im.setColor(scc.filter(color));
} else if(s.length() > 0 && s.charAt(0) == '\0') {
  Image im = new Image(block);
  im.setColor(scc.filter(color));

代码示例来源:origin: kotcrab/vis-ui

protected void updateUI () {
  palette.setPickerHue(verticalBar.getValue());
  newColorImg.setColor(color);
  hexField.setText(color.toString().toUpperCase());
  hexField.setCursorPosition(hexField.getMaxLength());
  if (listener != null) listener.changed(color);
}

代码示例来源:origin: kotcrab/vis-ui

protected void setColor (Color newColor, boolean updateCurrentColor) {
  if (updateCurrentColor) {
    currentColorImg.setColor(new Color(newColor));
    oldColor = new Color(newColor);
  }
  color = new Color(newColor);
  updateValuesFromCurrentColor();
  updateUI();
}

代码示例来源:origin: SquidPony/SquidLib

/**
 * Converts a char into a Label, or if the argument c is '\0', creates an Image of a solid block. Can be used
 * for preparing glyphs for animation effects, and is used internally for this purpose.
 * @param c a char to make into an Actor, which can be the character with Unicode value 0 for a solid block.
 * @param color a Color to tint c with.
 * @return the Actor, with no position set.
 */
public Actor makeActor(char c, Color color) {
  if (!initialized) {
    throw new IllegalStateException("This factory has not yet been initialized!");
  }
  if (c == 0) {
    Image im = new Image(block);
    im.setColor(scc.filter(color));
    //im.setSize(width, height - MathUtils.ceil(bmpFont.getDescent() / 2f));
    im.setSize(actualCellWidth, actualCellHeight + (distanceField ? 1 : 0)); //  - lineHeight / actualCellHeight //+ lineTweak * 1f
    // im.setPosition(x - width * 0.5f, y - height * 0.5f, Align.center);
    return im;
  } else {
    mut.setCharAt(0, getOrDefault(c));
    Label lb = new Label(mut, style);
    lb.setSize(width, height - descent); //+ lineTweak * 1f
    lb.setColor(scc.filter(color));
    return lb;
  }
}

代码示例来源:origin: kotcrab/vis-ui

@Override
public void draw (Batch batch, float parentAlpha) {
  Color fontColor;
  if (isDisabled() && style.disabledFontColor != null)
    fontColor = style.disabledFontColor;
  else if (isPressed() && style.downFontColor != null)
    fontColor = style.downFontColor;
  else if (isChecked() && style.checkedFontColor != null)
    fontColor = (isOver() && style.checkedOverFontColor != null) ? style.checkedOverFontColor : style.checkedFontColor;
  else if (isOver() && style.overFontColor != null)
    fontColor = style.overFontColor;
  else
    fontColor = style.fontColor;
  if (fontColor != null) label.getStyle().fontColor = fontColor;
  if (isDisabled())
    shortcutLabel.getStyle().fontColor = style.disabledFontColor;
  else
    shortcutLabel.getStyle().fontColor = shortcutLabelColor;
  if (image != null && generateDisabledImage) {
    if (isDisabled())
      image.setColor(Color.GRAY);
    else
      image.setColor(Color.WHITE);
  }
  super.draw(batch, parentAlpha);
}

代码示例来源:origin: langurmonkey/gaiasky

@Override
public void draw(Batch batch, float parentAlpha) {
  Color fontColor;
  if (isDisabled() && style.disabledFontColor != null)
    fontColor = style.disabledFontColor;
  else if (isPressed() && style.downFontColor != null)
    fontColor = style.downFontColor;
  else if (isChecked() && style.checkedFontColor != null)
    fontColor = (isOver() && style.checkedOverFontColor != null) ? style.checkedOverFontColor : style.checkedFontColor;
  else if (isOver() && style.overFontColor != null)
    fontColor = style.overFontColor;
  else
    fontColor = style.fontColor;
  if (fontColor != null)
    label.getStyle().fontColor = fontColor;
  if (isDisabled())
    shortcutLabel.getStyle().fontColor = style.disabledFontColor;
  else
    shortcutLabel.getStyle().fontColor = shortcutLabelColor;
  if (image != null && generateDisabledImage) {
    if (isDisabled())
      image.setColor(Color.GRAY);
    else
      image.setColor(Color.WHITE);
  }
  super.draw(batch, parentAlpha);
}

代码示例来源:origin: kotcrab/vis-ui

private VisTable createColorsPreviewTable () {
  VisTable table = new VisTable(false);
  table.add(currentColorImg = new AlphaImage(commons, 5 * sizes.scaleFactor))
      .height(25 * sizes.scaleFactor).width(80 * sizes.scaleFactor).expandX().fillX();
  table.add(new Image(style.iconArrowRight)).pad(0, 2, 0, 2);
  table.add(newColorImg = new AlphaImage(commons, 5 * sizes.scaleFactor))
      .height(25 * sizes.scaleFactor).width(80 * sizes.scaleFactor).expandX().fillX();
  currentColorImg.setColor(color);
  newColorImg.setColor(color);
  currentColorImg.addListener(new ClickListener() {
    @Override
    public void clicked (InputEvent event, float x, float y) {
      restoreLastColor();
    }
  });
  return table;
}

代码示例来源:origin: kotcrab/vis-ui

public TabButtonTable (Tab tab) {
  this.tab = tab;
  button = new VisTextButton(getTabTitle(tab), style.buttonStyle) {
    @Override
    public void setDisabled (boolean isDisabled) {
      super.setDisabled(isDisabled);
      closeButton.setDisabled(isDisabled);
      deselect();
    }
  };
  button.setFocusBorderEnabled(false);
  button.setProgrammaticChangeEvents(false);
  closeButtonStyle = new VisImageButtonStyle(VisUI.getSkin().get("close", VisImageButtonStyle.class));
  closeButton = new VisImageButton(closeButtonStyle);
  closeButton.setGenerateDisabledImage(true);
  closeButton.getImage().setScaling(Scaling.fill);
  closeButton.getImage().setColor(Color.RED);
  addListeners();
  buttonStyle = new VisTextButtonStyle((VisTextButtonStyle) button.getStyle());
  button.setStyle(buttonStyle);
  closeButtonStyle = closeButton.getStyle();
  up = buttonStyle.up;
  add(button);
  if (tab.isCloseableByUser()) {
    add(closeButton).size(14 * sizes.scaleFactor, button.getHeight());
  }
}

代码示例来源:origin: Var3D/var3dframe

img_bg.setHeight(height);
img_bg.setPosition(getWidth() / 2, getHeight() / 2, Align.center);
img_bg.setColor(model.bgColor);

代码示例来源:origin: kotcrab/vis-editor

public TestColorPicker () {
  super("color picker");
  final Image image = new Image(white);
  picker = new ColorPicker("color picker", new ColorPickerAdapter() {
    @Override
    public void finished (Color newColor) {
      image.setColor(newColor);
    }
  });
  VisTextButton showPickerButton = new VisTextButton("show color picker");
  showPickerButton.addListener(new ChangeListener() {
    @Override
    public void changed (ChangeEvent event, Actor actor) {
      getStage().addActor(picker.fadeIn());
    }
  });
  Color c = new Color(27 / 255.0f, 161 / 255.0f, 226 / 255.0f, 1);
  picker.setColor(c);
  image.setColor(c);
  TableUtils.setSpacingDefaults(this);
  add(showPickerButton);
  add(image).size(32).pad(3);
  pack();
  setPosition(948, 148);
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

row();
Image image = new Image(skin.getDrawable("white_pixel"));
image.setColor(skin.getColor("separator-color"));
add(image).height(2).padBottom(4f).expandX().fill();
row().top().left();

相关文章