问题标签 [interopbitmapimage]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
10335 浏览

c# - InteropBitmap 到 BitmapImage

我正在尝试将 a 转换Bitmap (SystemIcons.Question)为 a,BitmapImage以便可以在 WPF Image 控件中使用它。

我有以下方法将其转换为 a BitmapSource,但它返回一个InteropBitmapImage,现在的问题是如何将其转换为 a BitmapImage。直接演员似乎不起作用。

有人知道怎么做吗?

代码:

返回 BitmapImage 的属性:(绑定到我的图像控件)

0 投票
0 回答
1276 浏览

c# - InteropBitmap 代码示例

有人在 InteropBitmap 上工作过吗?我没有找到任何代码示例。如果您有任何教程或任何代码示例的链接,请在此处发布。

0 投票
1 回答
1804 浏览

wpf - WPF:图像源是 System.Windows.Interop.InteropBitmap

如果 Source 是 System.Windows.Interop.InteropBitmap 类型,如何设置 System.Windows.Controls.Image 的 Source?InteropBitmap 信息如下:

谢谢

0 投票
2 回答
1338 浏览

c# - Image/ImageSource/Interop 图像到字节数组

我正在开发一个控件,用户可以在其中设置图像,我希望它尽可能地对用户友好-因此支持复制和粘贴、拖放。

我已经让这部分工作使用 IDataObjects,测试 FileDrop、FileContents(例如来自 Outlook)和位图的文件格式,例如:

ImageFromClipboard 代码是 Thomas Levesque 的,在这个 SO 问题wpf InteropBitmap to bitmap的答案中引用

http://www.thomaslevesque.com/2009/02/05/wpf-paste-an-image-from-the-clipboard/

无论我如何将图像放到 ImgPerson 上,这部分工作正常;图像显示很好。

当用户按下保存时,我需要将图像转换为字节数组并发送到 WCF 服务器,该服务器将保存到服务器 - 例如,将字节数组重建为图像并将其保存在文件夹中。

对于所有格式的拖放,复制和粘贴图像是某种形式的 System.Windows.Media.Imaging.BitmapImage。

除了那些涉及剪贴板的使用 Thomas 的代码变成 System.Windows.Media.Imaging.BitmapFrameDecode。

如果我避免使用 Thomas 的代码并使用:

我得到一个 System.Windows.Interop.InteropBitmap。

我不知道如何使用这些;将它们放入字节数组中,以便我可以传递给 WCF 进行重建并保存到文件夹。

0 投票
0 回答
681 浏览

c# - CreateBitmapSourceFromMemorySection 拒绝访问

我正在尝试通过我在磁盘上的一个简单图像文件来构建一个 InteropBitmap,但是它不起作用。我得到 UnauthorizedAccessException。

我的文件是 24bpp 的简单 JPEG 1024*768。

编码:

我该如何解决?

0 投票
1 回答
288 浏览

c# - InteropBitmap collection to single Image

I'm using a list of InteropBitmap in order to display a set of image frames within Image control which is customized with a datatemplate.

What I'm lookin for is to export set of images in a single image, however what I get is a bad/partial image with wrong colors.

The following is the code snippet I'm using to convert set of InteropBitmap in a single image:

Finally, I use buffer array to achieve my jpeg image through GDI+ or else wpf instruments. Unfortunately, both the way doesn't work as I expected.

Is there something to wrong in my code?

@@EDIT Well, thanks to Clemens answers, now I'm able to obtain a correct image, except only for its color (all colors are altered). The issue is true only when I try to create an Image through GDI+, instead, if I use something of WPF susch as JpegBitmapEncoder all works fine.

The following code snippet allow me to achieve the right image:

Instead, the following code return me an image with wrong colors (the red become blue and so on)

I haven't idea why it doesn't work when I use System.Drawing classes.

0 投票
3 回答
6745 浏览

c# - WPF 图像:.Source = Clipboard.GetImage() 不显示

这个简单的程序不起作用,图像不会出现在窗口中。

输出为“剪贴板复制到 UIElement”,但图像未出现在窗口中。

XAML:

有没有人,谁明白,什么是错的?