private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            e.RenderTarget.Clear(Color.White);

            e.RenderTarget.FillRectangle(this.ClientRectangle, e.Resources["bitmap"]);

            e.RenderTarget.FillGeometry(e.Resources["sun geometry"], e.Resources["grad"]);

            e.Resources["brush"].SetColor(Color.Black);
            e.RenderTarget.DrawGeometry(e.Resources["sun geometry"], e.Resources["brush"], 1.0f);

            // 左の山
            e.Resources["brush"].SetColor(Color.OliveDrab);
            e.RenderTarget.FillGeometry(e.Resources["left mountain"], e.Resources["brush"]);
            e.Resources["brush"].SetColor(Color.Black);
            e.RenderTarget.DrawGeometry(e.Resources["left mountain"], e.Resources["brush"], 1.0f);

            // 川
            e.Resources["brush"].SetColor(Color.LightSkyBlue);
            e.RenderTarget.FillGeometry(e.Resources["river geometry"], e.Resources["brush"]);
            e.Resources["brush"].SetColor(Color.Black);
            e.RenderTarget.DrawGeometry(e.Resources["river geometry"], e.Resources["brush"], 1.0f);

            // 右の山
            e.Resources["brush"].SetColor(Color.YellowGreen);
            e.RenderTarget.FillGeometry(e.Resources["right mountain"], e.Resources["brush"]);
            e.Resources["brush"].SetColor(Color.Black);
            e.RenderTarget.DrawGeometry(e.Resources["right mountain"], e.Resources["brush"], 1.0f);
        }
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            var rcBrushRect = new RectangleF(0, 0, 205, 141);

            // 背景色塗り潰し
            e.RenderTarget.Clear(Color.White);

            // オリジナルビットマップ
            e.RenderTarget.SetTransform(5, 5);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["original"]);

            // マスクビットマップ
            e.RenderTarget.SetTransform(255, 5);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["mask"]);

            // 重ね合わせ
            e.RenderTarget.SetTransform(500, 5);
            e.RenderTarget.SetAntialiasMode(AntialiasMode.ANTIALIAS_MODE_ALIASED);

            e.RenderTarget.FillOpacityMask(e.Resources["mask bitmap"],
                                           e.Resources["original"],
                                           OpacityMaskContent.OPACITY_MASK_CONTENT_GRAPHICS,
                                           rcBrushRect);

            e.RenderTarget.SetAntialiasMode(AntialiasMode.ANTIALIAS_MODE_PER_PRIMITIVE);
        }
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            e.RenderTarget.Clear(Color.White);

            // レイヤークリップ前
            e.RenderTarget.SetTransform(50, 50);
            e.RenderTarget.DrawBitmap(e.Resources["fish bitmap"], new RectangleF(0, 0, 205, 141));
            e.RenderTarget.FillRectangle(new RectangleF(0, 0, 25, 25), e.Resources["brush"]);
            e.RenderTarget.FillRectangle(new RectangleF(25, 25, 25, 25), e.Resources["brush"]);
            e.RenderTarget.FillRectangle(new RectangleF(50, 50, 25, 25), e.Resources["brush"]);
            e.RenderTarget.FillRectangle(new RectangleF(75, 75, 25, 25), e.Resources["brush"]);
            e.RenderTarget.FillRectangle(new RectangleF(100, 100, 25, 25), e.Resources["brush"]);
            e.RenderTarget.FillRectangle(new RectangleF(125, 125, 25, 25), e.Resources["brush"]);

            // レイヤークリップ後
            e.RenderTarget.SetTransform(350, 50);
            using (var layer = e.RenderTarget.CreateLayer()) {
                layer.Parameters.GeometricMask = e.Resources["path geometry"];
                e.RenderTarget.PushLayer(layer);

                e.RenderTarget.DrawBitmap(e.Resources["fish bitmap"], new RectangleF(0, 0, 205, 141));
                e.RenderTarget.FillRectangle(new RectangleF(0, 0, 25, 25), e.Resources["brush"]);
                e.RenderTarget.FillRectangle(new RectangleF(25, 25, 25, 25), e.Resources["brush"]);
                e.RenderTarget.FillRectangle(new RectangleF(50, 50, 25, 25), e.Resources["brush"]);
                e.RenderTarget.FillRectangle(new RectangleF(75, 75, 25, 25), e.Resources["brush"]);
                e.RenderTarget.FillRectangle(new RectangleF(100, 100, 25, 25), e.Resources["brush"]);
                e.RenderTarget.FillRectangle(new RectangleF(125, 125, 25, 25), e.Resources["brush"]);

                e.RenderTarget.PopLayer();
            }
        }
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            e.RenderTarget.Clear(Color.White);

            // ブラシ塗りつぶし矩形領域
            var rcBrushRect = new RectangleF(0, 0, 148, 148);

            //-------------------------
            // リニアグラデーション
            e.RenderTarget.SetTransform(5, 5);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["linearFadeFlowersBitmap"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            e.RenderTarget.SetTransform(205, 5);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["linearGradientBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            // 不透明マスクとして線形グラデーションブラシを使用
            e.RenderTarget.SetTransform(405, 5);
            e.RenderTarget.FillGeometry(e.Resources["rectGeo"], e.Resources["linearFadeFlowersBitmap"], e.Resources["linearGradientBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            //-------------------------
            // ラジアルグラデーション
            e.RenderTarget.SetTransform(5, 205);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["radialFadeFlowersBitmapBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            e.RenderTarget.SetTransform(205, 205);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["radialGradientBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            // 不透明マスクとして放射グラデーションブラシを使用
            e.RenderTarget.SetTransform(405, 205);
            e.RenderTarget.FillGeometry(e.Resources["rectGeo"], e.Resources["radialFadeFlowersBitmapBrush"], e.Resources["radialGradientBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            //-------------------------
            // ビットマップマスク
            e.RenderTarget.SetTransform(5, 405);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["fernBitmapBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            e.RenderTarget.SetTransform(205, 405);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["bitmapMaskBrush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);

            // 不透明マスクとしてビットマップブラシを使用
            e.RenderTarget.SetTransform(405, 405);
            e.RenderTarget.SetAntialiasMode(AntialiasMode.ANTIALIAS_MODE_ALIASED);
            e.RenderTarget.FillOpacityMask(e.Resources["bitmapMask"],
                                           e.Resources["fernBitmapBrush"],
                                           OpacityMaskContent.OPACITY_MASK_CONTENT_GRAPHICS,
                                           rcBrushRect);
            e.RenderTarget.SetAntialiasMode(AntialiasMode.ANTIALIAS_MODE_PER_PRIMITIVE);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["blackBrush"], 1);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            // 背景色塗り潰し
            e.RenderTarget.Clear(Color.White);

            e.RenderTarget.PushAxisAlignedClip(
                new RectangleF(0, 0,
                               this.mainControl.Width - (this.verticalBar.Visible ? BarSize : 0),
                               this.mainControl.Height - (this.horizontalBar.Visible ? BarSize : 0)),
                AntialiasMode.ANTIALIAS_MODE_ALIASED
                );

            // スクロール量に合わせて位置を変更
            e.RenderTarget.SetTransform(
                Matrix.Scale((this.zoom / 100.0f), (this.zoom / 100.0f)) *
                Matrix.Translation(-this.horizontalBar.Value, -this.verticalBar.Value)
                );

            // 画像リソースを保持していたら描画する
            if (e.Resources.HasResource(BITMAP_NAME))
            {
                e.RenderTarget.DrawBitmap(e.Resources[BITMAP_NAME]);
            }

            //
            e.RenderTarget.SetTransform();
            if (this.clickPos.X >= 0 && this.clickPos.Y >= 0)
            {
                int x1, x2, y1, y2;
                if (this.clickPos.X < this.dragPos.X)
                {
                    x1 = this.clickPos.X;
                    x2 = this.dragPos.X;
                }
                else
                {
                    x2 = this.clickPos.X;
                    x1 = this.dragPos.X;
                }
                if (this.clickPos.Y < this.dragPos.Y)
                {
                    y1 = this.clickPos.Y;
                    y2 = this.dragPos.Y;
                }
                else
                {
                    y2 = this.clickPos.Y;
                    y1 = this.dragPos.Y;
                }
                e.RenderTarget.DrawRectangle(new RectangleF(x1, y1, x2 - x1, y2 - y1), e.Resources[LABER_BAND_CLR_NAME], 2);
            }

            e.RenderTarget.PopAxisAlignedClip();
        }
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            // 背景色を塗りつぶす
            e.RenderTarget.Clear(Color.White);

            var rcBrushRect = new RectangleF(0, 0, 378, 284);

            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["bitmap"]);

            e.RenderTarget.SetTransform(420, 0);
            e.RenderTarget.PushAxisAlignedClip(new RectangleF(100, 20, 100, 100), AntialiasMode.ANTIALIAS_MODE_PER_PRIMITIVE);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["bitmap"]);
            e.RenderTarget.PopAxisAlignedClip();
        }
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            e.RenderTarget.Clear(Color.White);
            e.RenderTarget.SetTransform(20, 20);

            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 10);
            e.RenderTarget.FillGeometry(e.Resources["path geometry"], e.Resources["LGBrush"]);

            var sz = Matrix.Scale(0.5f, 0.5f);
            var tn = Matrix.Translation(this.Width / 2 - 50.0f, this.Height / 2 - 50.0f);

            e.RenderTarget.SetTransform(sz * tn);

            e.RenderTarget.FillGeometry(e.Resources["path geometry"], e.Resources["LGBrush"]);
            e.RenderTarget.FillGeometry(e.Resources["trans geometry"], e.Resources["LGBrush"]);
        }
Beispiel #8
0
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            var rcBrushRect            = new RectangleF(5, 0, 150, 150);
            var rcTransformedBrushRect = new RectangleF(100, 100, 100, 100);

            // 背景塗りつぶし
            e.RenderTarget.Clear(Color.White);

            // オリジナル画像
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["bitmap"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["brush"], 1);

            // 部分描画
            e.RenderTarget.FillRectangle(rcTransformedBrushRect, e.Resources["bitmap"]);

            // 部分を移動して描画
            e.Resources["bitmap"].SetTransform(Matrix.Translation(50, 50));
            e.RenderTarget.FillRectangle(rcTransformedBrushRect, e.Resources["bitmap"]);
            e.RenderTarget.DrawRectangle(rcTransformedBrushRect, e.Resources["brush"], 1);
        }
Beispiel #9
0
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            // ブラシで塗りつぶす矩形の形状を定義する
            var rcBrushRect = new RectangleF(5, 0, 150, 150);

            // キャプションが描画される領域を定義する
            var rcTextRect = new RectangleF(5, 165, 175, 200);

            // 背景色を塗りつぶす
            e.RenderTarget.Clear(Color.White);

            // 単色ブラシ
            e.RenderTarget.SetTransform(5, 5);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["yellow brush"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["brush"], 1);
            e.RenderTarget.DrawText("ID2D1SolidColorBrush", e.Resources["text format"], rcTextRect, e.Resources["brush"]);

            // ライングラデーションブラシ
            e.RenderTarget.SetTransform(200, 5);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["line"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["brush"], 1);
            e.RenderTarget.DrawText("ID2D1LinearGradientBrush", e.Resources["text format"], rcTextRect, e.Resources["brush"]);

            // 放射グラデーションブラシ
            e.RenderTarget.SetTransform();
            e.RenderTarget.SetTransform(5, 200);

            var ellipse = new Ellipse(new PointF(75.0f, 75.0f), 75.0f, 75.0f);

            e.RenderTarget.FillEllipse(ellipse, e.Resources["radial"]);
            e.RenderTarget.DrawEllipse(ellipse, e.Resources["brush"], 1);
            e.RenderTarget.DrawText("ID2D1RadialGradientBrush", e.Resources["text format"], rcTextRect, e.Resources["brush"]);

            // ビットマップブラシ
            e.RenderTarget.SetTransform(200, 200);
            e.RenderTarget.FillRectangle(rcBrushRect, e.Resources["bitmap"]);
            e.RenderTarget.DrawRectangle(rcBrushRect, e.Resources["brush"], 1);
            e.RenderTarget.DrawText("ID2D1BitmapBrush", e.Resources["text format"], rcTextRect, e.Resources["brush"]);
        }
        private void mainControl_VisualRenderEvent(object sender, VisualTree.VisualRenderEventArgs e)
        {
            // 背景クリア
            e.RenderTarget.Clear(Color.White);

            // 背景描画
            e.RenderTarget.FillRectangle(new RectangleF(0, 0, this.mainControl.Width, this.mainControl.Height), e.Resources["grid pattern"]);

            // Line Join Styles
            e.RenderTarget.SetTransform(10, 20);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidMiter"]);
            e.RenderTarget.DrawText("Miter Line Join", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            e.RenderTarget.SetTransform(10, 210);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidBevel"]);
            e.RenderTarget.DrawText("Bevel Line Join", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            e.RenderTarget.SetTransform(230, 20);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidRoundwRoundCap"]);
            e.RenderTarget.DrawText("Round Line Join", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            e.RenderTarget.SetTransform(230, 210);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidMiterOrBevel"]);
            e.RenderTarget.DrawText("Miter or Bevel Line Join", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            // Cap Styles
            e.RenderTarget.SetTransform(480, 20);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidRoundwRoundCap"]);
            e.RenderTarget.DrawText("Round Caps", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            e.RenderTarget.SetTransform(700, 20);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidRoundwFlatCap"]);
            e.RenderTarget.DrawText("Flat Caps", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            e.RenderTarget.SetTransform(480, 210);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidRoundwSquareCap"]);
            e.RenderTarget.DrawText("Square Caps", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            e.RenderTarget.SetTransform(700, 210);
            e.RenderTarget.DrawRectangle(new RectangleF(0.0f, 0.0f, 180.0f, 150.0f), e.Resources["brush"], 1);
            e.RenderTarget.DrawGeometry(e.Resources["path geometry"], e.Resources["brush"], 16, e.Resources["strokeStyleSolidRoundwTriangleCap"]);
            e.RenderTarget.DrawText("Triangle Caps", e.Resources["text format"], new RectangleF(2, 150, 215, 215), e.Resources["brush"]);

            // Dash Styles
            e.RenderTarget.SetTransform(Matrix.Translation(10, 405));
            e.RenderTarget.DrawLine(new PointF(0, 10), new PointF(200, 10), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleSolidMiter"]);
            e.RenderTarget.DrawText("Dash Style -- Solid", e.Resources["text format"], new RectangleF(0, 20, 200, 315), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 70), new PointF(200, 70), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleDash"]);
            e.RenderTarget.DrawText("Dash Style -- Dash", e.Resources["text format"], new RectangleF(0, 80, 200, 315), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 130), new PointF(200, 130), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleDot"]);
            e.RenderTarget.DrawText("Dash Style -- Dot", e.Resources["text format"], new RectangleF(0, 140, 200, 315), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 190), new PointF(200, 190), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleDashDot"]);
            e.RenderTarget.DrawText("Dash Style -- Dash Dot", e.Resources["text format"], new RectangleF(0, 200, 200, 315), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 250), new PointF(200, 250), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleDashDotDot"]);
            e.RenderTarget.DrawText("Dash Style -- Dash Dot Dot", e.Resources["text format"], new RectangleF(0, 260, 200, 315), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 310), new PointF(200, 310), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleCustomOffsetZero"]);
            e.RenderTarget.DrawText("Dash Style -- Custom", e.Resources["text format"], new RectangleF(0, 320, 200, 315), e.Resources["brush"]);

            // Dash Offsets
            e.RenderTarget.SetTransform(Matrix.Translation(300, 405));
            e.RenderTarget.DrawLine(new PointF(0, 10), new PointF(200, 10), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleCustomOffsetNegTwo"]);
            e.RenderTarget.DrawText("-2", e.Resources["text format"], new RectangleF(0, 20, 200, 295), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 70), new PointF(200, 70), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleCustomOffsetNegOne"]);
            e.RenderTarget.DrawText("-1", e.Resources["text format"], new RectangleF(0, 80, 200, 295), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 130), new PointF(200, 130), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleCustomOffsetZero"]);
            e.RenderTarget.DrawText("-0", e.Resources["text format"], new RectangleF(0, 140, 200, 295), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 190), new PointF(200, 190), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleCustomOffsetPosOne"]);
            e.RenderTarget.DrawText("1", e.Resources["text format"], new RectangleF(0, 200, 200, 295), e.Resources["brush"]);

            e.RenderTarget.DrawLine(new PointF(0, 250), new PointF(200, 250), e.Resources["cornflower blue"],
                                    10, e.Resources["strokeStyleCustomOffsetPosTwo"]);
            e.RenderTarget.DrawText("2", e.Resources["text format"], new RectangleF(0, 260, 200, 295), e.Resources["brush"]);
        }