コード例 #1
0
ファイル: ChainLink.cs プロジェクト: hexafluoride/linkgen
        private void DrawTopPlate()
        {
            if (TopPlate == PlateType.Text)
            {
                var text = GetText();

                PrepareForPlate(text, Plate.Top, Gravity.West);

                text.Scale(new Percentage(((MainImage.Height / 2d)) / text.Height * 90d));
                //text.Write("text-plate-modified.png");

                MainImage.Composite(text, /*Scale(570, 310)*/ new PointD((((MainImage.Width - (Scale(FrameThickness + FrameMargin * 2))) - text.Width) / 2) + Scale(FrameMargin + FrameThickness), Scale(FrameMargin + FrameThickness)), CompositeOperator.Over);
            }
            else if (TopPlate == PlateType.Image)
            {
                //TopPlateImage.Scale(new Percentage(((MainImage.Width / 2d)) / TopPlateImage.Width * 100d));
                PrepareForPlate(TopPlateImage, Plate.Top);
                TopPlateImage.Scale(new Percentage(((MainImage.Height / 2d)) / TopPlateImage.Height * TopPlateImagePercentage));

                MainImage.Composite(TopPlateImage, /*Scale(570, 310)*/ new PointD((((MainImage.Width - (Scale((FrameMargin + FrameMargin) * 2))) - TopPlateImage.Width) / 2) + Scale(FrameMargin + FrameThickness), /*Scale(FrameMargin) + */ (((100d - TopPlateImagePercentage) / 200d) * Center.Y)), CompositeOperator.Over);
            }
            else if (TopPlate == PlateType.Empty)
            {
                return;
            }
        }
コード例 #2
0
ファイル: ChainLink.cs プロジェクト: hexafluoride/linkgen
        private void DrawRightPlate()
        {
            double total_height = LeftBottom.Y - LeftTop.Y;

            if (RightPlate == PlateType.Lock)
            {
                var lock_outer = LoadInternalImage("lock-outer.png");
                var lock_inner = LoadInternalImage("lock-inner.png");
                //lock_img.Tint("100", LockColor);
                lock_inner.Colorize(InnerLockColor, new Percentage(100));
                lock_outer.Colorize(OuterLockColor, new Percentage(100));
                lock_inner.Scale(new Percentage((MainImage.Width / 4d) / lock_inner.Width * 100d));
                lock_outer.Scale(new Percentage((MainImage.Width / 4d) / lock_outer.Width * 100d));

                PrepareForPlate(lock_inner, Plate.Right);
                PrepareForPlate(lock_outer, Plate.Right);

                /*////lock_img.ColorFuzz = new Percentage(10);
                 * ////lock_img.Transparent(new MagickColor("black"));
                 * ////lock_img.ColorFuzz = new Percentage(0);
                 * //lock_inner.BackgroundColor = new MagickColor(65535, 65535, 65535, 0);
                 * ////lock_img.Tint("100", LockColor);
                 * //lock_inner.Shear(30, 0);
                 * //lock_inner.Rotate(-30);
                 * //lock_inner.Trim();
                 * //lock_inner.Write("./inner.png");
                 * //lock_outer.BackgroundColor = new MagickColor(65535, 65535, 65535, 0);
                 * ////lock_img.Tint("100", LockColor);
                 * //lock_outer.Shear(30, 0);
                 * //lock_outer.Rotate(-30);
                 * //lock_outer.Trim();
                 * //lock_outer.Write("./outer.png");*/
                MainImage.Composite(lock_outer, /*Scale(MainImage, 1646, 1426)*/ new PointD(Top.X + (((MainImage.Width / 2) - lock_outer.Width) / 2), (((Center.Y + LeftTop.Y) / 2d) + ((total_height - lock_outer.Height) / 2d))), CompositeOperator.Over);
                MainImage.Composite(lock_inner, /*Scale(MainImage, 1646, 1426)*/ new PointD(Top.X + (((MainImage.Width / 2) - lock_outer.Width) / 2), (((Center.Y + LeftTop.Y) / 2d) + ((total_height - lock_inner.Height) / 2d))), CompositeOperator.Over);
            }
            else if (RightPlate == PlateType.Image)
            {
                //RightPlateImage.Scale(new Percentage(((MainImage.Width / 2d)) / RightPlateImage.Width * 100d));
                PrepareForPlate(RightPlateImage, Plate.Right);
                RightPlateImage.Scale(new Percentage((Bottom.Y - LeftTop.Y) / RightPlateImage.Height * RightPlateImagePercentage));

                //MainImage.Composite(TopPlateImage, /*Scale(570, 310)*/new PointD((MainImage.Width - RightPlateImage.Width) / 2, Scale(FrameMargin)), CompositeOperator.Over);

                //MainImage.Composite(RightPlateImage, /*Scale(MainImage, 1646, 1426)*/new PointD(Top.X + (MainImage.Width / 8d), (((Center.Y + LeftTop.Y) / 2d) + ((total_height - RightPlateImage.Height) / 2d) + MainImage.Height / 64d)), CompositeOperator.Over);
                MainImage.Composite(RightPlateImage, new PointD(Top.X + (((MainImage.Width / 2) - RightPlateImage.Width) / 2), LeftTop.Y + (((Bottom.Y - LeftTop.Y) - RightPlateImage.Height) / 2)), CompositeOperator.Over);
            }
            else if (RightPlate == PlateType.Empty)
            {
                return;
            }
        }
コード例 #3
0
ファイル: ChainLink.cs プロジェクト: hexafluoride/linkgen
        private void DrawLeftPlate()
        {
            if (LeftPlate == PlateType.Lines)
            {
                var lines_plain = LoadInternalImage("lines-plain.png");
                var lines_tags  = LoadInternalImage("lines-tags.png");

                lines_plain.Colorize(LineColor, new Percentage(100));
                lines_tags.Colorize(TagColor, new Percentage(100));

                lines_plain.Scale(new Percentage((MainImage.Width / 2d) / lines_plain.Width * 100d), new Percentage((MainImage.Width / 2d) / lines_plain.Width * 82.5d));
                lines_tags.Scale(new Percentage((MainImage.Width / 2d) / lines_tags.Width * 100d), new Percentage((MainImage.Width / 2d) / lines_tags.Width * 82.5d));

                PrepareForPlate(lines_plain, Plate.Left, Gravity.Center);
                PrepareForPlate(lines_tags, Plate.Left, Gravity.Center);
                //lines_plain.Scale(new Percentage((MainImage.Width / 2d) / lines_plain.Width * 100d), new Percentage((MainImage.Width / 2d) / lines_plain.Width * 82.5d));
                //lines_tags.Scale(new Percentage((MainImage.Width / 2d) / lines_tags.Width * 100d), new Percentage((MainImage.Width / 2d) / lines_tags.Width * 82.5d));

                //lines_plain.BackgroundColor = new MagickColor(65535, 65535, 65535, 0);
                //lines_plain.Shear(-30, 0);
                //lines_plain.Rotate(30);
                //lines_plain.Trim();

                //lines_tags.BackgroundColor = new MagickColor(65535, 65535, 65535, 0);
                //lines_tags.Shear(-30, 0);
                //lines_tags.Rotate(30);
                //lines_tags.Trim();

                double total_height = LeftBottom.Y - LeftTop.Y;
                //MainImage.Composite(lines_plain, /*Scale(MainImage, 1646, 1426)*/new PointD(LeftTop.X + Scale(20) + MainImage.Height / 64d, (((Center.Y + LeftTop.Y) / 2d) + ((total_height - lines_plain.Height) / 2d)) - MainImage.Height / 96d), CompositeOperator.Over);
                //MainImage.Composite(lines_tags, /*Scale(MainImage, 1646, 1426)*/new PointD(LeftTop.X + Scale(20) + MainImage.Height / 64d, (((Center.Y + LeftTop.Y) / 2d) + ((total_height - lines_tags.Height) / 2d)) - MainImage.Height / 96d), CompositeOperator.Over);

                MainImage.Composite(lines_plain, /*Scale(MainImage, 1646, 1426)*/ new PointD((((MainImage.Width / 2) - lines_plain.Width) / 2), (((Center.Y + LeftTop.Y) / 2d) + ((total_height - lines_plain.Height) / 2d)) - MainImage.Height / 96d), CompositeOperator.Over);
                MainImage.Composite(lines_tags, /*Scale(MainImage, 1646, 1426)*/ new PointD((((MainImage.Width / 2) - lines_tags.Width) / 2), (((Center.Y + LeftTop.Y) / 2d) + ((total_height - lines_tags.Height) / 2d)) - MainImage.Height / 96d), CompositeOperator.Over);
            }
            else if (LeftPlate == PlateType.Image)
            {
                PrepareForPlate(LeftPlateImage, Plate.Left);
                LeftPlateImage.Scale(new Percentage((Bottom.Y - LeftTop.Y) / LeftPlateImage.Height * LeftPlateImagePercentage));

                //MainImage.Composite(TopPlateImage, /*Scale(570, 310)*/new PointD((MainImage.Width - RightPlateImage.Width) / 2, Scale(FrameMargin)), CompositeOperator.Over);

                //MainImage.Composite(RightPlateImage, /*Scale(MainImage, 1646, 1426)*/new PointD(Top.X + (MainImage.Width / 8d), (((Center.Y + LeftTop.Y) / 2d) + ((total_height - RightPlateImage.Height) / 2d) + MainImage.Height / 64d)), CompositeOperator.Over);
                MainImage.Composite(LeftPlateImage, new PointD((((MainImage.Width / 2) - LeftPlateImage.Width) / 2), LeftTop.Y + (((Bottom.Y - LeftTop.Y) - LeftPlateImage.Height) / 2)), CompositeOperator.Over);
            }
            else if (LeftPlate == PlateType.Empty)
            {
            }
        }