Пример #1
0
        private void imgTablet_Paint(object sender, PaintEventArgs e)
        {
            Pen        pen1        = new Pen(Color.White, 0.0f);
            SolidBrush solidBrush1 = new SolidBrush(Color.White);
            Pen        pen2;
            SolidBrush solidBrush2;

            if (HNStruct.OemType == OEMType.HUION)
            {
                pen2        = new Pen(HuionConst.HuionBlue1, 1f);
                solidBrush2 = new SolidBrush(HuionConst.HuionBlue2);
            }
            else
            {
                pen2        = new Pen(HuionConst.HuionBlue3, 1f);
                solidBrush2 = new SolidBrush(HuionConst.HuionBlue4);
            }

            if (this.mCurrentKeyLayout != null)
            {
                e.Graphics.DrawPath(pen2, HuionRender.CreateRoundedRectanglePath(this.mCurrentKeyLayout.Rect, 2));
            }
            if (this.mCheckedKeyLayout != null)
            {
                e.Graphics.FillPath((Brush)solidBrush2,
                                    HuionRender.CreateRoundedRectanglePath(this.mCheckedKeyLayout.Rect, 2));
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                e.Graphics.DrawLine(pen2, Utils.getViewCenter((Control)this.clickBtn, 16),
                                    Utils.getRectCenter(this.mCheckedKeyLayout.Rect));
            }

            pen2.Dispose();
        }
Пример #2
0
 public static Image getPenImage()
 {
     return((Image)HuionRender.blowupImage(
                ImageHelper.getDllImage(Marshal.PtrToStringUni(
                                            HuionDriverDLL.hnp_get_pen_image((HnConst.HNTabletType)HNStruct.globalInfo.tabletInfo.devType))),
                DpiHelper.getInstance().XDpi));
 }
Пример #3
0
        private void SetAllControlImage()
        {
            Image image;

            if (this.mOemType == OEMType.HUION)
            {
                image = (Image)HuionRender.blowupImage(ImageHelper.getDllImage("logo.png", OEMType.HUION),
                                                       DpiHelper.getInstance().XDpi);
                this.buttonWeb.BackgroundImage = (Image)ImageHelper.getDllImage("BANNER.jpg", OEMType.HUION);
                this.buttonLOGO.Size           = image.Size;
                int x = this.panelButton.Right / 2 + (this.Width - this.buttonLOGO.Width) / 2;
                if (x < 0)
                {
                    x = 0;
                }
                this.buttonLOGO.Location = new Point(x, this.panelButton.Bottom - this.buttonLOGO.Height);
            }
            else
            {
                image = (Image)HuionRender.blowupImage(ImageHelper.getDllImage("logo.png", this.mOemType),
                                                       DpiHelper.getInstance().XDpi);
                this.buttonWeb.Visible = false;
                this.buttonLOGO.SetBounds((this.Width - image.Width) / 2, 100, image.Width, image.Height);
            }

            this.buttonLOGO.BackgroundImage = image;
        }
Пример #4
0
        private void FormWorkArea_Load(object sender, EventArgs e)
        {
            this.labelSelectScreen.TextAlign = ContentAlignment.MiddleRight;
            this.setViewTextLocale();
            this.btnIdentify.Visible        = this.displayNum > 1;
            this.KeyPreview                 = true;
            this.buttonCalibration.Location = new Point((this.Width - this.buttonCalibration.Width) / 2,
                                                        this.buttonCalibration.Location.Y);
            this.buttonCalibration.Visible = Convert.ToBoolean(HNStruct.globalInfo.tabletInfo.bMonitor);
            this.buttonCalibration.Click  += new EventHandler(this.ButtonCalibration_Click);
            this.SetComboxDisplay();
            this.huionWorkAreaPictureRect1.Parent              = (Control)this.huionWorkAreaPictrueView1;
            this.huionWorkAreaPictureRect1.DeviceRectRotate    = (int)TabletConfigUtils.config.rotateAngle;
            this.huionWorkAreaPictureRect1.ScreenRectRatio     = TabletConfigUtils.config.screenAreaRatio;
            this.huionWorkAreaPictureRect1.DeviceRectRatio     = TabletConfigUtils.config.workAreaRatio;
            this.huionWorkAreaPictureRect1.ScreenRatioChanged +=
                new EventHandler(this.HuionWorkAreaPictureRect1_ScreenRatioChanged);
            this.huionWorkAreaPictureRect1.DeviceRatioChanged +=
                new EventHandler(this.HuionWorkAreaPictureRect1_DeviceRatioChanged);
            this.huionWorkAreaPictrueView1.Callback   += new EventHandler(this.HuionWorkAreaPictrueView1_Callback);
            this.huionWorkAreaPictrueView1.DeviceImage =
                HuionRender.blowupImage(ImageHelper.getDllImage(HNStruct.devTypeString), DpiHelper.getInstance().XDpi);
            this.huionWorkAreaPictrueView1.setDeviceInfo(HNStruct.globalInfo.layoutTablet.size,
                                                         HNStruct.globalInfo.layoutTablet.penArea, (int)TabletConfigUtils.config.rotateAngle);
            this.textBoxLeft.Text     = Convert.ToDouble(TabletConfigUtils.config.workAreaRatio.l).ToString("0.000");
            this.textBoxRight.Text    = Convert.ToDouble(TabletConfigUtils.config.workAreaRatio.r).ToString("0.000");
            this.textBoxTop.Text      = Convert.ToDouble(TabletConfigUtils.config.workAreaRatio.t).ToString("0.000");
            this.textBoxBottom.Text   = Convert.ToDouble(TabletConfigUtils.config.workAreaRatio.b).ToString("0.000");
            this.textBoxLeft.Click   += new EventHandler(this.onTextFocusEnter);
            this.textBoxRight.Click  += new EventHandler(this.onTextFocusEnter);
            this.textBoxTop.Click    += new EventHandler(this.onTextFocusEnter);
            this.textBoxBottom.Click += new EventHandler(this.onTextFocusEnter);
            switch (TabletConfigUtils.config.rotateAngle)
            {
            case 0:
                this.rotateZero.Checked = true;
                break;

            case 90:
                this.rotateNinety.Checked = true;
                break;

            case 180:
                this.rotateTwoNinety.Checked = true;
                break;

            case 270:
                this.rotateThreeNinety.Checked = true;
                break;
            }
        }
Пример #5
0
        public static Image getScaleImage(string imagePath, Control v)
        {
            FileStream fileStream = File.Open(imagePath, FileMode.Open);
            Image      original   = Image.FromStream((Stream)fileStream);

            fileStream.Close();
            fileStream.Dispose();
            Bitmap bmp    = new Bitmap(original);
            Bitmap bitmap = HuionRender.blowupImage(HuionRender.compressImageWithRate(bmp, v.Width, v.Height),
                                                    DpiHelper.getInstance().XDpi);

            original.Dispose();
            if (bitmap == bmp)
            {
                return((Image)bitmap);
            }
            bmp.Dispose();
            return((Image)bitmap);
        }
Пример #6
0
        public static Image getDllScaleImage(string imageName, Control v)
        {
            Stream stream = new Depot().loadImage(imageName);

            Console.WriteLine(imageName);
            Console.WriteLine(stream.ToString());
            Image original = Image.FromStream(stream);

            stream.Close();
            stream.Dispose();
            Bitmap bmp    = new Bitmap(original);
            Bitmap bitmap = HuionRender.blowupImage(HuionRender.compressImageWithRate(bmp, v.Width, v.Height),
                                                    DpiHelper.getInstance().XDpi);

            original.Dispose();
            if (bitmap == bmp)
            {
                return((Image)bitmap);
            }
            bmp.Dispose();
            return((Image)bitmap);
        }
Пример #7
0
 public static Image GetResizeIco(string deviceTypeName, string extensionStr, Control v)
 {
     return((Image)HuionRender.resizeImage(new Bitmap(GetIco(deviceTypeName, extensionStr)), v.Width, v.Height));
 }
Пример #8
0
 public static Image GetScaleIco(string deviceTypeName, string extensionStr)
 {
     return((Image)HuionRender.blowupImage(getImage(GetIconPath(deviceTypeName, extensionStr)),
                                           DpiHelper.getInstance().XDpi));
 }
Пример #9
0
        private void meassure(int refreshPart)
        {
            this.mScreenshot =
                HuionRender.compressImageWithRate(this.mScreenshot, this.ScreenshotMaxWidth, this.ScreenshotMaxHeight);
            if (this.mScreenshot != null)
            {
                this.mScreenshotRect        = new Rectangle();
                this.mScreenshotRect.Width  = this.mScreenshot.Width;
                this.mScreenshotRect.Height = this.mScreenshot.Height;
                this.mScreenshotRect.X      = 0;
                this.mScreenshotRect.Y      = 0;
            }

            this.mDeviceImage4Draw =
                HuionRender.rotateImageCenter(this.mDeviceImage, (float)this.mRotate, Color.Transparent);
            this.mDeviceImage4Draw = HuionRender.compressImageWithRate(this.mDeviceImage4Draw, this.DeviceImageMaxWidth,
                                                                       this.DeviceImageMaxHeight);
            if (this.mDeviceImage4Draw != null)
            {
                this.mDeviceImageRect        = new Rectangle();
                this.mDeviceImageRect.Width  = this.mDeviceImage4Draw.Width;
                this.mDeviceImageRect.Height = this.mDeviceImage4Draw.Height;
                this.mDeviceImageRect.X      = (this.mScreenshotRect.Width - this.mDeviceImage4Draw.Width) / 2;
                this.mDeviceImageRect.Y      = this.mScreenshotRect.Y + this.mScreenshotRect.Height + this.mIntervalSpace;
            }

            if (this.mDeviceImageRect.X < 0)
            {
                this.mDeviceImageRect.X = 0;
            }
            this.Width = this.mDeviceImageRect.Width > this.mScreenshotRect.Width
                ? this.mDeviceImageRect.Width
                : this.mScreenshotRect.Width;
            this.Height = this.mDeviceImageRect.Bottom;
            if (this.Width > this.mScreenshotRect.Width)
            {
                this.mScreenshotRect.X = (this.Width - this.mScreenshotRect.Width) / 2;
            }
            if (this.mDeviceImage4Draw != null && this.mDeviceSize.cx > 0 && this.mDeviceSize.cy > 0)
            {
                this.mPenWorkRect = Utils.swapLayout(this.mDeviceImage4Draw.Size,
                                                     Utils.rotateSize(this.mDeviceSize, this.mRotate),
                                                     Utils.rotateRect(this.mPenWorkarea, this.mDeviceSize, this.mRotate));
                this.mPenWorkRect.X += this.mDeviceImageRect.X;
                this.mPenWorkRect.Y += this.mDeviceImageRect.Y;
            }

            if ((refreshPart & 1) == 1)
            {
                this.Invalidate(new Rectangle(0, 0, this.Width, this.mScreenshotRect.Bottom));
            }
            else if ((refreshPart & 2) == 2)
            {
                this.Invalidate(new Rectangle(0, this.mDeviceImageRect.Y, this.Width, this.mDeviceImageRect.Height));
            }
            else
            {
                this.Invalidate();
            }
            if (this.Callback == null)
            {
                return;
            }
            this.Callback((object)this, (EventArgs)PictureViewEventArgs.getInstance(this.Rotate));
        }