wpf - BitmapSource.CopyPixels -what's a good value for stride? -
i'm trying pixel data wpf bitmapsource
object. understand, can accomplished calling copypixels
method. method needs stride parameter, don't know how obtain. far know, stride value that's used when stepping in array during reading or copying. appropriate stride value bitmapsource?
you can use stride = pixel_size * image_width value. example, rgba bitmap 100 pixel width, stride = 400.
some applications may require special line alignment. example, windows gdi bitmaps require 32-bits line alignment. in case, rgb bitmap width = 33, stride value 33*3=99 should changed 100, have 32-bits line alignment in destination array.
generally, should know destination array requirements. in there no special requirements, use default pixel_size * image_width.
Comments
Post a Comment