Beispiel #1
0
        private MouseEventArgs start; /// 画像範囲選択開始位置

        #endregion Fields

        #region Constructors

        /// <summary>
        /// フォームコンストラクタ
        /// </summary>
        public FormMain()
        {
            InitializeComponent();

            pages = null;
            gridChanging = false;
            copy = null;
            start = null;
            end = null;
            selectedIndex = -1;
            saved = true;

            setting = Setting.Load();

            splitContainer_Panel1_ClientSizeChanged(null, null);
            splitContainer_Panel2_ClientSizeChanged(null, null);

            editWidth.Value = setting.PageWidth;
            editHeight.Value = setting.PageHeight;
            rdbRtl.Checked = setting.RtoL;
            rdbLtr.Checked = !setting.RtoL;

            EnabledButtonsAndMenuItems(false, false);
        }
Beispiel #2
0
        /// <summary>
        /// 画像形式変換
        /// </summary>
        /// <param name="src">元画像データ</param>
        /// <param name="format">出力形式</param>
        /// <returns>変換結果画像</returns>
        private static unsafe Bitmap ConvertFormat(Bitmap src, Page.PageFormat format)
        {
            PixelFormat pf;
            switch (format)
            {
                case Page.PageFormat.Gray8bit:
                    pf = PixelFormat.Format8bppIndexed;
                    break;
                case Page.PageFormat.Gray4bit:
                    pf = PixelFormat.Format4bppIndexed;
                    break;
                case Page.PageFormat.Mono:
                    pf = PixelFormat.Format1bppIndexed;
                    break;
                default:
                    return src;
            }

            Bitmap dst = new Bitmap(src.Width, src.Height, pf);
            BitmapData srcData = src.LockBits(new Rectangle(0, 0, src.Width, src.Height), ImageLockMode.ReadOnly, pf);
            BitmapData dstData = dst.LockBits(new Rectangle(0, 0, dst.Width, dst.Height), ImageLockMode.WriteOnly, pf);
            void* srcBuf = (void*)srcData.Scan0;
            void* dstBuf = (void*)dstData.Scan0;
            CopyMemory(dstBuf, srcBuf, (UIntPtr)(dstData.Stride * dstData.Height));
            dst.UnlockBits(dstData);
            src.UnlockBits(srcData);

            return dst;
        }
Beispiel #3
0
 /// <summary>
 /// 複製生成
 /// </summary>
 /// <returns>複製</returns>
 public object Clone()
 {
     Page newPage = new Page(path);
     newPage.index = index;
     newPage.locked = locked;
     newPage.rotate = rotate;
     newPage.format = format;
     newPage.clipLeft = clipLeft;
     newPage.clipTop = clipTop;
     newPage.clipRight = clipRight;
     newPage.clipBottom = clipBottom;
     newPage.bold = bold;
     newPage.contrast = contrast;
     return newPage;
 }
Beispiel #4
0
 /// <summary>
 /// ページ設定コピー
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnCopy_Click(object sender, EventArgs e)
 {
     if (pagesGrid.SelectedRows.Count > 0)
     {
         copy = (Page)pages[pagesGrid.SelectedRows[0].Index].Clone();
         EnabledButtonsAndMenuItems(true, true);
     }
 }