alphablending

Blending transparent textures with depth

℡╲_俬逩灬. 提交于 2019-11-30 15:21:40
I am trying to blend textures which have transparent areas: glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, ...); glVertexPointer( 2, GL_FLOAT, 0, ... ); glEnable (GL_BLEND); glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 ); Unless I add glDisable(GL_DEPTH_TEST), transparent parts of the top textures overwrite everything beneath them (instead of blending). Is there any way to do this without disabling depth? I have tried various blending functions but none of the helped. Enabling depth test doesn’t actually sort your geometry by depth—in the usual

Direct3D rendering 2D images with “multiply” blending mode and alpha

被刻印的时光 ゝ 提交于 2019-11-30 15:19:39
I'm trying to replicate the Photoshop filter multiply with Direct3D. I've been reading and googling about the different render states and I've got the effect almost working. The problem is that it's ignoring the alpha value of the textures. Here's an image that explains the sitution: http://www.kloonigames.com/petri/stackoverflow_doesnt_allow_.jpg I found one solution to this, which was to save the images with no transparency and white background. But I'm not satisfied with this solution. The problem is that I really need to use the alpha value. I want to fade out the images gradually. And I

OpenCV (Emgu.CV) — compositing images with alpha

孤街醉人 提交于 2019-11-30 09:26:53
I'm using Emgu.CV to perform some basic image manipulation and composition. My images are loaded as Image<Bgra,Byte> . Question #1: When I use the Image<,>.Add() method, the images are always blended together, regardless of the alpha value. Instead I'd like them to be composited one atop the other, and use the included alpha channel to determine how the images should be blended. So if I call image1.Add(image2) any fully opaque pixels in image2 would completely cover the pixels from image1, while semi-transparent pixels would be blended based on the alpha value. Here's what I'm trying to do in

How to draw 32-bit alpha channel bitmaps?

拈花ヽ惹草 提交于 2019-11-30 04:12:57
I need to create a custom control to display bmp images with alpha channel. The background can be painted in different colors and the images have shadows so I need to truly "paint" the alpha channel. Does anybody know how to do it? I also want if possible to create a mask using the alpha channel information to know whether the mouse has been click on the image or on the transparent area. Any kind of help will be appreciated! Thanks. Edited(JDePedro): As some of you have suggested I've been trying to use alpha blend to paint the bitmap with alpha channel. This just a test I've implemented where

Want transparent image even after blending

左心房为你撑大大i 提交于 2019-11-29 18:17:02
I am trying to blend two images as shown here . This is my whole code #include <cv.h> #include <highgui.h> #include <iostream> using namespace cv; int main( int argc, char** argv ) { double beta; double input; Mat src1, src2, dst; /// Ask the user enter alpha std::cout<<" Simple Linear Blender "<<std::endl; std::cout<<"-----------------------"<<std::endl; src1 = imread("face.jpg"); src2 = imread("necklace1.png"); if( !src1.data ) { printf("Error loading src1 \n"); return -1; } if( !src2.data ) { printf("Error loading src2 \n"); return -1; } double alpha = 0.1; // something int min_x = ( (src1

How does alpha blending work, mathematically, pixel-by-pixel?

回眸只為那壹抹淺笑 提交于 2019-11-29 16:54:59
Seems like it's not as simple as RGB1*A1 + RGB2*A2...how are values clipped? Weighted? Etc. And is this a context-dependent question? Are there different algorithms, that produce different results? Or one standard implementation? I'm particularly interested in OpenGL-specific answers, but context from other environments is useful too. I don't know about OpenGL, but one pixel of opacity A is usually drawn on another pixel like so: result.r = background.r * (1 - A) + foreground.r * A result.g = background.g * (1 - A) + foreground.g * A result.b = background.b * (1 - A) + foreground.b * A Repeat

Is it possible to create a CImageList with alpha blending transparency?

泪湿孤枕 提交于 2019-11-29 07:37:38
I would like to knwo if it is possible to create a CImageList with alpha blending transparency. Sample code that creates a CImageList with ugly transparency (no alpha blending) CGdiPlusBitmapResource m_pBitmap; m_pBitmap.Load(IDB_RIBBON_FILESMALL,_T("PNG"),AfxGetResourceHandle()); HBITMAP hBitmap; m_pBitmap.m_pBitmap->GetHBITMAP(RGB(0,0,0),&hBitmap ); CImageList *pList=new CImageList; CBitmap bm; bm.Attach(hBitmap); pList->Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 4); pList->Add(&bm, RGB(255,0,255)); MSN Don't use the ILC_MASK flag (from MSDN ): Using 32 Bit Anti-Aliased Icons Windows XP

Windows Forms: Making a cursor bitmap partially transparent

落花浮王杯 提交于 2019-11-29 04:18:43
I want to use partially transparent images in drag/drop operations. This is all set up and works fine, but the actual transformation to transparency has a weird side effect. For some reason, the pixels seem to be blended against a black background. The following image describes the problem: Figure a) is the original bitmap. Figure b) is what is produced after alpha blending has been performed. Obviously this is a lot darker than the intended 50% alpha filter intended. Figure c) is the desired effect, image a) with 50% transparency (added to the composition with a drawing program). The code I

How to draw 32-bit alpha channel bitmaps?

谁说胖子不能爱 提交于 2019-11-29 01:37:05
问题 I need to create a custom control to display bmp images with alpha channel. The background can be painted in different colors and the images have shadows so I need to truly "paint" the alpha channel. Does anybody know how to do it? I also want if possible to create a mask using the alpha channel information to know whether the mouse has been click on the image or on the transparent area. Any kind of help will be appreciated! Thanks. Edited(JDePedro): As some of you have suggested I've been

How to obtain the right alpha value to perfectly blend two images?

微笑、不失礼 提交于 2019-11-28 23:41:50
I've been trying to blend two images. The current approach I'm taking is, I obtain the coordinates of the overlapping region of the two images, and only for the overlapping regions, I blend with a hardcoded alpha of 0.5, before adding it. SO basically I'm just taking half the value of each pixel from overlapping regions of both the images, and adding them. That doesn't give me a perfect blend because the alpha value is hardcoded to 0.5. Here's the result of blending of 3 images: As you can see, the transition from one image to another is still visible. How do I obtain the perfect alpha value