c# - How can you draw 32bppargb images with the Win32 AlphaBlend function? -
i've been fussing better part of night, maybe 1 of can give me hand.
i have found gdi+ drawimage
in c# far slow i'm trying render, , looks of forums, it's same other people well.
i decided try using alphablend
or bitblt
win32 api better performance. anyway, i've gotten images display fine except 1 small detail—no matter image format use, can't white background disappear (transparent) graphics.
i've tried bmp , png formats far, , verified loaded 32bppargb images in c#.
here's call i'm making:
// draw tile screen. win32graphicsinterop.alphablend(graphicscanvas, destination.x, destination.y, this.tilesize, this.tilesize, this.imagegraphicspointer, tile.upperleftcorner.x, tile.upperleftcorner.y, this.tilesize, this.tilesize, new win32graphicsinterop.blendfunction(win32graphicsinterop.ac_src_over, 0, convert.tobyte(opacity * 255), win32graphicsinterop.ac_src_alpha));
for record, ac_src_over
0x00
, ac_src_alpha
0x01
consistent msdn says ought be.
do of guys have solution problem or know better (but still fast) way can this?
graphics.drawimage() speed critically dependent on pixel format. format32bpppargb 10 times faster other 1 on recent machine i've tried.
also make sure image doesn't resized, sure use drawimage() overload sets destination size equal bitmap size. important if video adapter's dpi setting doesn't match resolution of bitmap.
Comments
Post a Comment