init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,324 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace VideoReader;
public class UCPictureBox : UserControl
{
private Size size = new Size(1280, 720);
private Image image;
private float scale = 1f;
private Point PointImage = new Point(0, 0);
public RotateFlipType RotateFlip;
private int rotate = 0;
private int flip = 0;
private Point mousestart;
private bool Mousestart;
private IContainer components = null;
public int Rotate
{
get
{
return rotate;
}
set
{
rotate = value;
RoutFlip();
}
}
public int Flip
{
get
{
return flip;
}
set
{
flip = value;
RoutFlip();
}
}
public Image Image
{
get
{
return image;
}
set
{
image = value;
}
}
public Size SizeImage
{
get
{
return size;
}
set
{
size = value;
}
}
public UCPictureBox()
{
InitializeComponent();
((Control)this).DoubleBuffered = true;
}
private void RoutFlip()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
RotateFlipType rotateFlip = (RotateFlipType)0;
if (rotate == 0 && flip == 1)
{
rotateFlip = (RotateFlipType)4;
}
else if (rotate == 0 && flip == 2)
{
rotateFlip = (RotateFlipType)6;
}
else if (rotate == 0 && flip == 3)
{
rotateFlip = (RotateFlipType)2;
}
else if (rotate == 90 && flip == 0)
{
rotateFlip = (RotateFlipType)1;
}
else if (rotate == 90 && flip == 1)
{
rotateFlip = (RotateFlipType)5;
}
else if (rotate == 90 && flip == 2)
{
rotateFlip = (RotateFlipType)7;
}
else if (rotate == 90 && flip == 3)
{
rotateFlip = (RotateFlipType)3;
}
else if (rotate == 180 && flip == 0)
{
rotateFlip = (RotateFlipType)2;
}
else if (rotate == 180 && flip == 1)
{
rotateFlip = (RotateFlipType)6;
}
else if (rotate == 180 && flip == 2)
{
rotateFlip = (RotateFlipType)4;
}
else if (rotate == 180 && flip == 3)
{
rotateFlip = (RotateFlipType)0;
}
else if (rotate == 270 && flip == 0)
{
rotateFlip = (RotateFlipType)3;
}
else if (rotate == 270 && flip == 1)
{
rotateFlip = (RotateFlipType)7;
}
else if (rotate == 270 && flip == 2)
{
rotateFlip = (RotateFlipType)5;
}
else if (rotate == 270 && flip == 3)
{
rotateFlip = (RotateFlipType)1;
}
RotateFlip = rotateFlip;
((Control)this).Refresh();
}
public Point rePoint(Point point)
{
Point result = default(Point);
int num = 0;
int num2 = 0;
if (Rotate == 0)
{
result.X = (int)((float)point.X * scale) + PointImage.X;
result.Y = (int)((float)point.Y * scale) + PointImage.Y;
}
else if (Rotate == 90)
{
result.X = (int)((float)point.Y * scale) + PointImage.Y;
result.Y = size.Height - ((int)((float)point.X * scale) + PointImage.X);
}
else if (Rotate == 180)
{
result.X = size.Width - ((int)((float)point.X * scale) + PointImage.X);
result.Y = size.Height - ((int)((float)point.Y * scale) + PointImage.Y);
}
else if (Rotate == 270)
{
result.X = size.Width - ((int)((float)point.Y * scale) + PointImage.Y);
result.Y = (int)((float)point.X * scale) + PointImage.X;
}
if (Flip == 1 || Flip == 3)
{
result.X = size.Width - result.X;
}
if (Flip == 2 || Flip == 3)
{
result.Y = size.Height - result.Y;
}
return result;
}
public void Zoom(bool zoom)
{
if (zoom)
{
scale += scale / 25f;
}
else
{
scale -= scale / 25f;
}
if (scale > 3f)
{
scale = 3f;
}
if ((double)scale < 0.1)
{
scale = 0.1f;
}
((Control)this).Refresh();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Invalid comparison between Unknown and I4
Rectangle rectangle = new Rectangle(PointImage.X, PointImage.Y, Convert.ToInt32((float)((Control)this).Width * scale), Convert.ToInt32((float)((Control)this).Height * scale));
if (image != null)
{
Bitmap val = new Bitmap(image);
((Image)val).RotateFlip(RotateFlip);
e.Graphics.Clear(((Control)this).BackColor);
if ((int)RotateFlip == 0 || (int)RotateFlip == 2)
{
e.Graphics.DrawImage((Image)(object)val, new Rectangle(0, 0, ((Control)this).Width, ((Control)this).Height), rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, (GraphicsUnit)2);
}
else
{
e.Graphics.DrawImage((Image)(object)val, new Rectangle(0, 0, ((Control)this).Width, ((Control)this).Height), rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, (GraphicsUnit)2);
}
}
else
{
((ScrollableControl)this).OnPaintBackground(e);
}
}
protected override void OnMouseWheel(MouseEventArgs e)
{
if (e.Delta < 0)
{
Zoom(zoom: true);
}
else
{
Zoom(zoom: false);
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
((UserControl)this).OnMouseDown(e);
Mousestart = true;
mousestart = e.Location;
}
protected override void OnMouseUp(MouseEventArgs e)
{
((Control)this).OnMouseUp(e);
Mousestart = false;
}
protected override void OnMouseMove(MouseEventArgs e)
{
((Control)this).OnMouseMove(e);
if (Mousestart)
{
PointImage.X += mousestart.X - e.X;
PointImage.Y += mousestart.Y - e.Y;
mousestart = e.Location;
if (PointImage.X < 0)
{
PointImage.X = 0;
}
if (PointImage.Y < 0)
{
PointImage.Y = 0;
}
((Control)this).Refresh();
}
}
protected override void OnMouseLeave(EventArgs e)
{
((Control)this).OnMouseLeave(e);
Mousestart = false;
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
((ContainerControl)this).Dispose(disposing);
}
private void InitializeComponent()
{
((Control)this).SuspendLayout();
((ContainerControl)this).AutoScaleMode = (AutoScaleMode)0;
((Control)this).Name = "UCPictureBox";
((Control)this).ResumeLayout(false);
}
}