alphablending

Implementing Porter-Duff Rules in Direct3D

前提是你 提交于 2019-12-08 04:56:31
What Direct3D render states should be used to implement Java's Porter-Duff compositing rules (CLEAR, SRC, SRCOVER, etc.)? I'm haven't used Java too much, but based on the white paper from 1984 , it should be a fairly straightforward mapping of render state blend modes. There are of course more that you can do than just these, like normal alpha blending (SourceAlpha, InvSourceAlpha) or additive (One, One) to name a few. (I assume that you are asking about these specifically because you are porting some existing functionality? In that cause you may not care about other combinations...) Anyway,

Convert PNG from premultiplied-alpha to conventional alpha transparancy?

笑着哭i 提交于 2019-12-07 12:43:18
问题 I'm having a really hard time working with some source images in PNG format that have premultiplied alpha because most tools simply do not support it correctly. Is there anything out there that can do a "best guess" conversion to a more conventional PNG? 回答1: If by "premultiplied alpha" you mean iOS's PNG derivative, then you can convert them back to PNGs with pngdefry. Standard PNGs never use premultiplied alpha. 来源: https://stackoverflow.com/questions/7189417/convert-png-from-premultiplied

iPhone OpenGL ES incorrect alpha blending

偶尔善良 提交于 2019-12-07 11:43:19
问题 I have a problem with incorrect alpha blending results with openGL ES on iPhone. This is my code for creating texture object: glGenTextures(1, &tex_name); glBindTexture(GL_TEXTURE_2D, tex_name); glTextImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, tex_data); 'tex_data' is loaded from raw RGBA8888 data packed with zlib. It loads as it should, wich i've checked with a debugger. This is my code for setting up texture before rendering: glEnable(GL_BLEND);

Overlay two or more Bitmaps to show in Picturebox (C#)

偶尔善良 提交于 2019-12-07 03:44:46
问题 In my C# program I have a Picturebox in which i want to show a stream of video (consecutive frames). I receive raw data, that I then transform into Bitmap or Image. I can show one image at a time without a problem (to reproduce the video stream). Now my issue is that I want to merge 2 or more bitmaps (like layers) with the same size and alpha values (ARGB) and show it on the picturebox . I have read lots of websites and posts here on SO, but many use the Graphics class, and I just can't draw

Can you override a parent UIView's alpha value on one of its subviews?

蓝咒 提交于 2019-12-07 03:28:52
问题 I have a somewhat transparent view (alpha = 0.6) that has some subviews. I'd like one of the subviews (a UILabel) to be drawn with alpha of 1.0 because the blending makes the text difficult to read but by adding it as a subview of the main view it has adopted its parent's alpha value. Is there a way to override this behavior? I believe I'll have to remove it from the subview but wanted to ask and see if maybe I'm missing something. 回答1: You are correct. You'll have to move the UILabel out of

Faster alpha blending using a lookup table?

送分小仙女□ 提交于 2019-12-06 14:29:49
问题 I have made a lookup table that allows you to blend two single-byte channels (256 colors per channel) using a single-byte alpha channel using no floating point values (hence no float to int conversions). Each index in the lookup table corresponds to the value of 256ths of a channel, as related to an alpha value. In all, to fully calculate a 3-channel RGB blend, it would require two lookups into the array per channel, plus an addition. This is a total of 6 lookups and 3 additions. In the

Is there an API to do per-pixel Alpha Blend on GTK and OSX?

独自空忆成欢 提交于 2019-12-06 14:12:18
问题 I want to draw transparent windows (with alpha channel) on Linux (GTK) and OSX. Is there an API to do that ? Note that I don't want to set a global transparency, the alpha level should be set per pixel. I'm looking for the same kind of API than the UpdateLayeredWindow function on Windows, as in this example: Per Pixel Alpha Blend. 回答1: For Mac OS X, see the RoundTransparentWindow sample code. It works by using a custom completely transparent window and drawing shapes in it. Although the

Flood fill algorithm that takes alpha into account without leaving fringes around anti-aliased lines?

[亡魂溺海] 提交于 2019-12-06 11:52:29
I've implemented a typical flood fill algorithm and it works as expected when solid colors are used where I use the Euclidean distance between the ARGB components to compare colors. My problem is that if you draw something like an anti-aliased red line on a transparent background my flood fill algorithm will not fill over most semi-transparent pixels, leaving fringes around objects. Specifically for this example, the center of the line is solid red (i.e. (255, 255, 0, 0) in ARGB format) and the fringes of the line are also solid red but the alpha of these pixels ranges down to 1% alpha (i.e.

How do I get PNG with transparency into GDI32 (in c#) to use it with alphaBlend?

夙愿已清 提交于 2019-12-06 05:44:11
I'm trying to write a fast transparency class in c#. How do I get PNG with transparency into GDI32 to use it with alphaBlend? I tried to put it directly via getHbitmap/selectObject, tried to paint it with setPixel on temporary DC, but all to no avail. In the result I found (afer a sleepless night), that simplest of getting transparency into GDI32 is to set Color.Black in GetHbitmap(). Like this: using (Bitmap tBMP = new Bitmap(@"myBitmap.png")) { BMPObject = tBMP.GetHbitmap(Color.Black); sz = tBMP.Size; } Any other color than black will give tinting in unexpected color of transparent areas.

Blending anti-aliased circles with regl

橙三吉。 提交于 2019-12-06 05:37:21
问题 I'm rendering circles using regl, and have three goals: The canvas should be transparent, showing HTML content behind it. Circles should be antialiased smoothly. Overlapping circles should look reasonable (blend colors, no corners showing) So far, I have this: Glitch code and demo. UPDATE: The demo links now reflect the working, accepted answer. Code below is unchanged. index.js const regl = require('regl'); const glsl = require('glslify'); const vertexShader = glsl.file('../shaders/vertex