Ejemplo n.º 1
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="path">顔パターンファイルのパス</param>
        public FaceDef(string path)
        {
            string    defFile = System.IO.Path.Combine(path, FaceDefName);
            Hashtable def     = PropertyList.Load(defFile);

            // 情報
            _path    = path;
            _title   = ReadInfoString(def, KeyInfoTitle);
            _author  = ReadInfoString(def, KeyInfoAuthor);
            _version = ReadInfoString(def, KeyInfoVersion);

            if (def.ContainsKey(KeyInfoSiteURL))
            {
                try
                {
                    _webSite = new Uri(def[KeyInfoSiteURL] as string);
                }
                catch (UriFormatException) {}
            }


            // パーツの読み込み
            ArrayList partDefList = (ArrayList)def[KeyDefParts];

            if (partDefList == null)
            {
                // throw new IOException();
            }

            _parts = new Part[partDefList.Count];
            for (int i = 0; i < partDefList.Count; i++)
            {
                _parts[i] = ReadPart(path, (Hashtable)partDefList[i]);
            }

            // パターンの読み込み
            int suiteCount = PatternSuite.GetNames(typeof(PatternSuite)).Length;

            ;
            ArrayList suiteDefList = (ArrayList)def[KeyDefPatterns];

            _patternSuites = new Part[suiteCount][][];
            for (int i = 0; i < suiteCount; i++)
            {
                _patternSuites[i] = ReadPatternSuite(_parts, (ArrayList)suiteDefList[i]);
            }

            // マーカーの読み込み
            ArrayList markerDefList = (ArrayList)def[KeyDefMarkers];

            _markers = new Part[markerDefList.Count];
            for (int i = 0; i < markerDefList.Count; i++)
            {
                _markers[i] = _parts[(int)((long)markerDefList[i])];
            }

            // タイトルパターンの読み込み
            _titlePattern = ReadPattern(_parts, (ArrayList)def[KeyDefTitlePattern]);
        }
Ejemplo n.º 2
0
        public Image PatternImage(PatternSuite suite, int no, int markers)
        {
            Bitmap   image = new Bitmap(ImageWidth, ImageHeight);
            Graphics g     = Graphics.FromImage(image);

            DrawPatternImage(g, suite, no, markers);
            g.Dispose();
            return(image);
        }
Ejemplo n.º 3
0
        public void DrawPatternImage(Graphics g, PatternSuite suite, int no, int markers)
        {
            Part[] pattern = _patternSuites[(int)suite][no];
            foreach (Part part in pattern)
            {
                g.DrawImage(part.Image,
                            part.Point.X, part.Point.Y,
                            part.Image.Size.Width, part.Image.Size.Height);
            }

            if (markers != 0)
            {
                for (int i = 0; i < 8; i++)
                {
                    if ((markers & (1 << i)) != 0)
                    {
                        Part part = _markers[i];
                        g.DrawImage(part.Image,
                                    part.Point.X, part.Point.Y,
                                    part.Image.Size.Width, part.Image.Size.Height);
                    }
                }
            }
        }