Package de.lessvoid.nifty.elements.render

Examples of de.lessvoid.nifty.elements.render.ImageRenderer


    return layer;
  }

  public ElementRenderer[] createPanelRenderer() {
    List < ElementRenderer > renderer = new ArrayList < ElementRenderer >();
    renderer.add(new ImageRenderer());
    renderer.add(new PanelRenderer());
    return renderer.toArray(new ElementRenderer[0]);
  }
View Full Code Here


//        String filename = getFilename();
//        if (filename != null) {
//          niftyImage = nifty.getRenderEngine().createImage(filename, false); // FIXME filter
//        }
//        renderer[0] = new ImageRenderer(niftyImage);
        renderer[0] = new ImageRenderer();
        return renderer;
      }
    });
  }
View Full Code Here

    return image;
  }

  private void changeElementImage(final NiftyImage image) {
    ImageRenderer imageRenderer = element.getRenderer(ImageRenderer.class);
    if (imageRenderer == null) {
      log.warning("this effect can only be applied to images!");
      return;
    }
    imageRenderer.setImage(image);
  }
View Full Code Here

    if (panelRenderer == null) {
      return;
    }
    panelRenderer.setBackgroundColor(convert.color(attributes.get("backgroundColor")));

    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

    if (panelRenderer != null) {
      // panel renderer set means this is a panel and therefore the
      // image attributes here do not apply
      return;
    }
    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

    @Override
    public final void display(final Element listBoxItem, final ChatEntryModelClass item) {
        final Element text = listBoxItem.findElementByName(CHAT_LINE_TEXT);
        final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
        final Element icon = listBoxItem.findElementByName(CHAT_LINE_ICON);
        final ImageRenderer iconRenderer = icon.getRenderer(ImageRenderer.class);
        if (item != null) {
            textRenderer.setText(item.toString());
            iconRenderer.setImage(item.getIcon());
        } else {
            textRenderer.setText("");
            iconRenderer.setImage(null);
        }
    }
View Full Code Here

    @Override
    public final int getWidth(final Element listBoxItem, final ChatEntryModelClass item) {
        final Element text = listBoxItem.findElementByName(CHAT_LINE_TEXT);
        final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
        final Element icon = listBoxItem.findElementByName(CHAT_LINE_ICON);
        final ImageRenderer iconRenderer = icon.getRenderer(ImageRenderer.class);
        return ((textRenderer.getFont() == null) ? 0 : textRenderer.getFont().getWidth(item.getLabel()))
                + ((item.getIcon() == null) ? 0 : item.getIcon().getWidth());
    }
View Full Code Here

    final TextRenderer characterSpeciesRenderer = characterSpecies
        .getRenderer(TextRenderer.class);

    final Element icon = listBoxItem
        .findElementByName("#listbox.character.icon");
    final ImageRenderer iconRenderer = icon
        .getRenderer(ImageRenderer.class);

    if (character != null) {
      characterNameRenderer.setText(character.getName());
      characterSpeciesRenderer.setText(character.getSpecies());
      iconRenderer.setImage(character.getIcon());
    } else {
      characterNameRenderer.setText("");
      characterSpeciesRenderer.setText("");
      iconRenderer.setImage(null);
    }
  }
View Full Code Here

  @Override
  public void display(Element listBoxItem, ListBoxEntryModel item) {
    final Element text = listBoxItem.findElementByName(LISTBOX_LINE_TEXT);
    final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
    final Element icon = listBoxItem.findElementByName(LISTBOX_LINE_ICON);
    final ImageRenderer iconRenderer = icon.getRenderer(ImageRenderer.class);
    if (item != null) {
      textRenderer.setText(item.getLabel());
      iconRenderer.setImage(item.getIcon());
    } else {
      textRenderer.setText("");
      iconRenderer.setImage(null);
    }
  }
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.elements.render.ImageRenderer

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.