Exemplo n.º 1
0
 /**
  * Returns the colors for brighter parts of each side for a particular decoration style
  *
  * @param style
  * @return Returns
  */
 public BorderPropertySet darken(IdentValue style) {
   BorderPropertySet bc = new BorderPropertySet(this);
   bc._topColor = _topColor == null ? null : _topColor.darkenColor();
   bc._bottomColor = _bottomColor == null ? null : _bottomColor.darkenColor();
   bc._leftColor = _leftColor == null ? null : _leftColor.darkenColor();
   bc._rightColor = _rightColor == null ? null : _rightColor.darkenColor();
   return bc;
 }
Exemplo n.º 2
0
  public BorderPropertySet normalizedInstance(Rectangle bounds) {
    float factor = 1;

    // top
    factor = Math.min(factor, bounds.width / getSideWidth(_topLeft, _topRight, bounds.width));
    // bottom
    factor = Math.min(factor, bounds.width / getSideWidth(_bottomRight, _bottomLeft, bounds.width));
    // right
    factor = Math.min(factor, bounds.height / getSideWidth(_topRight, _bottomRight, bounds.height));
    // left
    factor =
        Math.min(factor, bounds.height / getSideWidth(_bottomLeft, _bottomRight, bounds.height));

    BorderPropertySet newPropSet =
        new BorderPropertySet(
            _top,
            _right,
            _bottom,
            _left,
            new BorderRadiusCorner(
                factor * _topLeft.getMaxLeft(bounds.height),
                factor * _topLeft.getMaxRight(bounds.width)),
            new BorderRadiusCorner(
                factor * _topRight.getMaxLeft(bounds.width),
                factor * _topRight.getMaxRight(bounds.height)),
            new BorderRadiusCorner(
                factor * _bottomRight.getMaxLeft(bounds.height),
                factor * _bottomRight.getMaxRight(bounds.width)),
            new BorderRadiusCorner(
                factor * _bottomLeft.getMaxLeft(bounds.width),
                factor * _bottomLeft.getMaxRight(bounds.height)));

    newPropSet._topColor = _topColor;
    newPropSet._rightColor = _rightColor;
    newPropSet._bottomColor = _bottomColor;
    newPropSet._leftColor = _leftColor;

    newPropSet._topStyle = _topStyle;
    newPropSet._rightStyle = _rightStyle;
    newPropSet._bottomStyle = _bottomStyle;
    newPropSet._leftStyle = _leftStyle;

    return newPropSet;
  }
Exemplo n.º 3
0
  public BorderPropertySet(BorderPropertySet border) {
    this(border.top(), border.right(), border.bottom(), border.left());
    this._topStyle = border.topStyle();
    this._rightStyle = border.rightStyle();
    this._bottomStyle = border.bottomStyle();
    this._leftStyle = border.leftStyle();

    this._topColor = border.topColor();
    this._rightColor = border.rightColor();
    this._bottomColor = border.bottomColor();
    this._leftColor = border.leftColor();

    this._topLeft = border._topLeft;
    this._topRight = border._topRight;
    this._bottomLeft = border._bottomLeft;
    this._bottomRight = border._bottomRight;
  }
Exemplo n.º 4
0
  public BorderPropertySet(
      BorderPropertySet top,
      BorderPropertySet right,
      BorderPropertySet bottom,
      BorderPropertySet left) {
    this((top.width() + 1) / 2, right.width() / 2, bottom.width() / 2, (left.width() + 1) / 2);

    this._topStyle = top.topStyle();
    this._rightStyle = right.rightStyle();
    this._bottomStyle = bottom.bottomStyle();
    this._leftStyle = left.leftStyle();

    this._topColor = top.topColor();
    this._rightColor = right.rightColor();
    this._bottomColor = bottom.bottomColor();
    this._leftColor = left.leftColor();

    this._topLeft = new BorderRadiusCorner();
    this._topRight = new BorderRadiusCorner();
    this._bottomLeft = new BorderRadiusCorner();
    this._bottomRight = new BorderRadiusCorner();
  }