Skip to content

Commit 4516d09

Browse files
author
Wayfarer
committed
finally fix up all the conversions
1 parent 24da193 commit 4516d09

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

Imaging/DirectBitmap.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using System.Windows;
2828
using System.Windows.Media;
2929
using System.Windows.Media.Imaging;
30+
using Imaging.Interfaces;
3031
using Color = System.Drawing.Color;
3132
using PixelFormat = System.Drawing.Imaging.PixelFormat;
3233

@@ -37,7 +38,7 @@ namespace Imaging
3738
/// Simple elegant Solution to get Color of an pixel, for more information look into Source.
3839
/// </summary>
3940
/// <seealso cref="T:System.IDisposable" />
40-
public sealed class DirectBitmap : IDisposable, IEquatable<DirectBitmap>
41+
public sealed class DirectBitmap : IDisposable, IEquatable<DirectBitmap>, IPixelSurface
4142
{
4243
/// <summary>
4344
/// The synchronize lock
@@ -445,6 +446,12 @@ public Color GetPixel(int x, int y)
445446
return Color.FromArgb(p.A, p.R, p.G, p.B);
446447
}
447448

449+
public Pixel32 GetPixel32(int x, int y)
450+
{
451+
throw new NotImplementedException();
452+
}
453+
454+
448455
/// <summary>
449456
/// Gets the column of pixels at a given x-coordinate.
450457
/// </summary>

Imaging/DirectBitmapImage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public void SetPixelsBulk(IEnumerable<(int x, int y, Color color)> pixels)
297297
/// </summary>
298298
/// <param name="src">Source pixels to blend (same size as current bitmap)</param>
299299
/// <exception cref="System.ArgumentException">Source must match image size</exception>
300-
public unsafe void BlendInt(uint[] src)
300+
public void BlendInt(uint[] src)
301301
{
302302
DirectBitmapCore.BlendInt(Bits, src);
303303
UpdateBitmapFromBits();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Imaging.Interfaces
8+
{
9+
public interface IPixelSurface : IDisposable
10+
{
11+
int Width { get; }
12+
int Height { get; }
13+
14+
Pixel32[] Bits { get; }
15+
16+
void SetPixel(int x, int y, System.Drawing.Color color);
17+
18+
void SetPixelsSimd(IEnumerable<(int x, int y, System.Drawing.Color color)> pixels);
19+
20+
void BlendInt(uint[] src);
21+
22+
Pixel32 GetPixel32(int x, int y);
23+
}
24+
25+
}

0 commit comments

Comments
 (0)