how can i speed up this transparent image rendering in winforms?
hello! i'll be frank; i found this code on Stack Overflow and it goes far over my head, i just need a way to layer transparent images. this is the code:
i seriously don't understand what its doing, nor why it's so slow, nor why this works but the regular PictureBox doesn't with layered transparent images. there are only a few of them on the form..
17 Replies
winforms doesnt support transparency, and this seems like a very hacky workaround with manually re-rendering every single overlapping control as an image.
I'd strongly recommend just using a more modern UI framework that supports transparency
like what? i really like the intuitive way winforms works
Avalonia comes to mind
or WPF
I'm honestly not very well versed with GUI, its not my cup of tea, but winforms is old and has problems, including specifically transparency
i did start a wpf port but i got stuck porting a specific control. any chance u could help?
Nope, sorry. As said, I'm not a GUI person. Maybe try asking in #gui
alright, thanks
Which control?
nullptr
hello, i've been working on porting an existing project to wpf but i don't really know how i'd implement this control that i wrote (too much text, i'll send it in a seperate message). all it does is take an image (see the first attachment for an example) and applies it as a border, given an InsetPixels value which determines which pixels not to stretch (see the second attachment, look at the form border; that's the image)
Quoted by
<@1053012491006910504> from #gui (click here)
React with ❌ to remove this embed.
Stack Overflow
How to Use an image as ImageBrush on a Line or Path in WPF
I have a Canvas on which I draw lines (via Lines or Paths) that indicates a road to follow for users. Is there a way to change the line so that it displays a repetitive image instead? What I'm look...
I think this could come in handy
https://www.codeproject.com/Questions/466083/How-give-an-image-as-a-border
the issue is, i don't just want a border pattern, the images usually have drop shadows and stuff, and effects inside the border that need to be stretched whilst preserving the outside
the old code does this perfectly
@nullptr are you trying to do something similar to this?https://web.archive.org/web/20190913214618/https://pjblewis.com/site/posts/2016-04-27-p2-efficient-alpha-blended-windows-directcomposition.html
nope. i'm trying to draw transparent images on top of each other
alpha blending?
yes, i guess
How to: Use Compositing Mode to Control Alpha Blending - Windows Fo...
Learn how to use compositing mode to control alpha blending using a System.Drawing.Bitmap object and a System.Drawing.Graphics object.
skiasharp also comes into mind
which supports porter duff modes