Пример #1
0
  protected void applyColor(
      @Nonnull final LayoutContext context,
      @Nonnull final JSONObject properties,
      @Nonnull final Quad quad) {
    final JSON property = context.resolveProperty(properties, "color");

    if (null != property) {
      if (property.isString()) {
        quad.color(Color.valueOf(context.interpolateString(property.stringValue())));
      } else {
        quad.color(property.intValue());
      }
    }
  }
Пример #2
0
  /** {@inheritDoc} */
  @Nonnull
  @Override
  protected DisplayObject newInstance(
      @Nonnull final LayoutContext context, final float width, final float height) {
    final Quad quad = new Quad();

    if (width >= 0.0f) {
      quad.width(width);
    }

    if (height >= 0.0f) {
      quad.height(height);
    }

    return quad;
  }