c# - Easy way to get and set pixels on writeablebitmap -
i need , set pixel in universal app (windows phone rt, windows 8.1). , cannot find way. when in wpf
first calculate stride
like:
int stride = wb.pixelwidth * (wb.format.bitsperpixel / 8);
after converting byte array
byte[] data = new byte[stride * wb.pixelheight]; wb.copypixels(data, stride, 0);
and after easy:
for (int y = 0; y < wb.pixelheight; ++y) { (int x = 0; x < wb.pixelwidth; ++x) { var index = (y * stride) + (x * 4); data[index + 3]=255; data[index + 2]=255 data[index + 1]=255 data[index]=255 } }
but when use universal app cannot find way similar. cannot use savejpeg
because work in silverlight, dont have writeablebitmap.format
etc.
please help, suggestion welcome. thanx
Comments
Post a Comment