This commit is contained in:
Meizar 2025-08-01 06:36:02 +07:00
parent fcb1f741b9
commit ce95630cc6
4 changed files with 28 additions and 17 deletions

View file

@ -4,7 +4,7 @@ namespace WebApp;
public class ImageGenerator
{
public byte[] GenerateImage3(RequestBody requestBody)
public byte[] GenerateImage(RequestBody requestBody)
{
string[] inputs = requestBody.CanvasRect.Split(":");
double scale = requestBody.OutputScale;
@ -42,7 +42,12 @@ public class ImageGenerator
mat = mat.Resize(new Size(width, height));
}
Rect origin = new Rect((item.Col - 1) * a1Mat.Cols, (item.Row - 1) * a1Mat.Rows, a1Mat.Cols, a1Mat.Rows);
Rect origin = new Rect(
(item.Col - 1) * a1Mat.Cols,
(item.Row - 1) * a1Mat.Rows,
a1Mat.Cols,
a1Mat.Rows);
var offset = origin.Location;
var roi = origin.Intersect(globalRoI);
if (roi.Width == 0 || roi.Height == 0) return;