| 1 | // Aseprite |
| 2 | // Copyright (C) 2020 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2016 David Capello |
| 4 | // |
| 5 | // This program is distributed under the terms of |
| 6 | // the End-User License Agreement for Aseprite. |
| 7 | |
| 8 | #ifndef APP_SNAP_TO_GRID_H_INCLUDED |
| 9 | #define APP_SNAP_TO_GRID_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "gfx/fwd.h" |
| 13 | |
| 14 | namespace app { |
| 15 | |
| 16 | enum class PreferSnapTo { |
| 17 | ClosestGridVertex, |
| 18 | BoxOrigin, BoxEnd, |
| 19 | FloorGrid, CeilGrid, |
| 20 | }; |
| 21 | |
| 22 | gfx::Point snap_to_grid(const gfx::Rect& grid, |
| 23 | const gfx::Point& point, |
| 24 | const PreferSnapTo prefer); |
| 25 | |
| 26 | } // namespace app |
| 27 | |
| 28 | #endif |
| 29 | |