C# Class SimplePaletteQuantizer.Helpers.ImageBuffer

Inheritance: IDisposable
显示文件 Open project: RHY3756547/FreeSO Class Usage Examples

Public Methods

Method Description
CalculateImageMeanError ( Image sourceImage, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
CalculateImageMeanError ( Image sourceImage, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
CalculateImageMeanError ( ImageBuffer source, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
CalculateImageMeanError ( ImageBuffer source, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
CalculateImageNormalizedMeanError ( Image sourceImage, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
CalculateImageNormalizedMeanError ( Image sourceImage, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
CalculateImageNormalizedMeanError ( ImageBuffer source, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
CalculateImageNormalizedMeanError ( ImageBuffer source, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
CalculateMeanError ( ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
CalculateNormalizedMeanError ( ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
ChangeFormat ( Image sourceImage, PixelFormat targetFormat, IColorQuantizer quantizer, Image &targetImage, Int32 parallelTaskCount = 4 ) : void
ChangeFormat ( ImageBuffer target, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
ChangeFormat ( ImageBuffer source, PixelFormat targetFormat, IColorQuantizer quantizer, Image &targetImage, Int32 parallelTaskCount = 4 ) : void
Clamp ( Int32 value, Int32 minimum, Int32 maximum = 255 ) : Int32
Copy ( ) : Byte[]
CorrectGamma ( System.Single gamma, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
CorrectImageGamma ( Image sourceImage, System.Single gamma, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
Dispose ( ) : void
Dither ( ImageBuffer target, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
DitherImage ( Image sourceImage, Image targetImage, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
DitherImage ( Image sourceImage, ImageBuffer target, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
DitherImage ( ImageBuffer source, Image targetImage, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
DitherImage ( ImageBuffer source, ImageBuffer target, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
GetBitOffset ( Int32 x ) : Int32
GetColorFromPixel ( Pixel pixel ) : Color
GetIndexFromPixel ( Pixel pixel ) : Int32
GetPaletteColor ( Int32 paletteIndex ) : Color
ImageBuffer ( Bitmap bitmap, ImageLockMode lockMode ) : System

Initializes a new instance of the ImageBuffer class.

ImageBuffer ( Image bitmap, ImageLockMode lockMode ) : System

Initializes a new instance of the ImageBuffer class.

Paste ( Byte buffer ) : void
ProcessPerPixel ( IList path, ProcessPixelFunction processPixelFunction, Int32 parallelTaskCount = 4 ) : void
ProcessPerPixelAdvanced ( IList path, ProcessPixelAdvancedFunction processPixelAdvancedFunction, Int32 parallelTaskCount = 4 ) : void
Quantize ( ImageBuffer target, IColorQuantizer quantizer, IColorDitherer ditherer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
Quantize ( ImageBuffer target, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
QuantizeImage ( Image sourceImage, IColorQuantizer quantizer, IColorDitherer ditherer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
QuantizeImage ( Image sourceImage, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
QuantizeImage ( ImageBuffer source, IColorQuantizer quantizer, IColorDitherer ditherer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
QuantizeImage ( ImageBuffer source, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
ReadColorUsingPixel ( Pixel pixel, Byte buffer = null ) : Color
ReadColorUsingPixelFrom ( Pixel pixel, Int32 x, Int32 y, Byte buffer = null ) : Color
ReadIndexUsingPixel ( Pixel pixel, Byte buffer = null ) : Int32
ReadIndexUsingPixelFrom ( Pixel pixel, Int32 x, Int32 y, Byte buffer = null ) : Int32
ReadPixel ( Pixel pixel, Byte buffer = null ) : void
ScanColors ( IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
ScanImageColors ( Image sourceImage, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
SetColorToPixel ( Pixel pixel, Color color, IColorQuantizer quantizer ) : void
SetIndexToPixel ( Pixel pixel, Int32 index, Byte buffer = null ) : void
SynthetizeImagePalette ( Image sourceImage, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : List
SynthetizePalette ( IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : List
TransformPerPixel ( ImageBuffer target, IList path, TransformPixelFunction transformPixelFunction, Int32 parallelTaskCount = 4 ) : void
TransformPerPixelAdvanced ( ImageBuffer target, IList path, TransformPixelAdvancedFunction transformPixelAdvancedFunction, Int32 parallelTaskCount = 4 ) : void
WriteColorUsingPixel ( Pixel pixel, Color color, IColorQuantizer quantizer, Byte buffer = null ) : void
WriteColorUsingPixelAt ( Pixel pixel, Int32 x, Int32 y, Color color, IColorQuantizer quantizer, Byte buffer = null ) : void
WriteIndexUsingPixel ( Pixel pixel, Int32 index, Byte buffer = null ) : void
WriteIndexUsingPixelAt ( Pixel pixel, Int32 x, Int32 y, Int32 index, Byte buffer = null ) : void

Private Methods

Method Description
Precalculate ( ) : void
ProcessInParallel ( ICollection path, Action process, Int32 parallelTaskCount = 4 ) : void
ProcessPerPixelBase ( IList path, Delegate processingAction, Int32 parallelTaskCount = 4 ) : void
TransformPerPixelBase ( ImageBuffer target, IList path, Delegate transformAction, Int32 parallelTaskCount = 4 ) : void
UpdatePalette ( System.Boolean forceUpdate = false ) : List
WritePixel ( Pixel pixel, Byte buffer = null ) : void

Method Details

CalculateImageMeanError() public static method

public static CalculateImageMeanError ( Image sourceImage, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
sourceImage Image
targetImage Image
parallelTaskCount System.Int32
return Double

CalculateImageMeanError() public static method

public static CalculateImageMeanError ( Image sourceImage, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
sourceImage Image
target ImageBuffer
parallelTaskCount System.Int32
return Double

CalculateImageMeanError() public static method

public static CalculateImageMeanError ( ImageBuffer source, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
source ImageBuffer
targetImage Image
parallelTaskCount System.Int32
return Double

CalculateImageMeanError() public static method

public static CalculateImageMeanError ( ImageBuffer source, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
source ImageBuffer
target ImageBuffer
parallelTaskCount System.Int32
return Double

CalculateImageNormalizedMeanError() public static method

public static CalculateImageNormalizedMeanError ( Image sourceImage, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
sourceImage Image
targetImage Image
parallelTaskCount System.Int32
return Double

CalculateImageNormalizedMeanError() public static method

public static CalculateImageNormalizedMeanError ( Image sourceImage, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
sourceImage Image
target ImageBuffer
parallelTaskCount System.Int32
return Double

CalculateImageNormalizedMeanError() public static method

public static CalculateImageNormalizedMeanError ( ImageBuffer source, Image targetImage, Int32 parallelTaskCount = 4 ) : Double
source ImageBuffer
targetImage Image
parallelTaskCount System.Int32
return Double

CalculateImageNormalizedMeanError() public static method

public static CalculateImageNormalizedMeanError ( ImageBuffer source, ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
source ImageBuffer
target ImageBuffer
parallelTaskCount System.Int32
return Double

CalculateMeanError() public method

public CalculateMeanError ( ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
target ImageBuffer
parallelTaskCount System.Int32
return Double

CalculateNormalizedMeanError() public method

public CalculateNormalizedMeanError ( ImageBuffer target, Int32 parallelTaskCount = 4 ) : Double
target ImageBuffer
parallelTaskCount System.Int32
return Double

ChangeFormat() public static method

public static ChangeFormat ( Image sourceImage, PixelFormat targetFormat, IColorQuantizer quantizer, Image &targetImage, Int32 parallelTaskCount = 4 ) : void
sourceImage Image
targetFormat PixelFormat
quantizer IColorQuantizer
targetImage Image
parallelTaskCount System.Int32
return void

ChangeFormat() public method

public ChangeFormat ( ImageBuffer target, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
target ImageBuffer
quantizer IColorQuantizer
parallelTaskCount System.Int32
return void

ChangeFormat() public static method

public static ChangeFormat ( ImageBuffer source, PixelFormat targetFormat, IColorQuantizer quantizer, Image &targetImage, Int32 parallelTaskCount = 4 ) : void
source ImageBuffer
targetFormat PixelFormat
quantizer IColorQuantizer
targetImage Image
parallelTaskCount System.Int32
return void

Clamp() public static method

public static Clamp ( Int32 value, Int32 minimum, Int32 maximum = 255 ) : Int32
value System.Int32
minimum System.Int32
maximum System.Int32
return System.Int32

Copy() public method

public Copy ( ) : Byte[]
return Byte[]

CorrectGamma() public method

public CorrectGamma ( System.Single gamma, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
gamma System.Single
quantizer IColorQuantizer
parallelTaskCount System.Int32
return void

CorrectImageGamma() public static method

public static CorrectImageGamma ( Image sourceImage, System.Single gamma, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
sourceImage Image
gamma System.Single
quantizer IColorQuantizer
parallelTaskCount System.Int32
return void

Dispose() public method

public Dispose ( ) : void
return void

Dither() public method

public Dither ( ImageBuffer target, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
target ImageBuffer
ditherer IColorDitherer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return void

DitherImage() public static method

public static DitherImage ( Image sourceImage, Image targetImage, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
sourceImage Image
targetImage Image
ditherer IColorDitherer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return void

DitherImage() public static method

public static DitherImage ( Image sourceImage, ImageBuffer target, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
sourceImage Image
target ImageBuffer
ditherer IColorDitherer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return void

DitherImage() public static method

public static DitherImage ( ImageBuffer source, Image targetImage, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
source ImageBuffer
targetImage Image
ditherer IColorDitherer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return void

DitherImage() public static method

public static DitherImage ( ImageBuffer source, ImageBuffer target, IColorDitherer ditherer, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
source ImageBuffer
target ImageBuffer
ditherer IColorDitherer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return void

GetBitOffset() public method

public GetBitOffset ( Int32 x ) : Int32
x System.Int32
return System.Int32

GetColorFromPixel() public method

public GetColorFromPixel ( Pixel pixel ) : Color
pixel Pixel
return Color

GetIndexFromPixel() public method

public GetIndexFromPixel ( Pixel pixel ) : Int32
pixel Pixel
return System.Int32

GetPaletteColor() public method

public GetPaletteColor ( Int32 paletteIndex ) : Color
paletteIndex System.Int32
return Color

ImageBuffer() public method

Initializes a new instance of the ImageBuffer class.
public ImageBuffer ( Bitmap bitmap, ImageLockMode lockMode ) : System
bitmap System.Drawing.Bitmap
lockMode ImageLockMode
return System

ImageBuffer() public method

Initializes a new instance of the ImageBuffer class.
public ImageBuffer ( Image bitmap, ImageLockMode lockMode ) : System
bitmap Image
lockMode ImageLockMode
return System

Paste() public method

public Paste ( Byte buffer ) : void
buffer Byte
return void

ProcessPerPixel() public method

public ProcessPerPixel ( IList path, ProcessPixelFunction processPixelFunction, Int32 parallelTaskCount = 4 ) : void
path IList
processPixelFunction ProcessPixelFunction
parallelTaskCount System.Int32
return void

ProcessPerPixelAdvanced() public method

public ProcessPerPixelAdvanced ( IList path, ProcessPixelAdvancedFunction processPixelAdvancedFunction, Int32 parallelTaskCount = 4 ) : void
path IList
processPixelAdvancedFunction ProcessPixelAdvancedFunction
parallelTaskCount System.Int32
return void

Quantize() public method

public Quantize ( ImageBuffer target, IColorQuantizer quantizer, IColorDitherer ditherer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
target ImageBuffer
quantizer IColorQuantizer
ditherer IColorDitherer
colorCount System.Int32
parallelTaskCount System.Int32
return void

Quantize() public method

public Quantize ( ImageBuffer target, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : void
target ImageBuffer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return void

QuantizeImage() public static method

public static QuantizeImage ( Image sourceImage, IColorQuantizer quantizer, IColorDitherer ditherer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
sourceImage Image
quantizer IColorQuantizer
ditherer IColorDitherer
colorCount System.Int32
parallelTaskCount System.Int32
return Image

QuantizeImage() public static method

public static QuantizeImage ( Image sourceImage, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
sourceImage Image
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return Image

QuantizeImage() public static method

public static QuantizeImage ( ImageBuffer source, IColorQuantizer quantizer, IColorDitherer ditherer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
source ImageBuffer
quantizer IColorQuantizer
ditherer IColorDitherer
colorCount System.Int32
parallelTaskCount System.Int32
return Image

QuantizeImage() public static method

public static QuantizeImage ( ImageBuffer source, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : Image
source ImageBuffer
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return Image

ReadColorUsingPixel() public method

public ReadColorUsingPixel ( Pixel pixel, Byte buffer = null ) : Color
pixel Pixel
buffer Byte
return Color

ReadColorUsingPixelFrom() public method

public ReadColorUsingPixelFrom ( Pixel pixel, Int32 x, Int32 y, Byte buffer = null ) : Color
pixel Pixel
x System.Int32
y System.Int32
buffer Byte
return Color

ReadIndexUsingPixel() public method

public ReadIndexUsingPixel ( Pixel pixel, Byte buffer = null ) : Int32
pixel Pixel
buffer Byte
return System.Int32

ReadIndexUsingPixelFrom() public method

public ReadIndexUsingPixelFrom ( Pixel pixel, Int32 x, Int32 y, Byte buffer = null ) : Int32
pixel Pixel
x System.Int32
y System.Int32
buffer Byte
return System.Int32

ReadPixel() public method

public ReadPixel ( Pixel pixel, Byte buffer = null ) : void
pixel Pixel
buffer Byte
return void

ScanColors() public method

public ScanColors ( IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
quantizer IColorQuantizer
parallelTaskCount System.Int32
return void

ScanImageColors() public static method

public static ScanImageColors ( Image sourceImage, IColorQuantizer quantizer, Int32 parallelTaskCount = 4 ) : void
sourceImage Image
quantizer IColorQuantizer
parallelTaskCount System.Int32
return void

SetColorToPixel() public method

public SetColorToPixel ( Pixel pixel, Color color, IColorQuantizer quantizer ) : void
pixel Pixel
color Color
quantizer IColorQuantizer
return void

SetIndexToPixel() public method

public SetIndexToPixel ( Pixel pixel, Int32 index, Byte buffer = null ) : void
pixel Pixel
index System.Int32
buffer Byte
return void

SynthetizeImagePalette() public static method

public static SynthetizeImagePalette ( Image sourceImage, IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : List
sourceImage Image
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return List

SynthetizePalette() public method

public SynthetizePalette ( IColorQuantizer quantizer, Int32 colorCount, Int32 parallelTaskCount = 4 ) : List
quantizer IColorQuantizer
colorCount System.Int32
parallelTaskCount System.Int32
return List

TransformPerPixel() public method

public TransformPerPixel ( ImageBuffer target, IList path, TransformPixelFunction transformPixelFunction, Int32 parallelTaskCount = 4 ) : void
target ImageBuffer
path IList
transformPixelFunction TransformPixelFunction
parallelTaskCount System.Int32
return void

TransformPerPixelAdvanced() public method

public TransformPerPixelAdvanced ( ImageBuffer target, IList path, TransformPixelAdvancedFunction transformPixelAdvancedFunction, Int32 parallelTaskCount = 4 ) : void
target ImageBuffer
path IList
transformPixelAdvancedFunction TransformPixelAdvancedFunction
parallelTaskCount System.Int32
return void

WriteColorUsingPixel() public method

public WriteColorUsingPixel ( Pixel pixel, Color color, IColorQuantizer quantizer, Byte buffer = null ) : void
pixel Pixel
color Color
quantizer IColorQuantizer
buffer Byte
return void

WriteColorUsingPixelAt() public method

public WriteColorUsingPixelAt ( Pixel pixel, Int32 x, Int32 y, Color color, IColorQuantizer quantizer, Byte buffer = null ) : void
pixel Pixel
x System.Int32
y System.Int32
color Color
quantizer IColorQuantizer
buffer Byte
return void

WriteIndexUsingPixel() public method

public WriteIndexUsingPixel ( Pixel pixel, Int32 index, Byte buffer = null ) : void
pixel Pixel
index System.Int32
buffer Byte
return void

WriteIndexUsingPixelAt() public method

public WriteIndexUsingPixelAt ( Pixel pixel, Int32 x, Int32 y, Int32 index, Byte buffer = null ) : void
pixel Pixel
x System.Int32
y System.Int32
index System.Int32
buffer Byte
return void