alphablending

Odd transparency effect when merging two .png's with transparency in PHP-GD

╄→尐↘猪︶ㄣ 提交于 2019-12-25 17:03:26
问题 Merging two images with transparent sections produces the following composite image: I'm wondering why the transparent section of the image I've overlayed onto the green background shows up as such? Anyone? $base = imagecreatefrompng('application/assets/images/vel1_bg.png'); imagealphablending($base, false); imagesavealpha($base, true); list($baseWidth, $baseHeight, $type, $attr) = getimagesize('application/assets/images/vel1_bg.png'); $user_board_items = $this->config->item('user_board_items

How to improve BlendEffect quality? Lumia Imaging 3.0 & UWP

ε祈祈猫儿з 提交于 2019-12-25 04:26:38
问题 I am developing an app that put text into a background image. The textblocks are placed on a canvas control as children and I render the canvas to PNG. Then I use the BlendEffect to blend it with a background image. UPDATE This post is specifically about chaining effects with Lumia Imaging SDK. Unfortunately one of the person who commented was having a tunnel vision and insist that I must learn about the difference between lossy and lossless image. An opinion as useful as telling a kid how to

Need help understanding Alpha Channels

人走茶凉 提交于 2019-12-24 17:15:09
问题 I have the RGB tuple of a pixel we'll call P. (255, 0, 0) is the color of P with the alpha channel at 1.0. With the alpha channel at 0.8, P's color becomes (255, 51, 51). How can I get the color of the pixel that is influencing P's color? 回答1: Let's start from the beginning. A pixel with alpha only makes sense when it is blended with something else. If you have an upper layer U with alpha and a lower layer L that is totally opaque, the equation is: P = (alpha * U) + ((1.0 - alpha) * L)

How to get a 32bpp bitmap/image from a GDI Device Context?

夙愿已清 提交于 2019-12-24 12:33:01
问题 I am using code from this Project http://www.codeproject.com/Articles/9064/Yet-Another-Transparent-Static-Control in order to draw transparent button images from my subclassed Button control onto my CDialogEx. This code is meant for legacy 24bpp GDI functions: BOOL CTransparentStatic2::OnEraseBkgnd(CDC* pDC) { if (m_Bmp.GetSafeHandle() == NULL) { CRect Rect; GetWindowRect(&Rect); CWnd *pParent = GetParent(); ASSERT(pParent); pParent->ScreenToClient(&Rect); //convert our corrdinates to our

How to get a 32bpp bitmap/image from a GDI Device Context?

瘦欲@ 提交于 2019-12-24 12:27:07
问题 I am using code from this Project http://www.codeproject.com/Articles/9064/Yet-Another-Transparent-Static-Control in order to draw transparent button images from my subclassed Button control onto my CDialogEx. This code is meant for legacy 24bpp GDI functions: BOOL CTransparentStatic2::OnEraseBkgnd(CDC* pDC) { if (m_Bmp.GetSafeHandle() == NULL) { CRect Rect; GetWindowRect(&Rect); CWnd *pParent = GetParent(); ASSERT(pParent); pParent->ScreenToClient(&Rect); //convert our corrdinates to our

Explain how premultiplied alpha works

笑着哭i 提交于 2019-12-24 11:34:35
问题 Can somebody please explain why rendering with premultiplied alpha (and corrected blending function) looks differently than "normal" alpha when, mathematically speaking, those are the same? I've looked into this post for understanding of premultiplied alpha: http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx The author also said that the end computation is the same: "Look at the blend equations for conventional vs. premultiplied alpha. If you substitute this color

Blending two images with html5 canvas

冷暖自知 提交于 2019-12-24 03:56:24
问题 I need to draw 2 variations of the same image on top of each other, whose alpha values add up to 1. For example : - imageA has an alpha of 0.4 , while imageB has an alpha of 0.6 . - The desired result is a completely opaque image (alpha of 1.0 for each pixel), which appears as a 60% blend of imageB , and a 40% blend of imageA . However, I believe that the html5 canvas by default uses a blend mode other than add on alpha blended images, so two things drawn with alphas below 1 will not add up

How are `glTexEnv`, `glColor4x` and `glBlendFunc` related in OpenGL ES 1.0?

一个人想着一个人 提交于 2019-12-23 20:56:48
问题 I'm looking at SurfaceFlinger, i.e. the the code that is doing the composition in Android, and I have trouble understanding some of the OpenGL ES 1.0 calls as I've only programmed ES 2.0 code. Here goes the piece of code that interests me: glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glColor4x(0x10000, 0x10000, 0x10000, 0x10000); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); What it is supposed to be doing is blending a texture into the buffer. Why does one

Sorting meshes in XNA

蓝咒 提交于 2019-12-23 15:33:57
问题 I have problem with trees in XNA. When I have tree, I need to use alpha blending to make non-leaf parts transparent, but some parts of model are not correctly displayed and thus alpha blending fails. I want to know if there is possibility to read mesh position to sort them or is there any other way to have transparent non-leaf parts. Sorting in model probably won't work because I want to look at this tree from all angles. 回答1: Alpha blending in a 3D environment can be a tricky issue. Shawn

Per-component alpha-channels with OpenGL?

。_饼干妹妹 提交于 2019-12-23 12:08:03
问题 Is it possible to perform blending with one alpha channel per component (one for red, one for green and one for blue) with OpenGL? If not, what are some possible workarounds? 回答1: This isn't something that's directly supported. It's fairly easy to achieve on your own though: Render your triangle (or whatever) using the 3-channel "alpha" texture and glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR) Enable multitexture and set the "alpha" texture to modulate your rgb texture Render your triangle