[英]how to add transparent pixels above and below a 32 bit bitmap images
I need to add at runtime to an inmemory image 15 lines of transparent pixels on top and 20 on the bottom. 我需要在运行时向内存图像中添加15行透明像素(顶部)和20行底部(底部)。
The images are loaded in a TcxImagelist (from DevExpress Express Library), they can be therefore retrieved as 32bit bitmaps. 图像被加载到TcxImagelist(来自DevExpress Express库)中,因此可以将它们检索为32位位图。
If the image is 400x75 after the manipulation should be 400x(75+15+20) = 400x110 如果图像在处理后为400x75,则应为400x(75 + 15 + 20)= 400x110
How to perform this task? 如何执行此任务?
There is no such a thing as "transparent" pixels. 没有“透明”像素之类的东西。 All you can do is tag them for the renderer so that it will know they aren't supposed to be displayed.
您所能做的就是为渲染器标记它们,以便它知道不应显示它们。 here are the 3 most common ways of tagging but which one you use depends on when you're doing for rendering:
这是最常见的3种标记方式,但您使用哪种标记取决于您进行渲染的时间:
Now, in your case, since you seem to be only copying a rectangle over a rectangle, another aproach that would be: create a canvas of the same size as the final image, copy the inferior rectangle on it and the draw the to layer on top of it. 现在,在您的情况下,由于您似乎只是在矩形上复制一个矩形,因此另一个方法是:创建一个与最终图像大小相同的画布,在其上复制下一个矩形,并在其上绘制to层顶部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.