0
Files
src/ash/utility
Yuta Hijikata 10616566c8 Replace usage of is_chromeos_ash with is_chromeos in ash/.
Also remove import of ui_mode.gni.

This is part of Lacros sunset.

Bug: 373972275
Change-Id: Id68be2534c6fcdf7c4905151b88df2aa5a451783
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6320613
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Yuta Hijikata <ythjkt@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427521}
2025-03-03 19:09:40 -08:00
..

Ash Utility

Arc Curve Corner

Here is an example arc curve corner:

Alt

An arc curve corner is a corner shape consisting of arcs and lines. It can be specified with the following parameters:

  • width: The width of the arc curve corner. In this example, the width is 10+12+16+20*2=78.
  • height: The height of the arc curve corner. In this example, the height is 8+20+10=38.
  • convex radius: The radius of the convex rounded corner. In this example, this value is 10.
  • concave radius: The radius of the concave rounded corner. In this example, this value is 12.

NOTE: A valid arc curve corner must satisfy

  • width >= 2*convex_radius+concave_radius
  • height >= 2*convex_radius+concave_radius

Draw an arc curve corner in code

GetArcCurveRectPath() accepts three parameters:

  • size: The size of the bounding rectangle with an arc curve corner.
  • arc_curve_corner: An arc curve corner specified by the aforementioned parameters.
  • corner_radius: If given, specifies the corner radius of the corners that are not shaped with an arc curve.

Typically, we clip a view with the path returned by GetArcCurveRectPath() in the overridden OnBoundsChanged() function. For example:

class ViewWithArcCurveCorner : public views::View {
  // ...

  // views::View:
  void OnBoundsChanged(const gfx::Rect& previous_bounds) override {
    SetClipPath(GetArcCurveRectPath(
                            GetContentsBounds().size(),
                            ArcCurveCorner(/*parameters...*/),
                            kCornerRadius));
  }
};