/** * Set the color the image is rendered with. * * @param newColor the color of the image * @return the instance of this image initialization script */ public ImageInit setColor(final SpriteColor newColor) { color = new int[4]; color[0] = newColor.getRedi(); color[1] = newColor.getBluei(); color[2] = newColor.getGreeni(); color[3] = newColor.getAlphai(); return this; }
/** * Prepare the widget for the active work. * * @param widget the widget that is prepared */ @Override @SuppressWarnings("nls") public void initWidget(final Widget widget) { if (!(widget instanceof AbstractImage)) { throw new IllegalArgumentException("Init Class requires a image widget"); } if (imageID == -1) { return; } final AbstractImage image = (AbstractImage) widget; final Sprite sprite = MarkerFactory.getInstance().getPrototype(imageID).getSprite(); sprite.setAlign(Sprite.HAlign.left, Sprite.VAlign.bottom); if (color != null) { final SpriteColor newColor = Graphics.getInstance().getSpriteColor(); newColor.set(color[0], color[1], color[2]); newColor.setAlpha(color[3]); image.setColor(newColor); } image.setImage(sprite); }