當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.Blend方法代碼示例

本文整理匯總了C#中System.Windows.Media.Color.Blend方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.Blend方法的具體用法?C# Color.Blend怎麽用?C# Color.Blend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.Color的用法示例。


在下文中一共展示了Color.Blend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnRender_BackgroundSolidTexture

        private void OnRender_BackgroundSolidTexture(
            DrawingContext dc,
            ImageSource topStatic,
            ImageSource topDynamic,
            float textureOpacity,
            Color background,
            float gradient)
        {
            SetEnableWarp(true);

            var opaque = background;
            var faded = background.Blend(Colors.White, gradient);
            //LinearGradientBrush lgBrush = new LinearGradientBrush(faded, opaque, 90);
            var lgBrush = RenderToolFactory.GetTool<Brush>(new LinearGradientBrushTool(faded, opaque, 90));
            dc.DrawRectangle(lgBrush, null, ScreenArea);

            const int SQ_WIDTH = 66;
            const int SQ_HEIGHT = 66;
            const int SQ_X_OFF = SQ_WIDTH / 3;
            const int SQ_Y_OFF = SQ_HEIGHT / 3;

            var stBrush = RenderToolFactory.GetTool<Brush>
                (new ImageBrushTool(topStatic,
                    TileMode.Tile,
                    new Rect(-SQ_X_OFF, SQ_Y_OFF, SQ_WIDTH, SQ_HEIGHT),
                    BrushMappingMode.Absolute,
                    textureOpacity));
            dc.DrawRectangle(stBrush, null, ScreenArea);

            var off = _isListening
                          ? CompositionTargetEx.SecondsFromStart * 4
                          : (int) (SQ_WIDTH / 2);

            // Dynamic Brush is Constantly Changing
            const float WARP = (float) SQ_WIDTH / SQ_HEIGHT;
            ImageBrush dyBrush = new ImageBrush(topDynamic)
            {
                TileMode = TileMode.Tile,
                ViewportUnits = BrushMappingMode.Absolute,
                Viewport = new Rect(off * WARP - SQ_X_OFF, off + SQ_Y_OFF, SQ_WIDTH, SQ_HEIGHT),
                Opacity = textureOpacity
            };
            dc.DrawRectangle(dyBrush, null, ScreenArea);

            OnRender_3DCorners(dc);
        }
開發者ID:cedianoost,項目名稱:3DS-Theme-Editor,代碼行數:46,代碼來源:TopWallpaperRenderer.cs


注:本文中的System.Windows.Media.Color.Blend方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。