mirror of
https://gitee.com/csharpui/CPF.git
synced 2026-02-27 06:03:10 +08:00
初始化
This commit is contained in:
73
CPF.Windows/GDIPlus/GDIPlusPathGeometry.cs
Normal file
73
CPF.Windows/GDIPlus/GDIPlusPathGeometry.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
#if Net4
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using CPF.Drawing;
|
||||
|
||||
namespace CPF.GDIPlus
|
||||
{
|
||||
public class GDIPlusPathGeometry : IGeometryImpl
|
||||
{
|
||||
Region region;
|
||||
public GDIPlusPathGeometry(PathGeometry path)
|
||||
{
|
||||
region = new Region((path.PathIml as GDIPlusPath).Path);
|
||||
}
|
||||
|
||||
public Region Region
|
||||
{
|
||||
get { return region; }
|
||||
}
|
||||
|
||||
public void Exclude(Geometry geometry)
|
||||
{
|
||||
Region.Exclude((geometry.GeometryImpl as GDIPlusPathGeometry).Region);
|
||||
}
|
||||
|
||||
//public override bool FillContains(Geometry geometry)
|
||||
//{
|
||||
// Geometry.IsVisible()
|
||||
//}
|
||||
|
||||
public bool Contains(CPF.Drawing.Point point)
|
||||
{
|
||||
return Region.IsVisible(point.X, point.Y);
|
||||
}
|
||||
|
||||
public Rect GetRenderBounds()
|
||||
{
|
||||
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
|
||||
{
|
||||
return Region.GetBounds(g).ToRect();
|
||||
}
|
||||
}
|
||||
|
||||
public void Intersect(Geometry geometry)
|
||||
{
|
||||
Region.Intersect((geometry.GeometryImpl as GDIPlusPathGeometry).Region);
|
||||
}
|
||||
|
||||
//public override void Transform(Matrix matrix)
|
||||
//{
|
||||
// Geometry.Transform(matrix.ToMatrix());
|
||||
//}
|
||||
|
||||
public void Union(Geometry geometry)
|
||||
{
|
||||
Region.Union((geometry.GeometryImpl as GDIPlusPathGeometry).Region);
|
||||
}
|
||||
|
||||
public void Xor(Geometry geometry)
|
||||
{
|
||||
Region.Xor((geometry.GeometryImpl as GDIPlusPathGeometry).Region);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
region.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user