coordinate_conversion.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2014 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. #ifndef UI_GFX_MAC_COORDINATE_CONVERSION_H_
  5. #define UI_GFX_MAC_COORDINATE_CONVERSION_H_
  6. #import <Foundation/Foundation.h>
  7. #include "ui/gfx/gfx_export.h"
  8. namespace gfx {
  9. class Point;
  10. class Rect;
  11. // Convert a gfx::Rect specified with the origin at the top left of the primary
  12. // display into AppKit secreen coordinates (origin at the bottom left).
  13. GFX_EXPORT NSRect ScreenRectToNSRect(const Rect& rect);
  14. // Convert an AppKit NSRect with origin in the bottom left of the primary
  15. // display into a gfx::Rect with origin at the top left of the primary display.
  16. GFX_EXPORT Rect ScreenRectFromNSRect(const NSRect& point);
  17. // Convert a gfx::Point specified with the origin at the top left of the primary
  18. // display into AppKit screen coordinates (origin at the bottom left).
  19. GFX_EXPORT NSPoint ScreenPointToNSPoint(const Point& point);
  20. // Convert an AppKit NSPoint with origin in the bottom left of the primary
  21. // display into a gfx::Point with origin at the top left of the primary display.
  22. GFX_EXPORT Point ScreenPointFromNSPoint(const NSPoint& point);
  23. } // namespace gfx
  24. #endif // UI_GFX_MAC_COORDINATE_CONVERSION_H_