Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Image{TPixel}" /> class
        /// with the height and the width of the image.
        /// </summary>
        /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
        /// <param name="metadata">The images metadata.</param>
        /// <param name="frames">The frames that will be owned by this image instance.</param>
        internal Image(Configuration configuration, ImageMetadata metadata, IEnumerable <ImageFrame <TPixel> > frames)
            : base(configuration, PixelTypeInfo.Create <TPixel>(), metadata, ValidateFramesAndGetSize(frames))
        {
            ArrayPoolMemoryAllocator memoryAllocator = (ArrayPoolMemoryAllocator)this.GetConfiguration().MemoryAllocator;

            memoryAllocator.LockingOnThread();
            this.Frames = new ImageFrameCollection <TPixel>(this, frames);
            memoryAllocator.Unlock();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Image{TPixel}"/> class
        /// with the height and the width of the image.
        /// </summary>
        /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
        /// <param name="width">The width of the image in pixels.</param>
        /// <param name="height">The height of the image in pixels.</param>
        /// <param name="metadata">The images metadata.</param>
        internal Image(Configuration configuration, int width, int height, ImageMetadata metadata)
            : base(configuration, PixelTypeInfo.Create <TPixel>(), metadata, width, height)
        {
            ArrayPoolMemoryAllocator memoryAllocator = (ArrayPoolMemoryAllocator)this.GetConfiguration().MemoryAllocator;

            memoryAllocator.LockingOnThread();
            this.Frames = new ImageFrameCollection <TPixel>(this, width, height, default(TPixel));
            memoryAllocator.Unlock();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Image{TPixel}"/> class
 /// with the height and the width of the image.
 /// </summary>
 /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
 /// <param name="width">The width of the image in pixels.</param>
 /// <param name="height">The height of the image in pixels.</param>
 /// <param name="backgroundColor">The color to initialize the pixels with.</param>
 /// <param name="metadata">The images metadata.</param>
 internal Image(
     Configuration configuration,
     int width,
     int height,
     TPixel backgroundColor,
     ImageMetadata metadata)
     : base(configuration, PixelTypeInfo.Create <TPixel>(), metadata, width, height)
 {
     this.frames = new ImageFrameCollection <TPixel>(this, width, height, backgroundColor);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Image{TPixel}"/> class
 /// wrapping an external <see cref="MemoryGroup{T}"/>.
 /// </summary>
 /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
 /// <param name="memoryGroup">The memory source.</param>
 /// <param name="width">The width of the image in pixels.</param>
 /// <param name="height">The height of the image in pixels.</param>
 /// <param name="metadata">The images metadata.</param>
 internal Image(
     Configuration configuration,
     MemoryGroup <TPixel> memoryGroup,
     int width,
     int height,
     ImageMetadata metadata)
     : base(configuration, PixelTypeInfo.Create <TPixel>(), metadata, width, height)
 {
     this.frames = new ImageFrameCollection <TPixel>(this, width, height, memoryGroup);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Image{TPixel}"/> class
        /// with the height, the width and raw byte data of the image.
        /// </summary>
        /// <param name="width">The width of the image in pixels.</param>
        /// <param name="height">The height of the image in pixels.</param>
        /// <param name="RawData">The pixels byte data in Raw.</param>
        public Image(int width, int height, byte[] RawData)
            : base(Configuration.Default, PixelTypeInfo.Create <TPixel>(), new ImageMetadata(), width, height)
        {
            ArrayPoolMemoryAllocator memoryAllocator = (ArrayPoolMemoryAllocator)this.GetConfiguration().MemoryAllocator;

            memoryAllocator.LockingOnThread();
            if (memoryAllocator != null)
            {
                memoryAllocator.RawData = RawData;
            }
            this.Frames             = new ImageFrameCollection <TPixel>(this, width, height, default(TPixel));
            memoryAllocator.RawData = null;
            memoryAllocator.Unlock();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Image{TPixel}"/> class
 /// with the height and the width of the image.
 /// </summary>
 /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
 /// <param name="width">The width of the image in pixels.</param>
 /// <param name="height">The height of the image in pixels.</param>
 /// <param name="metadata">The images metadata.</param>
 internal Image(Configuration configuration, int width, int height, ImageMetadata metadata)
     : base(configuration, PixelTypeInfo.Create <TPixel>(), metadata, width, height)
 {
     this.frames = new ImageFrameCollection <TPixel>(this, width, height, default(TPixel));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Image{TPixel}" /> class
 /// with the height and the width of the image.
 /// </summary>
 /// <param name="configuration">The configuration providing initialization code which allows extending the library.</param>
 /// <param name="metadata">The images metadata.</param>
 /// <param name="frames">The frames that will be owned by this image instance.</param>
 internal Image(Configuration configuration, ImageMetadata metadata, IEnumerable <ImageFrame <TPixel> > frames)
     : base(configuration, PixelTypeInfo.Create <TPixel>(), metadata, ValidateFramesAndGetSize(frames))
 {
     this.frames = new ImageFrameCollection <TPixel>(this, frames);
 }