Package de.lessvoid.nifty.render

Examples of de.lessvoid.nifty.render.NiftyImage


    super.makeFlat();
    setTagName("<image>");
    setElementRendererCreator(new ElementRendererCreator() {
      public ElementRenderer[] createElementRenderer(final Nifty nifty) {
        ElementRenderer[] renderer = new ElementRenderer[1];
        NiftyImage niftyImage = null;
//        String filename = getFilename();
//        if (filename != null) {
//          niftyImage = nifty.getRenderEngine().createImage(filename, false); // FIXME filter
//        }
//        renderer[0] = new ImageRenderer(niftyImage);
View Full Code Here


    activeImage.dispose();
    inactiveImage.dispose();
  }

  private NiftyImage loadImage(final String name, final Nifty nifty, final EffectProperties parameter) {
    NiftyImage image = nifty.getRenderEngine().createImage(parameter.getProperty(name), false);

    String areaProviderProperty = new ImageModeHelper().getAreaProviderProperty(parameter);
    String renderStrategyProperty = new ImageModeHelper().getRenderStrategyProperty(parameter);
    if ((areaProviderProperty != null) || (renderStrategyProperty != null)) {
      image.setImageMode(ImageModeFactory.getSharedInstance().createImageMode(areaProviderProperty,
          renderStrategyProperty));
    }

    return image;
  }
View Full Code Here

    ImageRenderer imageRenderer = element.getRenderer(ImageRenderer.class);
    if (imageRenderer == null) {
      return;
    }

    NiftyImage image =
      renderEngine.createImage(
          attributes.get("backgroundImage"),
          attributes.getAsBoolean("filter", Convert.DEFAULT_IMAGE_FILTER));
    if (image == null) {
      return;
    }
   
  String areaProviderProperty = new ImageModeHelper().getAreaProviderProperty(attributes.getAttributes());
  String renderStrategyProperty = new ImageModeHelper().getRenderStrategyProperty(attributes.getAttributes());
    ImageMode imageMode = convert.imageMode(areaProviderProperty, renderStrategyProperty);

    image.setImageMode(imageMode);
    imageRenderer.setImage(image);
  }
View Full Code Here

    ImageRenderer imageRenderer = element.getRenderer(ImageRenderer.class);
    if (imageRenderer == null) {
      return;
    }

    NiftyImage image =
      renderEngine.createImage(
          attributes.get("filename"),
          attributes.getAsBoolean("filter", Convert.DEFAULT_IMAGE_FILTER));
    if (image == null) {
      return;
    }

  String areaProviderProperty = new ImageModeHelper().getAreaProviderProperty(attributes.getAttributes());
  String renderStrategyProperty = new ImageModeHelper().getRenderStrategyProperty(attributes.getAttributes());
    ImageMode imageMode = convert.imageMode(areaProviderProperty, renderStrategyProperty);

    image.setImageMode(imageMode);
    imageRenderer.setImage(image);
   
    imageRenderer.setInset(convert.insetSizeValue(attributes.get("inset"), image.getHeight()));

    Size imageDimension = imageMode.getImageNativeSize(image);
    if (element.getConstraintWidth() == null) {
      element.setConstraintWidth(convert.sizeValue(imageDimension.getWidth() + "px"));
    }
View Full Code Here

    private void updateVisuals() {
        if (images.isEmpty()) {
            return;
        }

        NiftyImage currentImage = images.get(currentImageIndex);
        imageElement.getRenderer(ImageRenderer.class).setImage(currentImage);
        imageElement.setConstraintWidth(new SizeValue(currentImage.getWidth() + "px"));
        imageElement.setConstraintHeight(new SizeValue(currentImage.getHeight() + "px"));
        imageElement.layoutElements();

        if (currentImageIndex == 0) {
            backElement.hide();
            backButtonElement.disable();
View Full Code Here

   * de.lessvoid.nifty.render.NiftyRenderEngine)
   */
  @Override
  public void execute(Element element, float effectTime, Falloff falloff,
      NiftyRenderEngine r) {
    NiftyImage image = element.getRenderer(ImageRenderer.class).getImage();
    String areaProviderProperty = new ImageModeHelper()
        .getAreaProviderProperty("sprite:" + spriteWidth + "," + spriteHeight + ","
            + spriteNo);
    String renderStrategyProperty = new ImageModeHelper()
        .getRenderStrategyProperty("sprite:" + spriteWidth + "," + spriteHeight
            + "," + spriteNo);
    image.setImageMode(ImageModeFactory.getSharedInstance()
        .createImageMode(areaProviderProperty, renderStrategyProperty));
    element.getRenderer(ImageRenderer.class).setImage(image);
  }
View Full Code Here

  public void setProgress(final int maxValue, final int value) {
    int pixelHeight = (int) (imageHeight * ((float) value / maxValue));

    int progressFreeValue = imageHeight - pixelHeight;

    NiftyImage image = progressElement.getRenderer(ImageRenderer.class)
        .getImage();
    String areaProviderProperty = new ImageModeHelper()
        .getAreaProviderProperty("subImage:0," + progressFreeValue
            + ",27," + pixelHeight);
    String renderStrategyProperty = new ImageModeHelper()
        .getRenderStrategyProperty("subImage:0," + progressFreeValue
            + ",27," + pixelHeight);
    image.setImageMode(ImageModeFactory.getSharedInstance()
        .createImageMode(areaProviderProperty, renderStrategyProperty));
    progressElement.getRenderer(ImageRenderer.class).setImage(image);
    progressElement.setConstraintY(new SizeValue(Integer
        .toString(progressFreeValue + 6) + "px"));
    progressElement.setConstraintHeight(new SizeValue(pixelHeight+ "px"));
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.render.NiftyImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.