Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将颜色数组转换为WPF C的可读图像#_Wpf_Image - Fatal编程技术网

将颜色数组转换为WPF C的可读图像#

将颜色数组转换为WPF C的可读图像#,wpf,image,Wpf,Image,我有以下问题:我想写一个基本的程序,渲染代码创建的图像。但我在显示图像时遇到问题。 我将图像保存在一个三维数组中,如下所示:Image[x-Pos,y-Pos,RGB值]。现在我的问题是,如何将其转换为可以在GUI上的WPF图像对象中显示的对象? 您的Tifferan将数据转换为字节数组,该数组包含从左上角到右下角连续的所有像素。然后根据以下数据创建位图源: int width = ... int height = ... var format = PixelFormats.Rgb24; var

我有以下问题:我想写一个基本的程序,渲染代码创建的图像。但我在显示图像时遇到问题。 我将图像保存在一个三维数组中,如下所示:Image[x-Pos,y-Pos,RGB值]。现在我的问题是,如何将其转换为可以在GUI上的WPF图像对象中显示的对象?
您的Tifferan将数据转换为字节数组,该数组包含从左上角到右下角连续的所有像素。然后根据以下数据创建位图源:

int width = ...
int height = ...
var format = PixelFormats.Rgb24;
var stride = (width * format.BitsPerPixel + 7) / 8;
var pixels = new byte[stride * height];

// copy data to pixels array
...

var bitmap = BitmapSource.Create(
    width, height, 96, 96, format, null, pixels, stride);


也就是说,将图像数据存储在三维数组中似乎没有意义。我可以理解二维数组,其中维度是像素的x和y坐标,数组值是像素(例如RGB)值。

将数据转换为字节数组,该数组包含从左上角到右下角连续的所有像素。然后根据以下数据创建位图源:

int width = ...
int height = ...
var format = PixelFormats.Rgb24;
var stride = (width * format.BitsPerPixel + 7) / 8;
var pixels = new byte[stride * height];

// copy data to pixels array
...

var bitmap = BitmapSource.Create(
    width, height, 96, 96, format, null, pixels, stride);


也就是说,将图像数据存储在三维数组中似乎没有意义。我可以理解二维数组,其中维度是像素的x和y坐标,数组值是像素(例如RGB)值。

将数据转换为字节数组,该数组包含从左上角到右下角连续的所有像素。然后根据以下数据创建位图源:

int width = ...
int height = ...
var format = PixelFormats.Rgb24;
var stride = (width * format.BitsPerPixel + 7) / 8;
var pixels = new byte[stride * height];

// copy data to pixels array
...

var bitmap = BitmapSource.Create(
    width, height, 96, 96, format, null, pixels, stride);


也就是说,将图像数据存储在三维数组中似乎没有意义。我可以理解二维数组,其中维度是像素的x和y坐标,数组值是像素(例如RGB)值。

将数据转换为字节数组,该数组包含从左上角到右下角连续的所有像素。然后根据以下数据创建位图源:

int width = ...
int height = ...
var format = PixelFormats.Rgb24;
var stride = (width * format.BitsPerPixel + 7) / 8;
var pixels = new byte[stride * height];

// copy data to pixels array
...

var bitmap = BitmapSource.Create(
    width, height, 96, 96, format, null, pixels, stride);


也就是说,将图像数据存储在三维数组中似乎没有意义。我可以理解二维数组,其中的维度是像素的x和y坐标,数组值是像素(例如RGB)值。

您可以玩
WriteableBitmap
或直接在
DrawingGroup
DrawingVisual
Thx上绘制图像内容,我将研究您可以玩
WriteableBitmap
或直接在
DrawingGroup
上绘制图像内容,或
DrawingVisual
Thx我将研究一下你可以玩
WriteableBitmap
或者直接在
DrawingGroup
或者
DrawingVisual
Thx上直接绘制图像内容,我将研究一下你可以玩
WriteableBitmap
或者直接绘制图像内容直接在
DrawingGroup
DrawingVisual
Thx上,我将对此进行研究