public IPixelAccessor GetPixelAccessor(IImageBase image) { Type packed = typeof (Color2); if (pixelAccessors.ContainsKey(packed)){ return pixelAccessors[packed].Invoke(image); } throw new NotSupportedException($"PixelAccessor cannot be loaded for {packed}:"); }
public ColorPixelAccessor(IImageBase image) { if (image == null){ throw new ArgumentNullException(); } if (image.Width <= 0 || image.Height <= 0){ throw new ArgumentOutOfRangeException(); } Width = image.Width; Height = image.Height; pixelsHandle = GCHandle.Alloc(((ImageBase) image).Pixels, GCHandleType.Pinned); pixelsBase = (Color2*) pixelsHandle.AddrOfPinnedObject().ToPointer(); }
/// <summary> /// Initializes a new instance of the <see cref="ImageBrush{TColor}"/> class. /// </summary> /// <param name="image">The image.</param> public ImageBrush(IImageBase <TColor> image) { this.image = image; }
/// <summary> /// Copies the properties from the other <see cref="IImageBase"/>. /// </summary> /// <param name="other"> /// The other <see cref="IImageBase"/> to copy the properties from. /// </param> protected void CopyProperties(IImageBase other) { DebugGuard.NotNull(other, nameof(other)); this.Configuration = other.Configuration; }
/// <summary> /// Initializes a new instance of the <see cref="ImageBrush{TPixel}"/> class. /// </summary> /// <param name="image">The image.</param> public ImageBrush(IImageBase <TPixel> image) { this.image = image; }