/** * Multiply all components with the given factor. * * @param factor factor to multiply * @return new Color with factor applied */ @Nonnull public Alpha multiply(final float factor) { return new Alpha(alpha * factor); }
/** * linear interpolate between this color and the given color. * * @param end end color * @param t t in [0,1] * @return linear interpolated color */ @Nonnull public Alpha linear(@Nonnull final Alpha end, final float t) { return new Alpha(this.alpha + t * (end.alpha - this.alpha)); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { // startColor and endColor (only alpha component used) are the old version of this // and are kept here only for backward compatibility. The current attributes are "start" and "end" alpha values. if (parameter.getProperty("startColor") != null) { start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha()); } if (parameter.getProperty("endColor") != null) { end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha()); } if (parameter.getProperty("start") != null) { start = new Alpha(parameter.getProperty("start")); } if (parameter.getProperty("end") != null) { end = new Alpha(parameter.getProperty("end")); } interpolator = parameter.getInterpolator(); }
@Override public void activate( @Nonnull final Nifty nifty, @Nonnull final Element element, @Nonnull final EffectProperties parameter) { Screen screen = nifty.getCurrentScreen(); if (screen == null) { log.severe("Can't activate effect while there is no active current screen."); return; } image = nifty.getRenderEngine().createImage(screen, parameter.getProperty("filename"), false); if (image == null) { log.severe("Image not found, image overlay effect will not work."); return; } String areaProviderProperty = ImageModeHelper.getAreaProviderProperty(parameter); String renderStrategyProperty = ImageModeHelper.getRenderStrategyProperty(parameter); if ((areaProviderProperty != null) || (renderStrategyProperty != null)) { image.setImageMode(ImageModeFactory.getSharedInstance().createImageMode(areaProviderProperty, renderStrategyProperty)); } alpha = new Alpha(parameter.getProperty("alpha", "#f")); inset = new SizeValue(parameter.getProperty("inset", "0px")); width = new SizeValue(parameter.getProperty("width", element.getWidth() + "px")); height = new SizeValue(parameter.getProperty("height", element.getHeight() + "px")); center = Boolean.valueOf(parameter.getProperty("center", "false")); hideIfNotEnoughSpace = Boolean.valueOf(parameter.getProperty("hideIfNotEnoughSpace", "false")); activeBeforeStartDelay = Boolean.valueOf(parameter.getProperty("activeBeforeStartDelay", "false")); }