This bypasses the AlphaBlend function, and so works fine on 64 bit systems. Then call SetDIBits to write the modified bits back to the background bitmap. Scribd is the world's largest social reading and publishing site.
AlphaBlend only supports pre-multiplied alpha, that is, the other colour channels must be pre-multiplied by the alpha channel and then divided by the maximum colour value. PureBasic Documentation.pdf - Free ebook download as PDF File (.pdf), Text File (.txt) or read book online for free.
If the material is writing to the depth buffer (in other words, if the blend mode is set to either Opaque, Alpha Clip or Alpha Hashed ), contact shadows will be casted by the surface material regardless of the Transparent Shadow type. Now, the most likely problems is that the bitmap you loaded isnt in the right pixel format. Blitzmax is more complete (including an openCL module), but purebasic generate very nice, ready to patch, ready to recompile TASM file. Green_bkg = A * green_circle + B * green_bkgīlue_bkg = A * blue_circle + B * blue_bkg This option does not change the behavior of contact shadows which are traced using the depth buffer. What I have done to fix this is to use GetDIBits to load the bitmaps into RAM arrays and then I can do the alpha math myself: This is the default drawing mode when the drawing starts. It can be a combination of the following flags: PB2DDrawingDefault. Then call AlphaBlend with bfn.SourceConstantAlpha = 255 andĪs you say, the problem is this doesn't work on 64 bit systems. The behavior for further drawing operations. The "else" case uses a global value (200) combined with individual alpha values for each pixel (in the 4th byte of the pixel dw), and this is handy for a lot of things.įor example, if you want to place a circular image over an existing "background" bitmap, you can draw the circle on a new square bitmap and assign alpha = 0 for all the pixels outside the circle.
Your "if(fIsX64)" case uses a single alpha value (75) for the whole bitmap, and that does seem to work on 64 bit systems. You just set the colors of the regions with alpha values and they are drawn over the background perfectly. On a side note, for a separate project that I am working on, I am using QT with QPixmap (for background image), QPainter (to draw overlays on QPixmap) and QLabel (to display QPixmap) classes to draw semi-transparent regions on top of a background image and this draws empty overlaid regions on 64bit machines but looks great on 32bit PCs but it's better than current alternatives on 64bit machines this isn't great, and causes problems on 32bit PCs (if you use it on them also), Now alpha blend objects back to main DCīLENDFUNCTION bfn = // Struct with info for AlphaBlend It doesn't look as good on 64-bit PCs as on 32-bit PCs, but its not too far off: HasDigitalSignature (Detected Digital Signature) PureBasic (Detected a Basic Sample) AdvapiHashAPI (Looks for advapi.
This is the code I'm currently using, based on Lingzhi Sun's suggestions.