0

只是我想在 UIImageView 中显示 12 位或 16 位图像但图像无法正确显示,所以请建议我一些解决方案,我几天以来一直在努力显示这些图像

有关更多信息,请查看包含代码和图像的此链接。代码在这里复制:

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 中的帮助

4

0 回答 0