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_PATH_H_ 6 #define UI_GFX_PATH_H_ 7 8 #include "base/basictypes.h" 9 #include "third_party/skia/include/core/SkPath.h" 10 #include "ui/gfx/gfx_export.h" 11 #include "ui/gfx/native_widget_types.h" 12 13 namespace gfx { 14 15 class GFX_EXPORT Path : public SkPath { 16 public: 17 // Used by Path(Point,size_t) constructor. 18 struct Point { 19 int x; 20 int y; 21 }; 22 struct PointF { 23 float x; 24 float y; 25 }; 26 27 Path(); 28 29 // Creates a path populated with the specified points. 30 Path(const Point* points, size_t count); 31 Path(const PointF* points, size_t count); 32 33 ~Path(); 34 35 #if defined(USE_AURA) || defined(OS_WIN) || defined(USE_X11) 36 // Creates a NativeRegion from the path. The caller is responsible for freeing 37 // resources used by this region. This only supports polygon paths. 38 NativeRegion CreateNativeRegion() const; 39 40 // Returns the intersection of the two regions. The caller owns the returned 41 // object. 42 static gfx::NativeRegion IntersectRegions(gfx::NativeRegion r1, 43 gfx::NativeRegion r2); 44 45 // Returns the union of the two regions. The caller owns the returned object. 46 static gfx::NativeRegion CombineRegions(gfx::NativeRegion r1, 47 gfx::NativeRegion r2); 48 49 // Returns the difference of the two regions. The caller owns the returned 50 // object. 51 static gfx::NativeRegion SubtractRegion(gfx::NativeRegion r1, 52 gfx::NativeRegion r2); 53 #endif 54 55 private: 56 DISALLOW_COPY_AND_ASSIGN(Path); 57 }; 58 59 } 60 61 #endif // UI_GFX_PATH_H_ 62