public static HNStruct.HNRect rotateRect(HNStruct.HNRect src, HNStruct.HNSize size, int angle) { HNStruct.HNRect hnRect = src; int num1 = src.right - src.left; int num2 = src.bottom - src.top; switch (angle) { case 90: hnRect.left = size.cy - src.bottom; hnRect.top = src.left; hnRect.right = hnRect.left + num2; hnRect.bottom = hnRect.top + num1; break; case 180: hnRect.left = size.cx - src.right; hnRect.top = size.cy - src.bottom; hnRect.right = hnRect.left + num1; hnRect.bottom = hnRect.top + num2; break; case 270: hnRect.left = src.top; hnRect.top = size.cx - src.right; hnRect.right = hnRect.left + num2; hnRect.bottom = hnRect.top + num1; break; } return(hnRect); }
public void setDeviceInfo(HNStruct.HNSize deviceSize, HNStruct.HNRect penWorkarea, int rotate) { this.mDeviceSize = deviceSize; this.mPenWorkarea = penWorkarea; this.mRotate = rotate; this.meassure(0); }
public static HNStruct.HNSize rotateSize(HNStruct.HNSize size, int angle) { HNStruct.HNSize hnSize = size; if (angle == 90 || angle == 270) { hnSize.cx = size.cy; hnSize.cy = size.cx; } return(hnSize); }
public static Rectangle swapLayout(Size imageSize, HNStruct.HNSize keyPanelSize, HNStruct.HNRect keyRect) { float num1 = (float)imageSize.Width / (float)keyPanelSize.cx; float num2 = (float)imageSize.Height / (float)keyPanelSize.cy; return(new Rectangle() { X = (int)Math.Round((double)keyRect.left * (double)num1), Y = (int)Math.Round((double)keyRect.top * (double)num2), Width = (int)Math.Round((double)(keyRect.right - keyRect.left) * (double)num1), Height = (int)Math.Round((double)(keyRect.bottom - keyRect.top) * (double)num2) }); }
public static HuionKeyLayout swapLayout(Size imageSize, HNStruct.HNSize keyPanelSize, HNStruct.HNLayoutEkey keyLayout) { HuionKeyLayout huionKeyLayout = new HuionKeyLayout(); float num1 = (float)imageSize.Width / (float)keyPanelSize.cx; float num2 = (float)imageSize.Height / (float)keyPanelSize.cy; Rectangle rectangle1 = swapLayout(imageSize, keyPanelSize, keyLayout.rect); Rectangle rectangle2 = swapLayout(imageSize, keyPanelSize, keyLayout.inRect); huionKeyLayout.Center = new Point() { X = (int)Math.Round((double)keyLayout.center.x * (double)num1), Y = (int)Math.Round((double)keyLayout.center.y * (double)num2) }; huionKeyLayout.InnerRect = rectangle2; huionKeyLayout.Rect = rectangle1; return(huionKeyLayout); }