当前位置: 首页 > news >正文

哪个网站做外贸好今天最近的新闻

哪个网站做外贸好,今天最近的新闻,10g网站流量,辽宁城乡建设招投标交易平台文章目录 XAML.CSToBytes方法使用效果 常试过AcrylicView.MAUI和Sharpnado.MaterialFrame&#xff0c;对于二者教程很少&#xff0c;使用直接写控件然后调属性&#xff0c;没有报错但也并没有效果所幸就自己写一个 XAML <?xml version"1.0" encoding"utf-…

在这里插入图片描述

文章目录

  • XAML
  • .CS
  • ToBytes方法
  • 使用
  • 效果

常试过AcrylicView.MAUI和Sharpnado.MaterialFrame,对于二者教程很少,使用直接写控件然后调属性,没有报错但也并没有效果所幸就自己写一个

XAML

<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"x:Class="Namespace.BackgroundBlurView"xmlns:skia="clr-namespace:SkiaSharp.Views.Maui.Controls;assembly=SkiaSharp.Views.Maui.Controls"
><ContentView.Content><Grid RowDefinitions="*"><skia:SKCanvasView  Grid.Row="0"x:Name="canvasView"HorizontalOptions="Fill"PaintSurface="OnCanvasViewPaintSurface"VerticalOptions="Fill" /></Grid></ContentView.Content>
</ContentView>

.CS

using CSharpFunctionalExtensions;
using SkiaSharp;
using SkiaSharp.Views.Maui;namespace Namespace ;public partial class BackgroundBlurView : ContentView
{#region 可绑定属性public static readonly BindableProperty PathProperty =BindableProperty.Create(propertyName: nameof(Path),returnType: typeof(string),declaringType: typeof(BackgroundBlurView),defaultBindingMode: BindingMode.OneWay,propertyChanged: PathPropertyChanged);public string Path{get { return (string)base.GetValue(PathProperty); }set { base.SetValue(PathProperty, value); }}private static void PathPropertyChanged(BindableObject bindable, object oldValue, object newValue){var control = (BackgroundBlurView)bindable;MainThread.BeginInvokeOnMainThread(() =>{control.canvasView.InvalidateSurface();});}#endregionbyte[] _musicbgBytes;public BackgroundBlurView(){InitializeComponent();}void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args){SKImageInfo info = args.Info;SKSurface surface = args.Surface;SKCanvas canvas = surface.Canvas;canvas.Clear();float sigmaX = 20f;float sigmaY = 20f;using (SKPaint paint = new SKPaint()){// Set SKPaint propertiespaint.ImageFilter = SKImageFilter.CreateBlur(sigmaX, sigmaY);// Calculate rectangle for bitmapSKRect bitmapRect = new SKRect(0, 0, info.Width, info.Height);//bitmapRect.Inflate(-50, -50);using var stream = FileSystem.OpenAppPackageFileAsync("imgs/"+ Path).Result;_musicbgBytes = stream.ToBytes();if (_musicbgBytes==null){return;}SKBitmap bitmap = SKBitmap.Decode(_musicbgBytes);//SKBitmap.Decode("/Resources/Images/music/yinhe_bg.png");canvas.DrawBitmap(bitmap, bitmapRect, paint: paint);}}
}

ToBytes方法

public static byte[] ToBytes(this Stream stream)
{MemoryStream memoryStream = new MemoryStream();stream.CopyTo(memoryStream);return memoryStream.ToArray();
}

使用

        <view:BackgroundBlurView VerticalOptions="Fill" HorizontalOptions="Fill" Padding="-10" Path="{Binding BGImg}"></view:BackgroundBlurView>

效果

在这里插入图片描述

http://www.yidumall.com/news/25.html

相关文章:

  • 便宜做网站公司百度统计怎么用
  • wordpress 微软雅黑字体seo如何优化的
  • 广州网站设计首选柚米站长资讯
  • 厦门网直播赣州seo培训
  • 轻淘客一键做网站东莞免费网站建设网络营销
  • 广东企业微信网站建设手机seo关键词优化
  • 网站建设案例信息北京seo优化哪家好
  • 代理网站备案表汽车网络营销的方式有哪些
  • 可以搜索附近手机的软件seo排名优化是什么
  • 个人网站做微擎百度主页入口
  • 进入建设银行的网站就打不了字优化设计五年级下册数学答案
  • net网站开发手机网站网络销售怎么学
  • 招聘网站怎么做效果好怎么推广自己的网站
  • 建站网站平台b站推广入口2023年
  • 惠州模板网站线下广告投放渠道都有哪些
  • 免费网站模板建站官网排名优化
  • 哪家公司做网站天津网络推广seo
  • 婚庆网站建设需求分析个人怎么做免费百度推广
  • 罗湖网站建设罗湖网站设计怎么优化自己公司的网站
  • 建设英文版网站优化设计四年级上册语文答案