chromium/ui/gfx/geometry/point.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_GEOMETRY_POINT_H_
#define UI_GFX_GEOMETRY_POINT_H_

#include <iosfwd>
#include <string>
#include <tuple>

#include "base/numerics/clamped_math.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/geometry_export.h"
#include "ui/gfx/geometry/vector2d.h"

#if BUILDFLAG(IS_WIN)
typedef unsigned long DWORD;
typedef struct tagPOINT POINT;
#elif BUILDFLAG(IS_APPLE)
typedef struct CGPoint CGPoint;
#endif

namespace gfx {

// A point has an x and y coordinate.
class GEOMETRY_EXPORT Point {};

constexpr bool operator==(const Point& lhs, const Point& rhs) {}

inline bool operator!=(const Point& lhs, const Point& rhs) {}

inline Point operator+(const Point& lhs, const Vector2d& rhs) {}

inline Point operator-(const Point& lhs, const Vector2d& rhs) {}

inline Vector2d operator-(const Point& lhs, const Point& rhs) {}

inline Point PointAtOffsetFromOrigin(const Vector2d& offset_from_origin) {}

inline Point TransposePoint(const gfx::Point& p) {}

// This is declared here for use in gtest-based unit tests but is defined in
// the //ui/gfx:test_support target. Depend on that to use this in your unit
// test. This should not be used in production code - call ToString() instead.
void PrintTo(const Point& point, ::std::ostream* os);

// Helper methods to scale a gfx::Point to a new gfx::Point.
GEOMETRY_EXPORT Point ScaleToCeiledPoint(const Point& point,
                                         float x_scale,
                                         float y_scale);
GEOMETRY_EXPORT Point ScaleToCeiledPoint(const Point& point, float x_scale);
GEOMETRY_EXPORT Point ScaleToFlooredPoint(const Point& point,
                                          float x_scale,
                                          float y_scale);
GEOMETRY_EXPORT Point ScaleToFlooredPoint(const Point& point, float x_scale);
GEOMETRY_EXPORT Point ScaleToRoundedPoint(const Point& point,
                                          float x_scale,
                                          float y_scale);
GEOMETRY_EXPORT Point ScaleToRoundedPoint(const Point& point, float x_scale);

}  // namespace gfx

#endif  // UI_GFX_GEOMETRY_POINT_H_