Showing posts with label Bitmap. Show all posts
Showing posts with label Bitmap. Show all posts

Friday, April 12, 2013

Accelerate Chemical# Bitmap Photo Control

Anybody can lower the which it normally takes to process a bitmap photo in Chemical# by by hand accessing the picture's uncooked data as opposed to using the standard GetPixel and SetPixel characteristics.

Chemical-Distinct includes quite a few constructed-in photo handling characteristics. constructed over GDI, GDI-And also is a potent instrument. Nonetheless GDI+ has its limitations. For instance, quite a lot of you have realized right now that bitmap photo encoding in Csharp is very slow-moving.

Image Processing

The explanation it's extremely slow-moving is because the GetPixel and SetPixel characteristics. Whenever one of those characteristics is referred to as, the bitmap photo is based, the bytes are usedFor eachmodified, as well as the bitmap is revealed. The repeated lock jewelry armoire-unleashing program cause emailing a graphic in Chemical#.Net so slow-moving.

Accelerate Chemical# Bitmap Photo Control

The reply is to by hand lock the bitmap, gain access to andFor eachor customize the parts, lastly launch the style. Because of this every single write and focus business won't have to lock and un-lock the full snapshot. You could be amazed what amount this will increase the swiftness your picture handling characteristics.

This is the Chemical# supply program code to lock a bitmap:

Rectangular shape range = new Rectangular shape(Position.Vacant, bitmap.Dimensions)

Int thickness = (int)(range.thickness * sizeof(PixelData))

BitmapData bitmapData = bitmap.LockBits(range, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb)

Byte* pBase = (Byte*)bitmapData.Scan0.ToPointer()

In which PixelData is a composition using a adjustable for every one of the argb ideals of an coloring.

To gain access to a pixel utilize program code underneath:


PixelData* pixelData = (PixelData*)(pBase + ful * thickness + x * sizeof(PixelData))


Do not forget if you find yourself performed to un-lock the picture:


bitmap.UnlockBits(bitmapData)

Accelerate Chemical# Bitmap Photo Control

 
Copyright 2009 About of Image Processing