alphablending

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

坚强是说给别人听的谎言 提交于 2019-12-18 02:46:55
问题 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

Is it possible to render web content over a clear background using WebKit?

烈酒焚心 提交于 2019-12-17 15:26:50
问题 I'm trying to gauge the possibility of a patch to WebKit which would allow all rendered graphics to be rendered onto a fully transparent background. The desired effect is to render web content without any background at all, it should appear to float over the desktop (or whatever is displayed behind the browser window). Has anyone seen an app do this? (I can think of some terminal emulators that can.) If anyone has worked inside of WebKit (or possibly Gecko?) do you think it would be possible

blend two uiimages based on alpha/transparency of top image

别说谁变了你拦得住时间么 提交于 2019-12-17 04:12:40
问题 I'm trying to blend a background with a foreground image, where the foreground image is a transparent image with lines on it. I am trying to do it this way. UIGraphicsBeginImageContext(CGSizeMake(320, 480)); CGContextRef context = UIGraphicsGetCurrentContext(); // create rect that fills screen CGRect bounds = CGRectMake( 0,0, 320, 480); // This is my bkgnd image CGContextDrawImage(context, bounds, [UIImage imageNamed:@"bkgnd.jpg"].CGImage); CGContextSetBlendMode(context, kCGBlendModeSourceIn)

Windows 8 Store App DirectX 11.1 Enabling Blendstate with loaded PNG texture with alpha

跟風遠走 提交于 2019-12-13 06:17:40
问题 I am loading a PNG with transparency to a texture with the following code: ComPtr<IWICStream> stream; ComPtr<IWICBitmapDecoder> bitmapDecoder; ComPtr<IWICBitmapFrameDecode> bitmapFrame; ComPtr<IWICFormatConverter> formatConverter; unsigned int width, height D3D11_SUBRESOURCE_DATA resourceData; ZeroMemory(&resourceData, sizeof(resourceData)); DX::ThrowIfFailed( m_wicFactory->CreateStream(&stream) ); DX::ThrowIfFailed( stream->InitializeFromMemory( rawFileBytes->Data, rawFileBytes->Length) );

How to blend 2 transparency layers?

隐身守侯 提交于 2019-12-13 03:25:20
问题 For example we have 2 transparency layers: first is black (0, 0, 0, 0.75) and second is white (255, 255, 255, 0.64) . I don't know how to blend them. But I know how to blend one opaque and one transparent layers. It's look like this: https://wikimedia.org/api/rest_v1/media/math/render/svg/1e35c32f13d5eedc7ac21e9e566796dd048a31e6 回答1: Assume that the background colour is (C, 1) (RGB, A), the first layer is (A, s) and the second layer (B, t) . Applying the blending equation twice: C' = t * B +

Why does AlphaBlend always return false (drawing on canvas)?

折月煮酒 提交于 2019-12-13 01:22:55
问题 I am trying to blend two canvases together using the windows alphablend API call. First I draw some thing on the main canvas (destination), then instantiate another canvas using TBitmap, draw onto that, and then blend the two together (following an answer here on SO). However, I am finding that it always returns false, at first I thought it had something to do with passing the wrong handles for source and destination, but I cannot figure it out. what could it be? unit MainWnd; interface uses

Create a PNG having JPG and AlphaChannel in C#

*爱你&永不变心* 提交于 2019-12-12 20:09:31
问题 How can I create a PNG file if I have two separated JPG files with the image and the alpha channel? JPG Image + JPG Mask --> PNG with transparency I've tried WPF solutions: image.OpacityMask = new ImageBrush ( new BitmapImage ( uriMask ) ); and System.Drawing. Image bmpMask = Image.FromFile ( maskFilePath ); gfxNewImage.SetClip ( Graphics.FromImage (bmpMask) ); but I have problems with both (black background, or full black) Any idea or example? ThankYou 回答1: Ok Let's assume that you have a

OpenGL transparency/translucency

眉间皱痕 提交于 2019-12-12 11:35:19
问题 I have a question with alpha blending in openGL... I've tried some stuff for drawing transparent objects... I've seen a nice (ideal) result by disabling GL_DEPTH_TEST before drawing the transparent faces and re-enable GL_DEPTH_TEST again back after drawing the transparent face... Obviously I've noticed that depending on the order that I draw the different faces I got a result or another... However I've decided simply to draw solid faces first with GL_DEPTH_TEST enabled and after the

Use only alpha channel of texture in OpenGL?

筅森魡賤 提交于 2019-12-12 10:08:47
问题 Hey, I'm trying to draw a constant color to the framebuffer and blend it using the alpha channel from an RGBA texture. I've been looking at glBlendFunc and glBlendColor, but can't seem to figure out a way to ignore the RGB values from the texture. I'm thinking I'll have to pull out the alpha values myself and make a second texture with GL_ALPHA. Is there a better way to do this? Thanks! 回答1: I'm using colour coded picking. This is the code I'm using so that transparent areas of a textured

OpenGL - FBO and alpha blending

拥有回忆 提交于 2019-12-12 01:53:26
问题 I was finding for answer, but I can't get answer for my problem. I have FBO and I can't get alpha blending and multisample to work. FBO draws scene to texture and then it's drown to default framebuffer with two textured triangles. Drawing directly to default framebuffer is fine. Here is difference between default framebuffer (top) and my FBO (bottom). I use FBO with 2x color attachments and 1x depth attachments. (Only GL_COLOR_ATTACHMENT0 is used, second is for other function) Depth test: