Flutter Engine
The Flutter Engine
rect_conversions.h
Go to the documentation of this file.
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_GFX_GEOMETRY_RECT_CONVERSIONS_H_
6#define UI_GFX_GEOMETRY_RECT_CONVERSIONS_H_
7
8#include "rect.h"
9#include "rect_f.h"
10
11namespace gfx {
12
13// Returns the smallest Rect that encloses the given RectF.
15
16// Similar to ToEnclosingRect(), but for each edge, if the distance between the
17// edge and the nearest integer grid is smaller than |error|, the edge is
18// snapped to the integer grid. Unlike ToNearestRect() which only accepts
19// integer rect with or without floating point error, this function also accepts
20// non-integer rect.
22
23// Returns the largest Rect that is enclosed by the given RectF.
25
26// Similar to ToEnclosedRect(), but for each edge, if the distance between the
27// edge and the nearest integer grid is smaller than |error|, the edge is
28// snapped to the integer grid. Unlike ToNearestRect() which only accepts
29// integer rect with or without floating point error, this function also accepts
30// non-integer rect.
32
33// Returns the Rect after snapping the corners of the RectF to an integer grid.
34// This should only be used when the RectF you provide is expected to be an
35// integer rect with floating point error. If it is an arbitrary RectF, then
36// you should use a different method.
37GFX_EXPORT Rect ToNearestRect(const RectF& rect);
38
39// Returns true if the Rect produced after snapping the corners of the RectF
40// to an integer grid is within |distance|.
42 float distance);
43
44// Returns the Rect after rounding the corners of the RectF to an integer grid.
46
47// Returns a Rect obtained by flooring the values of the given RectF.
48// Please prefer the previous two functions in new code.
50
51} // namespace gfx
52
53#endif // UI_GFX_GEOMETRY_RECT_CONVERSIONS_H_
Definition: rect.h:36
const uint8_t uint32_t uint32_t GError ** error
#define GFX_EXPORT
Definition: gfx_export.h:26
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
Definition: insets.cc:10
Rect ToEnclosingRectIgnoringError(const RectF &r, float error)
Rect ToEnclosingRect(const RectF &r)
gfx::Rect ToRoundedRect(const gfx::RectF &rect)
bool IsNearestRectWithinDistance(const gfx::RectF &rect, float distance)
Rect ToEnclosedRectIgnoringError(const RectF &r, float error)
Rect ToEnclosedRect(const RectF &rect)
Rect ToFlooredRectDeprecated(const RectF &rect)
Rect ToNearestRect(const RectF &rect)
TRect< Scalar > Rect
Definition: rect.h:769