mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-12 04:49:32 +08:00
(IarImage.Blend): use Drawing.Rectangle instead of Windows.Rect structure.
This commit is contained in:
parent
b2b2d674dd
commit
83b61f6d50
@ -30,7 +30,7 @@ using System.IO;
|
|||||||
using GameRes.Utility;
|
using GameRes.Utility;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace GameRes.Formats.Sas5
|
namespace GameRes.Formats.Sas5
|
||||||
{
|
{
|
||||||
@ -328,29 +328,27 @@ namespace GameRes.Formats.Sas5
|
|||||||
|
|
||||||
public void Blend (IarImage overlay)
|
public void Blend (IarImage overlay)
|
||||||
{
|
{
|
||||||
Rect self = new Rect (-Info.OffsetX, -Info.OffsetY, Info.Width, Info.Height);
|
var self = new Rectangle (-Info.OffsetX, -Info.OffsetY, (int)Info.Width, (int)Info.Height);
|
||||||
Rect src = new Rect (-overlay.Info.OffsetX, -overlay.Info.OffsetY,
|
var src = new Rectangle (-overlay.Info.OffsetX, -overlay.Info.OffsetY,
|
||||||
overlay.Info.Width, overlay.Info.Height);
|
(int)overlay.Info.Width, (int)overlay.Info.Height);
|
||||||
var blend = Rect.Intersect (self, src);
|
var blend = Rectangle.Intersect (self, src);
|
||||||
if (blend.IsEmpty)
|
if (blend.IsEmpty)
|
||||||
return;
|
return;
|
||||||
src.X = blend.Left - src.Left;
|
src.X = blend.Left - src.Left;
|
||||||
src.Y = blend.Top - src.Top;
|
src.Y = blend.Top - src.Top;
|
||||||
src.Width = blend.Width;
|
src.Width = blend.Width;
|
||||||
src.Height= blend.Height;
|
src.Height= blend.Height;
|
||||||
int x = (int)(blend.Left - self.Left);
|
int x = blend.Left - self.Left;
|
||||||
int y = (int)(blend.Top - self.Top);
|
int y = blend.Top - self.Top;
|
||||||
int w = (int)src.Width;
|
if (src.Width <= 0 || src.Height <= 0)
|
||||||
int h = (int)src.Height;
|
|
||||||
if (w <= 0 || h <= 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int pixel_size = Info.Stride / (int)Info.Width;
|
int pixel_size = Info.Stride / (int)Info.Width;
|
||||||
int dst = y * Info.Stride + x * pixel_size;
|
int dst = y * Info.Stride + x * pixel_size;
|
||||||
int ov = (int)src.Top * overlay.Info.Stride + (int)src.Left * pixel_size;
|
int ov = src.Top * overlay.Info.Stride + src.Left * pixel_size;
|
||||||
for (int row = 0; row < h; ++row)
|
for (int row = 0; row < src.Height; ++row)
|
||||||
{
|
{
|
||||||
for (int col = 0; col < w; ++col)
|
for (int col = 0; col < src.Width; ++col)
|
||||||
{
|
{
|
||||||
int src_pixel = ov + col*pixel_size;
|
int src_pixel = ov + col*pixel_size;
|
||||||
if (pixel_size > 3 && overlay.Data[src_pixel+3] > 0)
|
if (pixel_size > 3 && overlay.Data[src_pixel+3] > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user