我只想在UIImageView中显示12位或16位图像但是图像显示不正确所以请建议我一些解决方案我几天都在努力展示这些图像
有关详细信息,请查看包含代码和图片的Link。代码转载于此:
const int bytesPerPixel = 4;
int _width = (int)_drawArg.RectUIImageMatrix.Width;
int _height = (int)_drawArg.RectUIImageMatrix.Height;
CGImage _bitmap ;
Rectangle srcRectangle = new Rectangle(0, 0, imageGraphic.Columns, imageGraphic.Rows);
Rectangle rect = Rectangle.Round(new RectangleF(0,0,_width , _height));
Rectangle dstRectangle = rect;
int[] srcPixels = new int[image.Columns * image.Rows * image.PixelData.BytesPerPixel];
int bitsPerComponent = 8;
int bytesPerRow = srcRectangle.Width * bytesPerPixel *2;
var pixelBytes = imageGraphic.PixelData.Raw;
CGColorSpace _color = CGColorSpace.CreateDeviceRGB();
CGDataProvider _provide = new CGDataProvider(pixelBytes , 0,pixelBytes.Length);
_bitmap = new CGImage(srcRectangle.Width,srcRectangle.Height ,bitsPerComponent,32,bytesPerRow , _color , CGBitmapFlags.ByteOrder16Big | CGBitmapFlags.PremultipliedLast ,_provide ,null ,true ,CGColorRenderingIntent.Default);
ImgView.Image = UIImage.FromImage(_bitmap);
有
向advc寻求帮助