Added a RadialGradient
This commit is contained in:
Родитель
daebb7f91c
Коммит
80a4327fd6
|
@ -36,6 +36,11 @@ namespace Xwt.CairoBackend
|
|||
return new Cairo.LinearGradient (x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
public object CreateRadial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
|
||||
{
|
||||
return new Cairo.RadialGradient (cx0, cy0, radius0, cx1, cy1, radius1);
|
||||
}
|
||||
|
||||
public void AddColorStop (object backend, double position, Xwt.Drawing.Color color)
|
||||
{
|
||||
Cairo.Gradient g = (Cairo.Gradient) backend;
|
||||
|
|
|
@ -38,6 +38,11 @@ namespace Xwt.Mac
|
|||
{
|
||||
return new GradientInfo () { Linear = true, Start = new Point (x0, y0), End = new Point (x1, y1) };
|
||||
}
|
||||
|
||||
public object CreateRadial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void AddColorStop (object backend, double position, Xwt.Drawing.Color color)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,11 @@ namespace Xwt.WPFBackend
|
|||
new PointF ((float) x1, (float) y1));
|
||||
}
|
||||
|
||||
public object CreateRadial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void AddColorStop (object backend, double position, Color color)
|
||||
{
|
||||
((GradientBase)backend).ColorStops.Add (new Tuple<double, Color> (position, color));
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace Xwt.Backends
|
|||
public interface IGradientBackendHandler: IBackendHandler
|
||||
{
|
||||
object CreateLinear (double x0, double y0, double x1, double y1);
|
||||
object CreateRadial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
|
||||
void AddColorStop (object backend, double position, Color color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// RadialGradient.cs
|
||||
//
|
||||
// Author: Jeffrey Stedfast <jeff@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Jeffrey Stedfast
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using Xwt.Backends;
|
||||
|
||||
namespace Xwt.Drawing
|
||||
{
|
||||
public sealed class RadialGradient: Gradient
|
||||
{
|
||||
public RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
|
||||
{
|
||||
Backend = ((IGradientBackendHandler)BackendHandler).CreateRadial (cx0, cy0, radius0, cx1, cy1, radius1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
@ -133,6 +133,7 @@
|
|||
<Compile Include="Xwt.Drawing\LinearGradient.cs" />
|
||||
<Compile Include="Xwt.Drawing\Pattern.cs" />
|
||||
<Compile Include="Xwt.Drawing\Gradient.cs" />
|
||||
<Compile Include="Xwt.Drawing\RadialGradient.cs" />
|
||||
<Compile Include="Xwt.Drawing\TextLayout.cs" />
|
||||
<Compile Include="Xwt.Drawing\Font.cs" />
|
||||
<Compile Include="Xwt.Backends\IGradientBackendHandler.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче