当前位置: 首页>>代码示例>>C#>>正文


C# BitmapImage.GetBgr24Data方法代码示例

本文整理汇总了C#中System.Windows.Media.Imaging.BitmapImage.GetBgr24Data方法的典型用法代码示例。如果您正苦于以下问题:C# BitmapImage.GetBgr24Data方法的具体用法?C# BitmapImage.GetBgr24Data怎么用?C# BitmapImage.GetBgr24Data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.Imaging.BitmapImage的用法示例。


在下文中一共展示了BitmapImage.GetBgr24Data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TopWallpaperRenderer

        static TopWallpaperRenderer()
        {
            ScreenArea = new Rect(0, 0, 412, 240);

            var defTopAlt = new BitmapImage();
            defTopAlt.BeginInit();
            //defTopAlt.StreamSource = (Stream) Extensions.GetResources(@"TopAlt_DefMask\.png").First().Value;
            defTopAlt.UriSource = new Uri(@"pack://application:,,,/ThemeEditor.WPF;component/Resources/TopAlt_DefMask.png");
            defTopAlt.CacheOption = BitmapCacheOption.OnLoad;
            defTopAlt.EndInit();

            var bgrData = defTopAlt.GetBgr24Data();
            RawTexture rTex = new RawTexture(defTopAlt.PixelWidth, defTopAlt.PixelHeight, RawTexture.DataFormat.A8);
            rTex.Encode(bgrData);
            DefaultTopSquares = new TextureViewModel(rTex, null);

            RenderToolFactory.RegisterTool<PenTool, Pen>
                (key => new Pen(new SolidColorBrush(key.Color)
                {
                    Opacity = key.Opacity
                },
                            key.Width));

            RenderToolFactory.RegisterTool<SolidColorBrushTool, Brush>
                (key => new SolidColorBrush(key.Color)
                {
                    Opacity = key.Opacity
                });

            RenderToolFactory.RegisterTool<LinearGradientBrushTool, Brush>
                (key => new LinearGradientBrush(key.ColorA, key.ColorB, key.Angle)
                {
                    Opacity = key.Opacity
                });

            RenderToolFactory.RegisterTool<ImageBrushTool, Brush>
                (key => new ImageBrush(key.Image)
                {
                    TileMode = key.Mode,
                    ViewportUnits = key.ViewportUnits,
                    Viewport = key.Viewport,
                    Opacity = key.Opacity
                });

            Type ownerType = typeof(TopWallpaperRenderer);
            IsEnabledProperty
                .OverrideMetadata(ownerType, new FrameworkPropertyMetadata(false, OnIsEnabledChanged));

            ClipToBoundsProperty.OverrideMetadata(ownerType,
                new FrameworkPropertyMetadata(true, null, (o, value) => true));
            WidthProperty.OverrideMetadata(ownerType,
                new FrameworkPropertyMetadata(412.0, null, (o, value) => 412.0));
            HeightProperty.OverrideMetadata(ownerType,
                new FrameworkPropertyMetadata(240.0, null, (o, value) => 240.0));

            EffectProperty.OverrideMetadata(ownerType,
                new FrameworkPropertyMetadata(default(WarpEffect),
                    null,
                    (o, value) => ((TopWallpaperRenderer) o).GetWarpEffectInstance()));
        }
开发者ID:cedianoost,项目名称:3DS-Theme-Editor,代码行数:60,代码来源:TopWallpaperRenderer.cs


注:本文中的System.Windows.Media.Imaging.BitmapImage.GetBgr24Data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。