Пример #1
0
        public override Figure CloneInstance(bool keepLocation)
        {
            int offSet = 0;

            if (keepLocation == false)
            {
                offSet = 20;
            }

            Point pos  = new Point(this.DisplayObjectParent.SurfaceRect.X + offSet, this.DisplayObjectParent.SurfaceRect.Y);
            float size = this.font2.Size;
            Texte fig  = new Texte(pos, this.txt, new Font2(this.font2.FontItem.NameForIphone, size, this.font2.Style), this.m_FillColor, this.m_nEpaisseur, this.m_bRempli, null);

            fig.font2.FontItem = this.font2.FontItem;

            return(fig);
        }
Пример #2
0
 public TextPropertyConverter(CoronaObject obj, Form1 MainForm)
     : base(obj,MainForm)
 {
     objSelected = obj;
     this.text = obj.DisplayObject.Figure as Texte;
 }
Пример #3
0
        public void DrawGorgon(Point offsetPoint, bool showSelection, float xScale, float yScale, bool applyRotation)
        {
            try
            {
                Rectangle rectDest = new Rectangle(new Point(offsetPoint.X + this.surfaceRect.Location.X,
                                                             offsetPoint.Y + this.surfaceRect.Location.Y), this.surfaceRect.Size);


                //Si c'est un sprite  -----------
                if (this.type.Equals("SPRITE"))
                {
                    if (this.GorgonSprite != null)
                    {
                        this.GorgonSprite.Color = Color.FromArgb((int)(this.Alpha * 255.0f), Color.White);


                        float imgScaleX = (float)this.SurfaceRect.Width / (float)this.GorgonSprite.Image.Width;
                        float imgScaleY = (float)this.SurfaceRect.Height / (float)this.GorgonSprite.Image.Height;

                        float finalXScale = xScale * imgScaleX;
                        float finalYScale = yScale * imgScaleY;
                        this.GorgonSprite.SetScale(finalXScale, finalYScale);

                        this.GorgonSprite.SetAxis((float)this.GorgonSprite.Image.Width / 2, (float)this.GorgonSprite.Image.Height / 2);

                        this.GorgonSprite.SetPosition((float)rectDest.X * xScale + (this.GorgonSprite.Axis.X * finalXScale),
                                                      (float)rectDest.Y * yScale + (this.GorgonSprite.Axis.Y * finalYScale));


                        if (applyRotation == true)
                        {
                            this.GorgonSprite.Rotation = this.Rotation;
                        }
                        else
                        {
                            this.GorgonSprite.Rotation = 0;
                        }

                        this.GorgonSprite.Draw();
                    }
                }
                //Si c'est une image simple -----------
                else if (this.type.Equals("IMAGE"))
                {
                    if (this.GorgonSprite != null)
                    {
                        if (this.ImageFillColor.IsEmpty)
                        {
                            this.ImageFillColor = Color.White;
                        }


                        this.GorgonSprite.Color = Color.FromArgb((int)(this.Alpha * 255.0f), this.ImageFillColor);

                        float imgScaleX = (float)this.SurfaceRect.Width / (float)this.GorgonSprite.Image.Width;
                        float imgScaleY = (float)this.SurfaceRect.Height / (float)this.GorgonSprite.Image.Height;

                        float finalXScale = xScale * imgScaleX;
                        float finalYScale = yScale * imgScaleY;
                        this.GorgonSprite.SetScale(finalXScale, finalYScale);


                        this.GorgonSprite.SetAxis((float)this.GorgonSprite.Image.Width / 2, (float)this.GorgonSprite.Image.Height / 2);

                        if (applyRotation == true)
                        {
                            this.GorgonSprite.Rotation = this.Rotation;
                        }
                        else
                        {
                            this.GorgonSprite.Rotation = 0;
                        }

                        this.GorgonSprite.SetPosition((float)rectDest.X * xScale + (this.GorgonSprite.Axis.X * finalXScale),
                                                      (float)rectDest.Y * yScale + (this.GorgonSprite.Axis.Y * finalYScale));
                        this.GorgonSprite.Draw();
                    }
                }


                //Si c'est une figure -----------
                else if (this.type.Equals("FIGURE"))
                {
                    int alphaARGB = System.Convert.ToInt32(this.Alpha * 255);
                    if (this.Figure.ShapeType.Equals("RECTANGLE"))
                    {
                        if (this.GorgonSprite != null)
                        {
                            float imgScaleX = (float)this.SurfaceRect.Width / (float)this.GorgonSprite.Image.Width;
                            float imgScaleY = (float)this.SurfaceRect.Height / (float)this.GorgonSprite.Image.Height;

                            float finalXScale = xScale * imgScaleX;
                            float finalYScale = yScale * imgScaleY;

                            this.GorgonSprite.SetScale(finalXScale, finalYScale);

                            this.GorgonSprite.SetAxis((float)this.GorgonSprite.Image.Width / 2, (float)this.GorgonSprite.Image.Height / 2);
                            this.GorgonSprite.Rotation = this.Rotation;


                            this.GorgonSprite.SetPosition((float)rectDest.X * xScale + (this.GorgonSprite.Axis.X * finalXScale),
                                                          (float)rectDest.Y * yScale + (this.GorgonSprite.Axis.Y * finalYScale));
                            this.GorgonSprite.Draw();
                        }
                    }
                    else if (this.Figure.ShapeType.Equals("CIRCLE"))
                    {
                        Cercle circ = this.Figure as Cercle;

                        circ.DrawGorgon(offsetPoint, alphaARGB, xScale);
                    }
                    else if (this.Figure.ShapeType.Equals("CURVE"))
                    {
                        CourbeBezier bezier = this.Figure as CourbeBezier;

                        bezier.DrawGorgon(offsetPoint, alphaARGB, xScale);
                    }
                    else if (this.Figure.ShapeType.Equals("LINE"))
                    {
                        Line line = this.Figure as Line;
                        line.DrawGorgon(offsetPoint, alphaARGB, xScale);
                    }
                    else if (this.Figure.ShapeType.Equals("TEXT"))
                    {
                        Krea.CGE_Figures.Texte textObject = this.Figure as Krea.CGE_Figures.Texte;

                        string fontName = "DEFAULT";
                        if (textObject.font2.FontItem != null)
                        {
                            fontName = textObject.font2.FontItem.NameForIphone;
                        }

                        GorgonGraphicsHelper.Instance.DrawText(textObject.txt, fontName, textObject.font2.Size,
                                                               Point.Empty, Color.FromArgb((int)(this.Alpha * 255.0f), textObject.FillColor), this.Rotation, true,
                                                               new Rectangle(offsetPoint.X + this.SurfaceRect.X, offsetPoint.Y + this.SurfaceRect.Y, this.surfaceRect.Width, this.surfaceRect.Height), xScale);



                        //if (textObject.TextSprite != null)
                        //{
                        //    textObject.TextSprite.Text = textObject.txt;
                        //    textObject.TextSprite.Font.FontSize = textObject.font2.Size * xScale;

                        //    textObject.TextSprite.Color = Color.FromArgb((int)(this.Alpha * 255.0f),
                        //      textObject.FillColor.R, textObject.FillColor.G, textObject.FillColor.B);

                        //    textObject.TextSprite.SetAxis((float)textObject.TextSprite.Width / 2, (float)textObject.TextSprite.Height / 2);

                        //    textObject.TextSprite.SetPosition((float)this.SurfaceRect.X + textObject.TextSprite.Axis.X + offsetPoint.X,
                        //        (float)this.SurfaceRect.Y + textObject.TextSprite.Axis.Y + offsetPoint.Y);

                        //    textObject.TextSprite.Rotation = this.Rotation;

                        //    textObject.TextSprite.SetScale(xScale, yScale);

                        //    textObject.TextSprite.Draw();

                        //}
                        //if (this.GorgonSprite != null)
                        //{


                        //    this.GorgonSprite.SetScale(xScale, yScale);
                        //    this.GorgonSprite.SetAxis((float)this.GorgonSprite.Image.Width / 2, (float)this.GorgonSprite.Image.Height / 2);
                        //    this.GorgonSprite.Rotation = this.Rotation;

                        //    this.GorgonSprite.SetPosition((float)rectDest.X * xScale + (this.GorgonSprite.Axis.X * xScale),
                        //                                                         (float)rectDest.Y * yScale + (this.GorgonSprite.Axis.Y * yScale));
                        //    this.GorgonSprite.Draw();
                        //}
                    }
                }



                //DRAW SELECTION
                if (showSelection == true)
                {
                    if (this.CoronaObjectParent.isSelected == true)
                    {
                        if (this.CoronaObjectParent.PathFollow != null)
                        {
                            if (this.CoronaObjectParent.PathFollow.isEnabled == true)
                            {
                                this.CoronaObjectParent.PathFollow.drawGorgon(offsetPoint, xScale);
                            }
                        }


                        if (this.CoronaObjectParent.TransformBox != null)
                        {
                            this.CoronaObjectParent.TransformBox.drawGorgon(offsetPoint, xScale);
                        }
                    }
                }
            }
            catch (Exception Exception)
            {
            }
        }
Пример #4
0
        public override Figure CloneInstance(bool keepLocation)
        {
            int offSet = 0;
            if (keepLocation == false)
                offSet = 20;

            Point pos = new Point(this.DisplayObjectParent.SurfaceRect.X + offSet, this.DisplayObjectParent.SurfaceRect.Y);
            float size = this.font2.Size;
            Texte fig = new Texte(pos, this.txt, new Font2(this.font2.FontItem.NameForIphone, size, this.font2.Style), this.m_FillColor, this.m_nEpaisseur, this.m_bRempli, null);
            fig.font2.FontItem = this.font2.FontItem;

            return fig;
        }