コード例 #1
0
ファイル: Form1.cs プロジェクト: nikeaa/ScriptWrappers
        private IPsDocument addWrapperToVerticalTemplate(IPsDocument webTemplateDoc, IPsDocument jpegDoc, IPsDocument webDoc)
        {
            webTemplateDoc.RotateCanvas(90);

            app.ActiveDocument = webDoc;

            // Build the front of the wrapper, with ends.
            IPsArtLayer frontLayer = webDoc.ArtLayers.AddNormalLayer("Front");
            IPsArtLayer front      = AddJpegAreaToWebDoc(jpegDoc, webDoc, VERTICAL_FRONT_X, VERTICAL_FRONT_Y, VERTICAL_FRONT_WIDTH, VERTICAL_FRONT_HEIGHT, VERTICAL_TRANSLATE_X, VERTICAL_TRANSLATE_FRONT_Y, true);

            IPsArtLayer frontLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Left End");

            DrawFilledRectangle(webDoc, 471, 135, 1121, 185, "Front Left End");

            IPsArtLayer frontRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Right End");

            DrawFilledRectangle(webDoc, 471, 1750, 1121, 1800, "Front Right End");

            List <IPsLayer> layersToMerge = new List <IPsLayer>();

            layersToMerge.Add(frontLeftEndLayer);
            layersToMerge.Add(front);
            IPsArtLayer frontMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            layersToMerge.Clear();
            layersToMerge.Add(frontRightEndLayer);
            layersToMerge.Add(frontMerged);
            frontMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            frontMerged.Name = "Front";

            IPsArtLayer back1 = AddJpegAreaToWebDoc(jpegDoc, webDoc, VERTICAL_BACK_BOTTOM_X, VERTICAL_BACK_BOTTOM_Y, VERTICAL_BACK_BOTTOM_WIDTH, VERTICAL_BACK_BOTTOM_HEIGHT, VERTICAL_TRANSLATE_BACK_BOTTOM_Y, VERTICAL_TRANSLATE_FRONT_Y, false);
            IPsArtLayer back2 = AddJpegAreaToWebDoc(jpegDoc, webDoc, VERTICAL_BACK_TOP_X, VERTICAL_BACK_TOP_Y, VERTICAL_BACK_TOP_WIDTH, VERTICAL_BACK_TOP_HEIGHT, VERTICAL_TRANSLATE_BACK_TOP_Y, VERTICAL_TRANSLATE_FRONT_Y, false);

            layersToMerge.Clear();
            layersToMerge.Add(back1);
            layersToMerge.Add(back2);
            IPsArtLayer backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            backMerged.Name = "Back";

            IPsLayerStyle       layerStyle = app.CreateLayerStyle();
            IPsBevelEmbossStyle bevelStyle = layerStyle.AddBevelEmbossStyle();

            bevelStyle.Size = 20;
            backMerged.ApplyLayerStyle(layerStyle);

            IPsArtLayer backLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Left End");

            DrawFilledRectangle(webDoc, 1329, 135, 1962, 185, "Back Left End");

            IPsArtLayer backRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Right End");

            DrawFilledRectangle(webDoc, 1329, 1750, 1962, 1800, "Back Right End");

            layersToMerge.Clear();
            layersToMerge.Add(backLeftEndLayer);
            layersToMerge.Add(backMerged);
            backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            layersToMerge.Clear();
            layersToMerge.Add(backRightEndLayer);
            layersToMerge.Add(backMerged);
            backMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            backMerged.Name = "Back";

            backMerged.Rotate(15.0, EPsAnchorPosition.psBottomRight);

            backMerged.MoveAfter(frontMerged);
            backMerged.Translate(-440, 120);

            return(webDoc);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: nikeaa/ScriptWrappers
        private IPsDocument addWrapperToHorizontalTemplate(IPsDocument webTemplateDoc, IPsDocument jpegDoc, IPsDocument webDoc)
        {
            webTemplateDoc.RotateCanvas(90);

            app.ActiveDocument = webDoc;

            // Build the front of the wrapper, with ends.
            IPsArtLayer frontLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Left End");

            DrawFilledRectangle(webDoc, 360, 363, 410, 1007, "Front Left End");

            IPsArtLayer frontRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Right End");

            DrawFilledRectangle(webDoc, 1985, 363, 2035, 1007, "Front Right End");

            IPsArtLayer frontLayer = webDoc.ArtLayers.AddNormalLayer("Front");
            IPsArtLayer front      = AddJpegAreaToWebDoc(jpegDoc, webDoc, HORIZONTAL_FRONT_X, HORIZONTAL_FRONT_Y, HORIZONTAL_FRONT_WIDTH, HORIZONTAL_FRONT_HEIGHT, HORIZONTAL_TRANSLATE_X, HORIZONTAL_TRANSLATE_FRONT_Y, true);

            List <IPsLayer> layersToMerge = new List <IPsLayer>();

            layersToMerge.Add(frontLeftEndLayer);
            layersToMerge.Add(front);
            IPsArtLayer frontMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            layersToMerge.Clear();
            layersToMerge.Add(frontRightEndLayer);
            layersToMerge.Add(frontMerged);
            frontMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            frontMerged.Name = "Front";

            // Build the back of the wrapper, with ends.
            IPsArtLayer back1 = AddJpegAreaToWebDoc(jpegDoc, webDoc, HORIZONTAL_BACK_BOTTOM_X, HORIZONTAL_BACK_BOTTOM_Y, HORIZONTAL_BACK_BOTTOM_WIDTH, HORIZONTAL_BACK_BOTTOM_HEIGHT, HORIZONTAL_TRANSLATE_X, HORIZONTAL_TRANSLATE_BACK_BOTTOM_Y, false);
            IPsArtLayer back2 = AddJpegAreaToWebDoc(jpegDoc, webDoc, HORIZONTAL_BACK_TOP_X, HORIZONTAL_BACK_TOP_Y, HORIZONTAL_BACK_TOP_WIDTH, HORIZONTAL_BACK_TOP_HEIGHT, HORIZONTAL_TRANSLATE_X, HORIZONTAL_TRANSLATE_BACK_TOP_Y, false);

            // Merge the two back pieces.
            layersToMerge.Clear();
            layersToMerge.Add(back1);
            layersToMerge.Add(back2);
            IPsArtLayer backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            backMerged.Name = "Back";

            IPsLayerStyle       layerStyle = app.CreateLayerStyle();
            IPsBevelEmbossStyle bevelStyle = layerStyle.AddBevelEmbossStyle();

            bevelStyle.Size = 20;
            backMerged.ApplyLayerStyle(layerStyle);

            IPsArtLayer backLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Left End");

            DrawFilledRectangle(webDoc, 360, 1094, 410, 1738, "Back Left End");

            IPsArtLayer backRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Right End");

            DrawFilledRectangle(webDoc, 1985, 1094, 2035, 1738, "Back Right End");

            layersToMerge.Clear();
            layersToMerge.Add(backLeftEndLayer);
            layersToMerge.Add(backMerged);
            backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            layersToMerge.Clear();
            layersToMerge.Add(backRightEndLayer);
            layersToMerge.Add(backMerged);
            backMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            backMerged.Name = "Back";

            backMerged.Rotate(15.0, EPsAnchorPosition.psBottomRight);

            backMerged.MoveAfter(frontMerged);
            backMerged.Translate(-140, 0);

            return(webDoc);
        }