gpt4 book ai didi

c# - getPixel setPixel 太慢了,.NET CF 上还有其他选择吗

转载 作者:太空宇宙 更新时间:2023-11-03 20:40:15 25 4
gpt4 key购买 nike

我正在使用位图类的 .setPixel 和 .getPixel 在 .NET CF 上绘制我的位图字体。但它太慢了,在 java 中我们有 getRGB() 和 setRGB() 来通过一次调用设置颜色数组。 .NET CF 中是否有类似的东西。我的要求只是将位图的一部分绘制到指定 x,y 处的另一个位图中。

编辑:源图像具有透明度(不是 alpha,只是简单的透明度)。

最佳答案

不要自己循环。您应该能够使用 ImageAttributes 属性运行 DrawImage 方法,设置正确的颜色键(白色、紫色,无论您在图像中使用什么)。

imageAttributes = new ImageAttributes();
imageAttributes.SetColorKey(Color.Magenta, Color.Magenta);

graphics.DrawImage(image,
destinationRectangle,
sourceRectangle.X,
sourceRectangle.Y,
sourceRectangle.Width,
sourceRectangle.Height,
GraphicsUnit.Pixel,
imageAttributes);

关于c# - getPixel setPixel 太慢了,.NET CF 上还有其他选择吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3139200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com