コード例 #1
0
 /// <summary>
 /// Raises the remove style event.
 /// </summary>
 /// <param name="style">Style.</param>
 internal void RaiseRemoveStyle(KimonoStyle style)
 {
     // Inform caller of event
     if (RemoveStyle != null)
     {
         RemoveStyle(style);
     }
 }
コード例 #2
0
 /// <summary>
 /// Raises the style type changed event.
 /// </summary>
 /// <param name="style">Style.</param>
 internal void RaiseStyleTypeChanged(KimonoStyle style)
 {
     // Inform caller of event
     if (StyleTypeChanged != null)
     {
         StyleTypeChanged(style);
     }
 }
コード例 #3
0
 /// <summary>
 /// Raises the edit attached style event.
 /// </summary>
 /// <param name="style">Style.</param>
 internal void RaiseEditAttachedStyle(KimonoStyle style)
 {
     // Inform caller of event
     if (EditAttachedStyle != null)
     {
         EditAttachedStyle(style);
     }
 }
コード例 #4
0
 /// <summary>
 /// Raises the make duplicate event.
 /// </summary>
 /// <param name="style">Style.</param>
 internal void RaiseMakeDuplicate(KimonoStyle style)
 {
     // Inform caller of event
     if (MakeDuplicate != null)
     {
         MakeDuplicate(style);
     }
 }
コード例 #5
0
 /// <summary>
 /// Raises the styles modified event.
 /// </summary>
 /// <param name="style">The <c>KimonoStyle</c> that was modified.</param>
 internal void RaiseStylesModified(KimonoStyle style)
 {
     // Inform caller of event
     if (StylesModified != null)
     {
         StylesModified(style);
     }
 }
コード例 #6
0
        /// <summary>
        /// Initializes this new instance of the Sketch class.
        /// </summary>
        internal void Initialize()
        {
            // Initialize Oval Style
            OvalStyle = new KimonoStyle()
            {
                StyleType = KimonoStyleType.Standard,
                HasFill   = true,
                HasFrame  = true
            };

            // Configure new Oval Style
            OvalStyle.Fill.BlendMode    = SKBlendMode.SrcOver;
            OvalStyle.Fill.IsAntialias  = true;
            OvalStyle.FillColor         = Orange;
            OvalStyle.Frame.BlendMode   = SKBlendMode.SrcOver;
            OvalStyle.Frame.IsAntialias = true;
            OvalStyle.Frame.StrokeWidth = 1f;
            OvalStyle.Frame.StrokeMiter = 4f;
            OvalStyle.Frame.StrokeJoin  = SKStrokeJoin.Mitter;
            OvalStyle.Frame.StrokeCap   = SKStrokeCap.Butt;
            OvalStyle.Frame.Color       = new SKColor(0, 0, 0, 255);


            // Property connections for Oval Style.
            OvalStyle.PropertyConnections.Add(new KimonoPropertyConnection(KimonoPropertyConnectionPoint.FillColor, ColorProperty));


            // Initialize Sketch
            Name        = "Sketch";
            DrawCanvas  = true;
            Width       = 640f;
            Height      = 480f;
            CanvasColor = new SKColor(255, 255, 255, 255);
            Portfolio   = new KimonoPortfolio(true);
            Portfolio.Sketches.Add(this);
            ObiScriptPortfolio.Portfolio = Portfolio;


            // Draw Oval shape
            var Oval = new KimonoShapeOval(40.5625f, 47.37891f, 192.1406f, 194.7109f)
            {
                RotationDegrees = 0,
                Visible         = true,
                Style           = OvalStyle
            };


            Shapes.Add(Oval);
            // Accumulate Kimono objects into the portfolio
            Portfolio.Colors.Add(Orange);
            Portfolio.Colors.Add(Purple);
            Portfolio.Styles.Add(OvalStyle);
            Portfolio.Properties.Add(UseOrange);
            Portfolio.Properties.Add(ColorProperty);
        }
コード例 #7
0
ファイル: KimonoShape.cs プロジェクト: yjpark/KimonoDesigner
 /// <summary>
 /// Uncouples the deleted style from the shape.
 /// </summary>
 /// <param name="deletedStyle">The <c>KimonoStyle</c> to delete.</param>
 public virtual void UncoupleDeletedStyle(KimonoStyle deletedStyle)
 {
     // Is this shape attached to the style being removed?
     if (Style == deletedStyle)
     {
         // Yes, move to a custom style
         Style           = deletedStyle.Clone(false);
         Style.Name      = "Custom";
         Style.StyleType = KimonoStyleType.Custom;
     }
 }
コード例 #8
0
        /// <summary>
        /// Adds the given style to the collection of named styles that are used
        /// in the generation of other Kimono Objects. If a style is already in
        /// the collection, its `ElementName` is returned.
        /// </summary>
        /// <returns>The `ElementName` for the supporting style.</returns>
        /// <param name="style">The `KimonoStyle` to add.</param>
        public static string AddSupportingStyle(KimonoStyle style)
        {
            // Scan all styles
            foreach (KimonoStyle supportingStyle in SupportingStyles)
            {
                // Already in the collection?
                if (supportingStyle == style)
                {
                    return(supportingStyle.ElementName);
                }
            }

            // Generate element name and add to collection
            style.ElementName = MakeElementName(style.Name);
            SupportingStyles.Add(style);

            // Return the new element name
            return(style.ElementName);
        }
コード例 #9
0
        public void TestGeneratedStyle(SKCanvas canvas)
        {
            // Build new New Style
            var NewStyle = new KimonoStyle()
            {
                StyleType            = KimonoStyleType.Standard,
                HasFill              = true,
                HasFillJitter        = true,
                FillJitterLength     = 10f,
                FillJitterDeviation  = 2f,
                HasFrame             = true,
                HasFrameJitter       = true,
                FrameJitterLength    = 10f,
                FrameJitterDeviation = 2f
            };

            // Configure new New Style
            NewStyle.Fill.BlendMode   = SKBlendMode.SrcOver;
            NewStyle.Fill.IsAntialias = true;
            NewStyle.Fill.Color       = new SKColor(230, 230, 230, 255);
            NewStyle.HasFillBlur      = true;
            NewStyle.FillBlur.HorizontalBlurAmount = 0f;
            NewStyle.FillBlur.VerticalBlurAmount   = 0f;
            NewStyle.HasFillShadow = true;
            NewStyle.FillShadow.HorizontalOffset     = 0f;
            NewStyle.FillShadow.VerticalOffset       = 0f;
            NewStyle.FillShadow.HorizontalBlurAmount = 0f;
            NewStyle.FillShadow.VerticalBlurAmount   = 0f;
            NewStyle.FillShadow.Color  = new SKColor(128, 128, 128, 255);
            NewStyle.Frame.BlendMode   = SKBlendMode.SrcOver;
            NewStyle.Frame.IsAntialias = true;
            NewStyle.Frame.StrokeWidth = 1f;
            NewStyle.Frame.StrokeMiter = 4f;
            NewStyle.Frame.StrokeJoin  = SKStrokeJoin.Mitter;
            NewStyle.Frame.StrokeCap   = SKStrokeCap.Butt;
            NewStyle.HasFrameDash      = true;
            NewStyle.DashPattern[0]    = true;
            NewStyle.DashPattern[1]    = true;
            NewStyle.DashPattern[2]    = true;
            NewStyle.DashPattern[3]    = true;
            NewStyle.DashPattern[4]    = true;
            NewStyle.DashPattern[5]    = true;
            NewStyle.DashPattern[6]    = true;
            NewStyle.DashPattern[7]    = true;
            NewStyle.DashPattern[8]    = false;
            NewStyle.DashPattern[9]    = false;
            NewStyle.DashPattern[10]   = false;
            NewStyle.DashPattern[11]   = false;
            NewStyle.DashPattern[12]   = false;
            NewStyle.DashPattern[13]   = false;
            NewStyle.DashPattern[14]   = false;
            NewStyle.DashPattern[15]   = false;
            NewStyle.Frame.Color       = new SKColor(0, 0, 0, 255);
            NewStyle.HasFrameBlur      = true;
            NewStyle.FrameBlur.HorizontalBlurAmount = 0f;
            NewStyle.FrameBlur.VerticalBlurAmount   = 0f;
            NewStyle.HasFrameShadow = true;
            NewStyle.FrameShadow.HorizontalOffset     = 0f;
            NewStyle.FrameShadow.VerticalOffset       = 0f;
            NewStyle.FrameShadow.HorizontalBlurAmount = 0f;
            NewStyle.FrameShadow.VerticalBlurAmount   = 0f;
            NewStyle.FrameShadow.Color = new SKColor(128, 128, 128, 255);

            // Draw rect
            var rect = new SKRect(0, 0, 200, 200);

            canvas.DrawRect(rect, NewStyle.Fill);
            canvas.DrawRect(rect, NewStyle.Frame);
        }