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

电商网站构建预算方案国际新闻网站

电商网站构建预算方案,国际新闻网站,域名怎么卖,网站自然排名文章目录 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.hrbkazy.com/news/23968.html

相关文章:

  • wordpress实现tab网站建设优化
  • 乐清开发网站公司网站编辑怎么做
  • 如何做网站seo排名优化网络服务提供商
  • 猴哥影院在线电影观看贵阳网站优化公司
  • 做网站的生产方式产品品牌推广策划方案
  • 做电影网站有什么好处和坏处杭州旺道企业服务有限公司
  • 做系统网站百度知道合伙人
  • 用wordpress搭建知名网站自动推广引流app
  • 江苏企业网站建设公司网络推广排名定制
  • 手机h5网站模板市场营销专业就业方向
  • 泉州做网站需要多少钱电脑培训班速成班
  • python网站开发集成环境域名停靠
  • 专业的网站建设公网站的宣传与推广
  • 网站后台管理模板下载wap网站html5
  • 做平面有什么好的网站地推接单平台app排行榜
  • 网站后台登陆密码破解长沙百度推广运营公司
  • 网站推广方案书网站域名解析ip
  • 重庆网站制作服务百度网盘网页版官网
  • 哪个网站做漫画可以有钱推广平台 赚佣金
  • 建一个公司网站要多少钱新闻稿范文300字
  • 浙江住建局官方网站接广告推广的平台
  • 只做自己网站杭州网站优化公司
  • 各类东莞微信网站建设企业网站营销实现方式解读
  • 万润 企业网站建设网络营销
  • wordpress m编辑器seo外包推广
  • wordpress video插件搜索引擎优化方案
  • 专门做win7系统的网站电商营销推广有哪些?
  • 网站建设广州天河区品牌推广文案
  • 做擦边网站免费网站或软件
  • 重庆seo整站优化效果免费制作网站app