コード例 #1
0
        private void strokeBegin(bool erase)
        {
            activeStroke = new CairoStroke(erase?eraserStyle:penStyle);

            // Fix undo/redo
            strokes.RemoveRange(strokes.Count - undo, undo);
            undo = 0;

            strokes.Add(activeStroke);
        }
コード例 #2
0
        public void Deserialize(XmlTextReader xml)
        {
            Clear();

            while (xml.Read())
            {
                switch (xml.NodeType)
                {
                case XmlNodeType.Element:
                    if (xml.Name == "handwriting-data")
                    {
                        break;
                    }
                    else if (xml.Name == "paper")
                    {
                        paper = Paper.Deserialize(xml);
                    }
                    else if (xml.Name == "strokes")
                    {
                        while (xml.Read())
                        {
                            if (xml.NodeType == XmlNodeType.Element &&
                                xml.Name == "stroke")
                            {
                                CairoStroke stroke = new CairoStroke(xml);
                                countPoints += stroke.Count;
                                strokes.Add(stroke);
                            }
                            else if (xml.NodeType == XmlNodeType.EndElement)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Ignoring Unknown XML Element: {0}",
                                          xml.Name);
                    }
                    break;
                }
            }
        }
コード例 #3
0
 private void strokeEnd()
 {
     activeStroke = null;
 }
コード例 #4
0
        private void strokeBegin(bool erase)
        {
            activeStroke = new CairoStroke(erase?eraserStyle:penStyle);

            // Fix undo/redo
            strokes.RemoveRange(strokes.Count - undo, undo);
            undo = 0;

            strokes.Add(activeStroke);
        }
コード例 #5
0
        public void Deserialize(XmlTextReader xml)
        {
            Clear();

            while(xml.Read()) {
                switch(xml.NodeType) {
                case XmlNodeType.Element:
                    if(xml.Name == "handwriting-data") {
                        break;
                    } else if(xml.Name == "paper") {
                        paper = Paper.Deserialize(xml);
                    } else if(xml.Name == "strokes") {
                        while(xml.Read()) {
                            if(xml.NodeType == XmlNodeType.Element &&
                                xml.Name == "stroke") {
                                CairoStroke stroke = new CairoStroke(xml);
                                countPoints += stroke.Count;
                                strokes.Add(stroke);
                            } else if(xml.NodeType == XmlNodeType.EndElement) {
                                break;
                            }
                        }
                    } else {
                        Console.WriteLine("Ignoring Unknown XML Element: {0}",
                            xml.Name);
                    }
                    break;
                }
            }
        }
コード例 #6
0
 private void strokeEnd()
 {
     activeStroke = null;
 }