@ -106,17 +106,22 @@ using (Image<Rgba32> image = Image.Load<Rgba32>(stream))
}
```
Setting individual pixel values is perfomed as follows:
Setting individual pixel values can be perfomed as follows:
```csharp
// Individual pixels
using (Image<Rgba32> image = new Image<Rgba32>(400, 400)
using (PixelAccessor<Rgba32> pixels = image.Lock())
{
pixels[200, 200] = Rgba32.White;
image[200, 200] = Rgba32.White;
}
```
For advanced usage there are multiple [PixelFormat implementations](https://github.com/JimBobSquarePants/ImageSharp/tree/master/src/ImageSharp/PixelFormats) available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame.
For optimized access within a loop it is recommended that the following methods are used.
1. `image.GetRowSpan(y)`
2. `image.GetRowSpan(x, y)`
For advanced pixel format usage there are multiple [PixelFormat implementations](https://github.com/JimBobSquarePants/ImageSharp/tree/master/src/ImageSharp/PixelFormats) available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame.
All in all this should allow image processing to be much more accessible to developers which has always been my goal from the start.
/// The <paramref name="region" /> when being applied to things like shapes would usually be the bounding box of the shape not necessarily the shape of the whole image.
/// Switches the buffers used by the image and the PixelAccessor meaning that the Image will "own" the buffer from the PixelAccessor and the PixelAccessor will now own the Images buffer.
/// </summary>
@ -169,11 +248,11 @@ namespace ImageSharp
intnewWidth=pixelSource.Width;
intnewHeight=pixelSource.Height;
// Push my memory into the accessor (which in turn unpins the old puffer ready for the images use)
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SuppressFinalize to
@ -169,7 +173,7 @@ namespace ImageSharp
/// </summary>
publicvoidReset()
{
this.pixelBuffer.Clear();
this.PixelBuffer.Clear();
}
/// <summary>
@ -241,7 +245,7 @@ namespace ImageSharp
/// <remarks>If <see cref="M:PixelAccessor.PooledMemory"/> is true then caller is responsible for ensuring <see cref="M:PixelDataPool.Return()"/> is called.</remarks>
// are the upper and lower bounds of the source rectangle.
// TODO: Using a transposed variant of 'firstPassPixels' could eliminate the need for the WeightsWindow.ComputeWeightedColumnSum() method, and improve speed!