Open majidmetal opened 7 years ago
Done … and … done. It’s just that simple. There’s no reason to make it any more complicated than that.
Blending
This article outlines a process for blending two bitmaps of 32-bit format. Alpha values are not used (premultiplied or otherwise); the blend is the final result of merging two images. The source opacity is passed as an integer percent value times one hundred, which is converted within the blend function to a single-precision float; the destination opacity is presumed to be one minus that value. For example, declaring a 20% opacity for the source bitmap would place the destination opacity at 80%. I have not found a way to do this with GDI (everything seems to be additive), and I won’t go beyond that to get the job done. DirectX requires a relatively enormous setup time that I find difficult to justify in most apps that I create. Moving beyond that to something like DirectComposition or Direct2D is for me unthinkable – I liken it to bringing a full-sized aircraft carrier to the grocery store just to haul your groceries home, when a little red wagon would do just as well. That doesn’t mean those API’s are that powerful – they’re just that needlessly complex (and embarrassingly bloated).
For the process outlined here, the focus is on speed, and to maximize speed, two main rules must be followed:
Avoid memory access. Use XMM registers to process all color component values in parallel – this results in one multiplication per pixel, not three. YMM registers don’t make sense in this kind of application because they use 64-bit values. For the process of blending images, 32-bit values are ultimately moved down to 8 bits for each color channel, and four 32-bit values processed by XMM registers is the low limit of SSE/AVX granularity.
جعبه ابزار جعبه ابزار پلاستیکی اتو لوله سبز دریل چکشی دریل شارژی کمپرسور باد فندکی تراز لیزری دریل چکشی رونیکس اره فارسی بر فارسی بر آاگ دریل چکشی رونیکس بتن کن ابزارهای دستی دریل شارژی رونیکس