Esempio n. 1
0
        /// <summary>
        /// SFEN文字列と、出力ファイル名を指定することで、局面の画像ログを出力します。
        /// </summary>
        /// <param name="sfenstring"></param>
        /// <param name="outFileFullName"></param>
        /// <param name="reportEnvironment"></param>
        /// <returns></returns>
        public static bool Write2(
            IEngineConf engineConf,
            string sfenstring,
            string outFileFullName,
            ReportEnvironment reportEnvironment
            )
        {
            bool successful = true;


            //System.Windows.Forms.MessageBox.Show(sfenstring + "\n" + outFile, "局面PNG書き出し");

            //
            // SFEN → RO_SfenStartpos
            //
            ISfenPosition2 ro_SfenStartpos;
            string         rest;

            if (!SfenStringReader.ReadString(sfenstring, out rest, out ro_SfenStartpos))
            {
                //System.Windows.Forms.MessageBox.Show(sfenstring,"sfenstringパース失敗");
                successful = false;
                goto gt_EndMethod;
            }

            KyokumenPngWriterImpl.Write1(
                engineConf,
                ro_SfenStartpos.ToKyokumen1(),
                outFileFullName,
                reportEnvironment
                );

gt_EndMethod:
            return(successful);
        }
Esempio n. 2
0
        /// <summary>
        /// SFEN文字列と、出力ファイル名を指定することで、局面の画像ログを出力します。
        /// </summary>
        /// <param name="sfenstring"></param>
        /// <param name="outFileFullName"></param>
        /// <param name="reportEnvironment"></param>
        /// <returns></returns>
        public static bool Write1(
            IEngineConf engineConf,
            ISfenPosition1 ro_Kyokumen1,
            string outFileFullName,
            ReportEnvironment reportEnvironment
            )
        {
            bool successful = true;

            KyokumenPngWriter repWriter = new KyokumenPngWriterImpl(engineConf);
            ReportArgs        args      = new ReportArgsImpl(
                ro_Kyokumen1,
                outFileFullName,
                reportEnvironment
                );

            // 局面画像を描きだします。
            Bitmap bmp = new Bitmap(
                2 * (args.Env.KmW + 2 * args.Env.SjW) + BN_SUJIS * args.Env.KmW + BN_BRD_R_W,
                BN_DANS * args.Env.KmH + BN_BRD_B_W
                );


            repWriter.Paint(Graphics.FromImage(bmp), args);


            //System.Windows.Forms.MessageBox.Show(args.Env.OutFolder + args.OutFile, "bmp.Save");
            // フォルダーが無ければ、作る必要があります。
            {
                DirectoryInfo dirInfo = Directory.GetParent(args.OutFileFullName);
                if (!Directory.Exists(dirInfo.FullName))
                {
                    Directory.CreateDirectory(dirInfo.FullName);
                }
            }
            bmp.Save(args.OutFileFullName);

            return(successful);
        }