public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:GradientFillLayers

            string fileName = dataDir + "FillLayerGradient.psd";

            GradientType[] gradientTypes = new[]
            {
                GradientType.Linear, GradientType.Radial, GradientType.Angle, GradientType.Reflected, GradientType.Diamond
            };
            using (var image = Image.Load(fileName))
            {
                PsdImage             psdImage     = (PsdImage)image;
                FillLayer            fillLayer    = (FillLayer)psdImage.Layers[0];
                GradientFillSettings fillSettings = (GradientFillSettings)fillLayer.FillSettings;
                foreach (var gradientType in gradientTypes)
                {
                    fillSettings.GradientType = gradientType;
                    fillLayer.Update();
                    psdImage.Save(fileName + "_" + gradientType.ToString() + ".png", new PngOptions()
                    {
                        ColorType = PngColorType.TruecolorWithAlpha
                    });
                }
            }

            //ExEnd:GradientFillLayers
        }
示例#2
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            try
            {
                if (outter_points.Count >= 4)
                {
                    var polygon = new Polygon(points.Select(x => x.Select(y => new[] { y.Longitude, y.Latitude })));

                    var layer = new FillLayer("layer-id", "source-id")
                    {
                        FillColor = Color.FromHex("#FF0000")
                    };
                    var source = new GeoJsonSource("source-id", new Feature(polygon));

                    if (map.Functions.GetLayers().Count() > 0)
                    {
                        map.Functions.RemoveSource("source-id");
                        map.Functions.RemoveLayer("settlement-label");
                    }

                    map.Functions.AddSource(source);
                    map.Functions.AddLayerBelow(layer, "settlement-label");
                }
                else
                {
                    DisplayAlert(null, "You have less than 4 points", "OK");
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#3
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var outerLineString       = new LineString(Config.POLYGON_COORDINATES);
            var innerLineString       = new LineString(Config.HOLE_COORDINATES[0]);
            var secondInnerLineString = new LineString(Config.HOLE_COORDINATES[1]);

            List <LineString> innerList = new List <LineString> {
                innerLineString,
                secondInnerLineString
            };

            map.Functions.AddSource(new GeoJsonSource("source-id",
                                                      new Feature(new Polygon(new[] { outerLineString, innerLineString, secondInnerLineString }))));

            var polygonFillLayer = new FillLayer("layer-id", "source-id")
            {
                FillColor = Config.BLUE_COLOR
            };

            if (map.Functions.GetLayers().Any(x => x.Id == "road-number-shield"))
            {
                map.Functions.AddLayerBelow(polygonFillLayer, "road-number-shield");
            }
            else
            {
                map.Functions.AddLayer(polygonFillLayer);
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string OutputDir = RunExamples.GetDataDir_Output();

            //ExStart:AddingFillLayerAtRuntime
            //ExSummary:The following example demonstrates how to add the FillLayer type layer at runtime.
            string outputFilePath = Path.Combine(OutputDir, "output.psd");

            using (var image = new PsdImage(100, 100))
            {
                FillLayer colorFillLayer = FillLayer.CreateInstance(FillType.Color);
                colorFillLayer.DisplayName = "Color Fill Layer";
                image.AddLayer(colorFillLayer);

                FillLayer gradientFillLayer = FillLayer.CreateInstance(FillType.Gradient);
                gradientFillLayer.DisplayName = "Gradient Fill Layer";
                image.AddLayer(gradientFillLayer);

                FillLayer patternFillLayer = FillLayer.CreateInstance(FillType.Pattern);
                patternFillLayer.DisplayName = "Pattern Fill Layer";
                patternFillLayer.Opacity     = 50;
                image.AddLayer(patternFillLayer);

                image.Save(outputFilePath);
            }

            //ExEnd:AddingFillLayerAtRuntime
            Console.WriteLine("AddingFillLayerAtRuntime executed successfully");
        }
示例#5
0
        private async Task RefreshGeoJsonRunnable()
        {
            while (true)
            {
                if (cancellationTokenSource.IsCancellationRequested)
                {
                    break;
                }

                await Task.Delay(1000);

                var layer = new FillLayer(ID_LAYER, ID_SOURCE)
                {
                    Filter = Expression.Eq(Expression.Get("idx"), Expression.Literal(index))
                };

                map.Functions.UpdateLayer(layer);

                index++;
                if (index == 37)
                {
                    index = 0;
                }
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:SupportOfScaleProperty

            using (var image = (PsdImage)Image.Load(dataDir + "FillLayerGradient.psd"))
            {
                // getting a fill layer
                FillLayer fillLayer = null;
                foreach (var layer in image.Layers)
                {
                    fillLayer = layer as FillLayer;
                    if (fillLayer != null)
                    {
                        break;
                    }
                }

                var settings = fillLayer.FillSettings as IGradientFillSettings;

                // update scale value
                settings.Scale = 200;
                fillLayer.Update(); // Updates pixels data

                image.Save(dataDir + "scaledImage.png", new PngOptions()
                {
                    ColorType = PngColorType.TruecolorWithAlpha
                });
            }


            //ExEnd:SupportOfScaleProperty
        }
示例#7
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:PatternFillLayer

            // Add support of Fill layers: Pattern
            string sourceFileName = dataDir + "PatternFillLayer.psd";
            string exportPath     = dataDir + "PatternFillLayer_Edited.psd";
            double tolerance      = 0.0001;
            var    im             = (PsdImage)Image.Load(sourceFileName);

            using (im)
            {
                foreach (var layer in im.Layers)
                {
                    if (layer is FillLayer)
                    {
                        FillLayer           fillLayer    = (FillLayer)layer;
                        PatternFillSettings fillSettings = (PatternFillSettings)fillLayer.FillSettings;
                        if (fillSettings.HorizontalOffset != -46 ||
                            fillSettings.VerticalOffset != -45 ||
                            fillSettings.PatternId != "a6818df2-7532-494e-9615-8fdd6b7f38e5" ||
                            fillSettings.PatternName != "$$$/Presets/Patterns/OpticalSquares=Optical Squares" ||
                            fillSettings.AlignWithLayer != true ||
                            fillSettings.Linked != true ||
                            fillSettings.PatternHeight != 64 ||
                            fillSettings.PatternWidth != 64 ||
                            fillSettings.PatternData.Length != 4096 ||
                            Math.Abs(fillSettings.Scale - 50) > tolerance)
                        {
                            throw new Exception("PSD Image was read wrong");
                        }
                        // Editing
                        fillSettings.Scale            = 300;
                        fillSettings.HorizontalOffset = 2;
                        fillSettings.VerticalOffset   = -20;
                        fillSettings.PatternData      = new int[]
                        {
                            Color.Red.ToArgb(), Color.Blue.ToArgb(), Color.Blue.ToArgb(),
                                                Color.Blue.ToArgb(), Color.Red.ToArgb(), Color.Blue.ToArgb(),
                                                Color.Blue.ToArgb(), Color.Blue.ToArgb(), Color.Red.ToArgb()
                        };
                        fillSettings.PatternHeight  = 3;
                        fillSettings.PatternWidth   = 3;
                        fillSettings.AlignWithLayer = false;
                        fillSettings.Linked         = false;
                        fillSettings.PatternId      = Guid.NewGuid().ToString();
                        fillLayer.Update();
                        break;
                    }
                }
                im.Save(exportPath);
            }

            //ExEnd:PatternFillLayer
        }
示例#8
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var vectorSource = new VectorSource(
                "population",
                "http://api.mapbox.com/v4/mapbox.660ui7x6.json?access_token=" + MapBoxService.AccessToken
                );

            map.Functions.AddSource(vectorSource);

            var statePopulationLayer = new FillLayer("state-population", "population")
            {
                SourceLayer = "state_county_population_2014_cen",
                Filter      = Expression.Eq(Expression.Get("isState"), Expression.Literal(true)),
                FillColor   = Expression.Step(
                    Expression.Get("population"), Expression.Rgb(0, 0, 0),
                    Expression.CreateStop(0, Expression.Rgb(242, 241, 45)),
                    Expression.CreateStop(750000, Expression.Rgb(238, 211, 34)),
                    Expression.CreateStop(1000000, Expression.Rgb(218, 156, 32)),
                    Expression.CreateStop(2500000, Expression.Rgb(202, 131, 35)),
                    Expression.CreateStop(5000000, Expression.Rgb(184, 107, 37)),
                    Expression.CreateStop(7500000, Expression.Rgb(162, 86, 38)),
                    Expression.CreateStop(10000000, Expression.Rgb(139, 66, 37)),
                    Expression.CreateStop(25000000, Expression.Rgb(114, 49, 34))),
                FillOpacity = (0.75f)
            };

            map.Functions.AddLayerBelow(statePopulationLayer, "waterway-label");

            var countyPopulationLayer = new FillLayer("county-population", "population")
            {
                SourceLayer = ("state_county_population_2014_cen"),
                Filter      = Expression.Eq(Expression.Get("isCounty"), Expression.Literal(true)),
                FillColor   = Expression.Step(Expression.Get("population"), Expression.Rgb(0, 0, 0),
                                              Expression.CreateStop(0, Expression.Rgb(242, 241, 45)),
                                              Expression.CreateStop(100, Expression.Rgb(238, 211, 34)),
                                              Expression.CreateStop(1000, Expression.Rgb(230, 183, 30)),
                                              Expression.CreateStop(5000, Expression.Rgb(218, 156, 32)),
                                              Expression.CreateStop(10000, Expression.Rgb(202, 131, 35)),
                                              Expression.CreateStop(50000, Expression.Rgb(184, 107, 37)),
                                              Expression.CreateStop(100000, Expression.Rgb(162, 86, 38)),
                                              Expression.CreateStop(500000, Expression.Rgb(139, 66, 37)),
                                              Expression.CreateStop(1000000, Expression.Rgb(114, 49, 34))),
                FillOpacity = 0.75f,
                Visibility  = Expression.Visibility(false)
            };

            map.Functions.AddLayerBelow(countyPopulationLayer, "waterway-label");

            var updateLayer = new FillLayer("county-population", "population");

            map.CameraMovedCommand = new Command <CameraPosition>((cameraPosition) =>
            {
                var visible            = cameraPosition.Zoom > ZOOM_THRESHOLD;
                updateLayer.Visibility = Expression.Visibility(visible);
                map.Functions.UpdateLayer(updateLayer);
            });
        }
        /**
         * Create layer from the vector tile source with data-driven style
         *
         * @param stops the array of stops to use in the FillLayer
         */
        private void AddDataToMap(Stop[] stops)
        {
            FillLayer statesJoinLayer = new FillLayer("states-join", VECTOR_SOURCE_NAME);

            statesJoinLayer.SourceLayer = (VECTOR_SOURCE_NAME);
            statesJoinLayer.FillColor   = (Expression.Match(Expression.ToNumber(Expression.Get(DATA_MATCH_PROP)),
                                                            Expression.Rgba(0, 0, 0, 1), stops));

            // Add layer to map below the "waterway-label" layer
            map.Functions.AddLayerAbove(statesJoinLayer, "waterway-label");
        }
示例#10
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var waterLayer         = new FillLayer("water", "built-in");
            var buildingLayer      = new FillLayer("building", "built-in");
            var selectedLayerIndex = 0;

            picker.ItemsSource           = new[] { "Water", "Building" };
            picker.SelectedIndexChanged += (sender, e) => {
                if (selectedLayerIndex == picker.SelectedIndex)
                {
                    return;
                }

                selectedLayerIndex = picker.SelectedIndex;
                var expression = Expression.Rgb((int)red.Value, (int)green.Value, (int)blue.Value);
                switch (selectedLayerIndex)
                {
                case 0:
                    waterLayer.FillColor = expression;
                    map.Functions.UpdateLayer(waterLayer);
                    break;

                case 1:
                    buildingLayer.FillColor = expression;
                    map.Functions.UpdateLayer(buildingLayer);
                    break;
                }
            };
            picker.SelectedIndex = 0;

            red.ValueChanged   += SliderValueChanged;
            green.ValueChanged += SliderValueChanged;
            blue.ValueChanged  += SliderValueChanged;


            void SliderValueChanged(object sender, ValueChangedEventArgs e)
            {
                var expression = Expression.Rgb((int)red.Value, (int)green.Value, (int)blue.Value);

                switch (selectedLayerIndex)
                {
                case 0:
                    waterLayer.FillColor = expression;
                    map.Functions.UpdateLayer(waterLayer);
                    break;

                case 1:
                    buildingLayer.FillColor = expression;
                    map.Functions.UpdateLayer(buildingLayer);
                    break;
                }
            };
        }
        private void AddPolygonLayer()
        {
            // Create and style a FillLayer that uses the Polygon Feature's coordinates in the GeoJSON data
            FillLayer countryPolygonFillLayer = new FillLayer("polygon", GEOJSON_SOURCE_ID)
            {
                FillColor   = Color.Red,
                FillOpacity = .4f,
                Filter      = Expression.Eq(Expression.Literal("$type"), Expression.Literal("Polygon")),
            };

            map.Functions.AddLayer(countryPolygonFillLayer);
        }
示例#12
0
        public static Sdk.Style.Layers.FillLayer ToNative(this FillLayer fill)
        {
            if (fill == null)
            {
                return(null);
            }
            var native = new Sdk.Style.Layers.FillLayer(fill.Id, fill.SourceId);

            native.SetProperties
            (
                Sdk.Style.Layers.PropertyFactory.FillColor(fill.FillColor.ToAndroid())
            );
            return(native);
        }
示例#13
0
        public static FillLayer ToForms(this Sdk.Style.Layers.FillLayer fill)
        {
            if (fill == null)
            {
                return(null);
            }
            FillLayer forms = new FillLayer(fill.Id, fill.SourceLayer);

            if (!fill.FillColor.IsNull && fill.FillColor.ColorInt != null)
            {
                Android.Graphics.Color fillColor = new Android.Graphics.Color((int)fill.FillColor.ColorInt);
                forms.FillColor = Xamarin.Forms.Color.FromRgb(fillColor.R, fillColor.G, fillColor.B);
            }
            return(forms);
        }
示例#14
0
        /**
         * Adds a FillLayer and uses data-driven styling to display the lake's areas
         */
        private void SetUpDepthFillLayers()
        {
            FillLayer depthPolygonFillLayer = new FillLayer("DEPTH_POLYGON_FILL_LAYER_ID", GEOJSON_SOURCE_ID)
            {
                FillColor = Expression.Interpolate(Expression.Linear(),
                                                   Expression.Get("depth"),
                                                   Expression.CreateStop(5, Expression.Rgb(16, 158, 210)),
                                                   Expression.CreateStop(10, Expression.Rgb(37, 116, 145)),
                                                   Expression.CreateStop(15, Expression.Rgb(69, 102, 124)),
                                                   Expression.CreateStop(30, Expression.Rgb(31, 52, 67))),
                FillOpacity = .7f,
                // Only display Polygon Features in this layer
                Filter = Expression.Eq(Expression.GeometryType(), Expression.Literal("Polygon"))
            };

            map.Functions.AddLayer(depthPolygonFillLayer);
        }
示例#15
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var source = new GeoJsonSource
            {
                Id  = "urban-areas",
                Url = "https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_urban_areas.geojson"
            };

            map.Functions.AddSource(source);

            var layer = new FillLayer("urban-areas-fill", source.Id)
            {
                FillColor   = Color.FromHex("#ff0088"),
                FillOpacity = 0.4f
            };

            map.Functions.AddLayerBelow(layer, "water");
        }
示例#16
0
        private void HandleStyleLoaded(MapStyle obj)
        {
            var layer = new FillLayer("water", "built-in")
            {
                FillColor = Expression.Interpolate(
                    Expression.Exponential(1),
                    Expression.Zoom(),
                    Expression.CreateStop(1f, Expression.Rgb(0, 209, 22)),
                    Expression.CreateStop(8.5f, Expression.Rgb(10, 88, 255)),
                    Expression.CreateStop(10f, Expression.Rgb(255, 10, 10)),
                    Expression.CreateStop(18f, Expression.Rgb(251, 255, 0))
                    )
            };

            map.Functions.UpdateLayer(layer);

            map.Functions.AnimateCamera(new CameraPosition(map.Center, 12, null, null), 12000);
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            map.Functions.AddSource(new VectorSource("population", "mapbox://peterqliu.d0vin3el"));

            var fillsLayer = new FillLayer("fills", "population")
            {
                SourceLayer = ("outgeojson"),
                Filter      = (Expression.All(Expression.Lt(Expression.Get("pkm2"), 300000))),
                FillColor   = Expression.Interpolate(
                    Expression.Exponential(1f),
                    Expression.Get("pkm2"),
                    Expression.CreateStop(0, Expression.Rgb(22, 14, 35)),
                    Expression.CreateStop(14500, Expression.Rgb(0, 97, 127)),
                    Expression.CreateStop(145000, Expression.Rgb(85, 223, 255)))
            };

            map.Functions.AddLayerBelow(fillsLayer, "water");

            var fillExtrusionLayer = new FillExtrusionLayer("extrusions", "population")
            {
                SourceLayer = ("outgeojson"),
                Filter      = (Expression.All(Expression.Gt(Expression.Get("p"), 1),
                                              Expression.Lt(Expression.Get("pkm2"), 300000))),
                FillExtrusionColor = (Expression.Interpolate(
                                          Expression.Exponential(1f),
                                          Expression.Get("pkm2"),
                                          Expression.CreateStop(0, Expression.Rgb(22, 14, 35)),
                                          Expression.CreateStop(14500, Expression.Rgb(0, 97, 127)),
                                          Expression.CreateStop(145000, Expression.Rgb(85, 233, 255)))),
                FillExtrusionBase   = (0f),
                FillExtrusionHeight = (Expression.Interpolate(
                                           Expression.Exponential(1f),
                                           Expression.Get("pkm2"),
                                           Expression.CreateStop(0, 0f),
                                           Expression.CreateStop(1450000, 20000f)))
            };

            map.Functions.AddLayerBelow(fillExtrusionLayer, "airport-label");

            map.Functions.AnimateCamera(new CameraPosition(map.Center, map.ZoomLevel, map.Pitch, 0), 1000);
        }
示例#18
0
        private void DrawOverlay(List <Position> points)
        {
            //points.Add(points.First()); // Close the polygon
            var ls = new List <LineString>();

            ls.Add(new LineString(points));

            var polygon = new Polygon(new List <LineString> {
                new LineString(points)
            });

            var lineString = new LineString(points);

            //var polygon = new Polygon(ls);

            var newSourceId = System.Guid.NewGuid().ToString();
            var newLayerId  = System.Guid.NewGuid().ToString();

            map.Functions.AddSource(new GeoJsonSource(newSourceId,
                                                      new Feature(new Polygon(new[] { lineString }))));

            var polygonFillLayer = new FillLayer(newLayerId, newSourceId)
            {
                FillColor = Color.FromRgba(72, 217, 50, 50)
            };

            //map.Functions.AddSource(new GeoJsonSource("source-id", polygon));

            var layers = map.Functions.GetLayers();

            //map.Functions.AddLayer(polygonFillLayer);
            // landcover, building, tunnel-street-minor-low
            if (map.Functions.GetLayers().Any(x => x.Id == "landcover"))
            {
                map.Functions.AddLayerBelow(polygonFillLayer, "landcover");
            }
            else
            {
                map.Functions.AddLayer(polygonFillLayer);
            }
        }
        //ExStart:ClassesToManipulateVectorPathObjects
        //ExSummary:The following code example provides classes to manipulate the vector path objects and demonstrates how to use those classes.

        private static void CreatingVectorPathExample(string outputPsd = "outputPsd.psd")
        {
            using (var psdImage = (PsdImage)Image.Create(new PsdOptions()
            {
                Source = new StreamSource(new MemoryStream()),
            }, 500, 500))
            {
                FillLayer layer = FillLayer.CreateInstance(FillType.Color);
                psdImage.AddLayer(layer);

                VectorPath vectorPath = VectorDataProvider.CreateVectorPathForLayer(layer);
                vectorPath.FillColor = Color.IndianRed;
                PathShape shape = new PathShape();
                shape.Points.Add(new BezierKnot(new PointF(50, 150), true));
                shape.Points.Add(new BezierKnot(new PointF(100, 200), true));
                shape.Points.Add(new BezierKnot(new PointF(0, 200), true));
                vectorPath.Shapes.Add(shape);
                VectorDataProvider.UpdateLayerFromVectorPath(layer, vectorPath, true);

                psdImage.Save(outputPsd);
            }
        }
示例#20
0
        private void AddRadarData()
        {
            var vectorSource = new VectorSource(
                ID_SOURCE,
                SOURCE_URL
                );

            map.Functions.AddSource(vectorSource);

            var layer = new FillLayer(ID_LAYER, ID_SOURCE)
            {
                SourceLayer = "201806261518",
                Filter      = Expression.Eq(Expression.Get("idx"), Expression.Literal(0)),
                Visibility  = Expression.Visibility(true),
                FillColor   = Expression.Interpolate(
                    Expression.Exponential(1f),
                    Expression.Get("value"),
                    Expression.CreateStop(8, Expression.Rgb(20, 160, 240)),
                    Expression.CreateStop(18, Expression.Rgb(20, 190, 240)),
                    Expression.CreateStop(36, Expression.Rgb(20, 220, 240)),
                    Expression.CreateStop(54, Expression.Rgb(20, 250, 240)),
                    Expression.CreateStop(72, Expression.Rgb(20, 250, 160)),
                    Expression.CreateStop(90, Expression.Rgb(135, 250, 80)),
                    Expression.CreateStop(108, Expression.Rgb(250, 250, 0)),
                    Expression.CreateStop(126, Expression.Rgb(250, 180, 0)),
                    Expression.CreateStop(144, Expression.Rgb(250, 110, 0)),
                    Expression.CreateStop(162, Expression.Rgb(250, 40, 0)),
                    Expression.CreateStop(180, Expression.Rgb(180, 40, 40)),
                    Expression.CreateStop(198, Expression.Rgb(110, 40, 80)),
                    Expression.CreateStop(216, Expression.Rgb(80, 40, 110)),
                    Expression.CreateStop(234, Expression.Rgb(50, 40, 140)),
                    Expression.CreateStop(252, Expression.Rgb(20, 40, 170))
                    ),
                FillOpacity = (0.7f)
            };

            map.Functions.AddLayer(layer);
        }
示例#21
0
        private void Map()
        {
            try
            {
                polygon = new Polygon(
                    points.Select(x => x.Select(y => new[] { y.Longitude, y.Latitude }))
                    );
                var layer = new FillLayer("layer-id", "source-id")
                {
                    FillColor = Color.FromHex("#FF0000")
                };
                var source = new GeoJsonSource("source-id", new Feature(polygon));

                if (map.Functions.GetLayers().Count() > 0)
                {
                    DisplayAlert(null, "Layers found", "OK");

                    map.Functions.RemoveSource("source-id");
                    map.Functions.RemoveLayer("settlement-label");

                    DisplayAlert(null, "Layers removed", "OK");
                }
                else
                {
                    DisplayAlert(null, "No layers found", "OK");
                }

                map.Functions.AddSource(source);
                map.Functions.AddLayerBelow(layer, "settlement-label");
                DisplayAlert(null, "Done Mapping", "OK");
            }
            catch (Exception ex)
            {
                DisplayAlert(null, ex.Message, "OK");
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string outputDir = RunExamples.GetDataDir_Output();

            //ExStart:SupportOfEditFontNameInTextPortionStyle
            //ExSummary:The following code demonstrate the ability to change font name at portion style.

            string outputFilePng = outputDir + "result_fontEditTest.png";
            string outputFilePsd = outputDir + "fontEditTest.psd";

            void AssertAreEqual(object expected, object actual)
            {
                if (!object.Equals(expected, actual))
                {
                    throw new Exception("Objects are not equal.");
                }
            }

            using (var image = new PsdImage(500, 500))
            {
                FillLayer backgroundFillLayer = FillLayer.CreateInstance(FillType.Color);
                ((IColorFillSettings)backgroundFillLayer.FillSettings).Color = Color.White;
                image.AddLayer(backgroundFillLayer);

                TextLayer textLayer = image.AddTextLayer("Text 1", new Rectangle(10, 35, image.Width, 35));

                ITextPortion firstPortion = textLayer.TextData.Items[0];
                firstPortion.Style.FontName = FontSettings.GetAdobeFontName("Comic Sans MS");

                var secondPortion = textLayer.TextData.ProducePortion();
                secondPortion.Text = "Text 2";
                secondPortion.Paragraph.Apply(firstPortion.Paragraph);
                secondPortion.Style.Apply(firstPortion.Style);
                secondPortion.Style.FontName = FontSettings.GetAdobeFontName("Arial");

                textLayer.TextData.AddPortion(secondPortion);
                textLayer.TextData.UpdateLayerData();

                image.Save(outputFilePng, new PngOptions());
                image.Save(outputFilePsd);
            }

            using (var image = (PsdImage)Image.Load(outputFilePsd))
            {
                TextLayer textLayer = (TextLayer)image.Layers[2];

                string adobeFontName1 = FontSettings.GetAdobeFontName("Comic Sans MS");
                string adobeFontName2 = FontSettings.GetAdobeFontName("Arial");

                AssertAreEqual(adobeFontName1, textLayer.TextData.Items[0].Style.FontName);
                AssertAreEqual(adobeFontName2, textLayer.TextData.Items[1].Style.FontName);
            }

            //ExEnd:SupportOfEditFontNameInTextPortionStyle

            Console.WriteLine("SupportOfEditFontNameInTextPortionStyle executed successfully");

            File.Delete(outputFilePng);
            File.Delete(outputFilePsd);
        }