コード例 #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;
 }
コード例 #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;
  }