alphablending

MFC CImage alpha blending gone wrong

岁酱吖の 提交于 2019-12-02 04:47:01
I have to present images on a picture control that are a composition of two PNG files, where the top image has transparent pixels on certain positions. The result should of plotter.png with bar.png overlapped on its top appears as (Notice the strange white contours on the bar): but it should be: The code I made for it is simple as CImage image; if (FAILED(image.Load(L"plotter.png"))) return false; CImage imageBar; if (FAILED(imageBar.Load(L"bar.png"))) return false; imageBar.AlphaBlend(image.GetDC(), CPoint()); image.ReleaseDC(); ((CStatic*)GetDlgItem(IDC_PICTURE))->SetBitmap(image); I have

Transparency groups in CanvasRenderingContext2D

本秂侑毒 提交于 2019-12-02 00:19:49
Is there a way to combine multiple draw operations to a 2d canvas rendering context in such a way that they their combined result is composed onto the previous content of the canvas, as opposed to each drawing operation being composed by itself? One application: I'd like to draw a translucent line with an arrow head, and I'd like to avoid increased opacity in those areas where the line and the arrow head overlap. Many other rendering models support such features. SVG has a group opacity setting, described in section 14.5. The PDF reference describes “Transparency Groups” in section 7.3. In

Semi-transparent highlights using PySide and QTextEdit

烂漫一生 提交于 2019-12-01 23:36:06
I've created a QTextEdit object. The code below adds randomly colored highlights to the currently selected text. I need the highlights to be semi-transparent so I can see highlights layered upon each other. Using "setAlpha" does not appear to do anything. How can I set the alpha for the highlight or otherwise obtain semi-transparency? # Define cursor & span self.cursor = self.textdoc.textCursor() self.selstart = self.cursor.selectionStart() self.selend = self.cursor.selectionEnd() self.seltext = self.cursor.selectedText() # Create random color r = randint(0,255) g = randint(0, 255) b = randint

How to get polygon antialiasing to work?

萝らか妹 提交于 2019-12-01 09:28:13
I'm using these function calls: glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE) It doesn't work and won't render. glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) It doesn't anti-alias. Try glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) This is a mundane answer.. but if you want rounded corners, you'll probably want to use more more vertices at the corners and place them for a more rounded shape. You could also look into doing this procedurally.. but if you're doing a game and you want to get it finish, I'd

How to get polygon antialiasing to work?

試著忘記壹切 提交于 2019-12-01 07:01:49
问题 I'm using these function calls: glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE) It doesn't work and won't render. glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) It doesn't anti-alias. 回答1: Try glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) 回答2: This is a mundane answer.. but if you want rounded corners, you'll probably want to use more more vertices at the corners and place them for a more rounded shape.

Why does OpenGL blending not work on HTC Desire?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 06:30:56
Does anyone know how to enable blending in OpenGL (android) on a HTC Desire. I am trying to draw colored triangles and using the alpha value of the color buffer to blend them with the background (or another triangle). It works both on the emulator (2.1) and on a htc hero 2.1 but not on my desire with 2.2. Is there some hardware difference between a hero and a desire that causes this? The main stuff from the code is (not in order): gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); private

Why does OpenGL blending not work on HTC Desire?

家住魔仙堡 提交于 2019-12-01 04:05:15
问题 Does anyone know how to enable blending in OpenGL (android) on a HTC Desire. I am trying to draw colored triangles and using the alpha value of the color buffer to blend them with the background (or another triangle). It works both on the emulator (2.1) and on a htc hero 2.1 but not on my desire with 2.2. Is there some hardware difference between a hero and a desire that causes this? The main stuff from the code is (not in order): gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT

C# Alpha Blend Transparent PictureBox

扶醉桌前 提交于 2019-12-01 01:02:42
I have a webcam feed being displayed on my form and would like to draw on top of it. I was going to do this using a picture box, I have found the PictureBox doesn't support true transparency instead just the colour of the form it's on. It also doesn't support alphablending which is how I would want it to display, similar to how forms can be made to appear. Does anyone know how to do this? Or have a control implemented that can do this? Transparency in Windows Forms is kind of broken. As you have discovered, it doesn't really support overlapping controls; it just shows the form's background

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

混江龙づ霸主 提交于 2019-11-30 15:52:55
问题 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

Blending transparent textures with depth

故事扮演 提交于 2019-11-30 15:45: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