728x90
반응형
728x170
▶ GraphicsDrawable.cs
namespace TestProject;
/// <summary>
/// 그래픽스 그리기 가능형
/// </summary>
public class GraphicsDrawable : IDrawable
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 그리기 - Draw(canvas, dirtyRectangle)
/// <summary>
/// 그리기
/// </summary>
/// <param name="canvas">캔버스</param>
/// <param name="dirtyRectangle">더티 사각형</param>
public void Draw(ICanvas canvas, RectF dirtyRectangle)
{
LinearGradientPaint linearGradientPaint = new LinearGradientPaint
{
StartColor = Colors.Yellow,
EndColor = Colors.Green,
StartPoint = new Point(0, 0),
EndPoint = new Point(1, 1)
};
RectF rectangle = new RectF(50, 50, 250, 250);
canvas.SetFillPaint(linearGradientPaint, rectangle);
canvas.SetShadow(new SizeF(10, 10), 10, Colors.Grey);
canvas.FillRoundedRectangle(rectangle, 10);
}
#endregion
}
728x90
▶ MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestProject">
<ContentPage.Resources>
<local:GraphicsDrawable x:Key="GraphicsDrawableKey" />
</ContentPage.Resources>
<GraphicsView
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="350"
HeightRequest="350"
Drawable="{StaticResource GraphicsDrawableKey}" />
</ContentPage>
728x90
반응형
그리드형(광고전용)
'C# > MAUI' 카테고리의 다른 글
[C#/MAUI] ICanvas 인터페이스 : Rotate 메소드를 사용해 특정 위치를 기준으로 회전 변환하기 (0) | 2022.06.03 |
---|---|
[C#/MAUI] ICanvas 인터페이스 : Rotate 메소드를 사용해 회전 변환하기 (0) | 2022.06.03 |
[C#/MAUI] ICanvas 인터페이스 : Scale 메소드를 사용해 스케일 변환하기 (0) | 2022.06.03 |
[C#/MAUI] ICanvas 인터페이스 : Translate 메소드를 사용해 이동 변환하기 (0) | 2022.06.03 |
[C#/MAUI] RadialGradientPaint 클래스 : 방사형 그라데이션 만들기 (0) | 2022.06.03 |
[C#/MAUI] LinearGradientPaint 클래스 : 대각선 선형 그라데이션 만들기 (0) | 2022.06.03 |
[C#/MAUI] LinearGradientPaint 클래스 : 수직 선형 그라데이션 만들기 (0) | 2022.06.02 |
[C#/MAUI] LinearGradientPaint 클래스 : 수평 선형 그라데이션 만들기 (0) | 2022.06.02 |
[C#/MAUI] LinearGradientPaint 클래스 사용하기 (0) | 2022.06.02 |
[C#/MAUI] PatternPaint 클래스 사용하기 (0) | 2022.06.02 |
[C#/MAUI] ImagePaint 클래스 사용하기 (0) | 2022.06.02 |
댓글을 달아 주세요