alpha

Simulate color transparency

十年热恋 提交于 2021-02-18 21:30:32
问题 I have RGB color value and alpha value. How can I get new RGB value assuming that I have white backgound and alpha is applied? 回答1: The formula to be applied to each of the color channels is the following: cr = cf * af + cb * ab * (1 - af) where cr is the resulting color of the pixel, cf is the foreground color, cb the background color, af foreground alpha and ab background alpha. Note that often color values are stored already premultiplied by alpha in which case the formula simplifies to cr

Simulate color transparency

核能气质少年 提交于 2021-02-18 21:30:09
问题 I have RGB color value and alpha value. How can I get new RGB value assuming that I have white backgound and alpha is applied? 回答1: The formula to be applied to each of the color channels is the following: cr = cf * af + cb * ab * (1 - af) where cr is the resulting color of the pixel, cf is the foreground color, cb the background color, af foreground alpha and ab background alpha. Note that often color values are stored already premultiplied by alpha in which case the formula simplifies to cr

WPF BitmapImage and TIFF with CMYK + Alpha

[亡魂溺海] 提交于 2021-02-08 15:42:52
问题 I am using this code snippet to load various image files: BitmapImage bitmap = new BitmapImage (); bitmap.BeginInit (); bitmap.UriSource = new System.Uri (path); bitmap.CreateOptions = BitmapCreateOptions.PreservePixelFormat; bitmap.EndInit (); This works fine for TIFF files stored as RGB, RGB+Alpha and CMYK. However, if I try to load a TIFF file using CMYK colors and an alpha channel, I get an exception (the file format is not recognized as being valid by the decoder). I was previously using

WPF BitmapImage and TIFF with CMYK + Alpha

半世苍凉 提交于 2021-02-08 15:42:25
问题 I am using this code snippet to load various image files: BitmapImage bitmap = new BitmapImage (); bitmap.BeginInit (); bitmap.UriSource = new System.Uri (path); bitmap.CreateOptions = BitmapCreateOptions.PreservePixelFormat; bitmap.EndInit (); This works fine for TIFF files stored as RGB, RGB+Alpha and CMYK. However, if I try to load a TIFF file using CMYK colors and an alpha channel, I get an exception (the file format is not recognized as being valid by the decoder). I was previously using

How to avoid transparency overlap using OpenGL?

。_饼干妹妹 提交于 2021-02-07 13:42:10
问题 I am working on a handwriting application on iOS. I found the sample project "GLPaint" from iOS documentation which is implemented by OpenGL ES, and I did something modification on it. I track the touch points and calculate the curves between the points and draw particle images alone the curve to make it looks like where the finger passby. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,

How to avoid transparency overlap using OpenGL?

旧城冷巷雨未停 提交于 2021-02-07 13:41:20
问题 I am working on a handwriting application on iOS. I found the sample project "GLPaint" from iOS documentation which is implemented by OpenGL ES, and I did something modification on it. I track the touch points and calculate the curves between the points and draw particle images alone the curve to make it looks like where the finger passby. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,

Remove text from jpeg

╄→гoц情女王★ 提交于 2021-02-07 10:13:18
问题 I have a jpeg containing alpha blended text. Knowing the font and size, I deduced a png file representing the text Using ImageMagick, can I get an approximation of the original picture? 回答1: Albert Myšák has the proper technique here, since one knows the exact alpha channel values for the text and the equation that describes how the alpha channel is blended with the image. Kudos! My earlier methods are better suited to when one only knows the positions of the text pixels in the image, so that

how to make circular surface in pygame

戏子无情 提交于 2021-02-05 09:23:06
问题 I need to create a surface that has a bounding circle. Anything drawn on that surface should not be visible outside that bounding circle. I've tried using masks, subsurfaces, srcalpha, etc., but nothing seems to work. My attempt: w = ss.get_width () h = ss.get_height () TRANSPARENT = (255, 255, 255, 0) OPAQUE = ( 0, 0, 0, 225) crop = pygame.Surface ((w, h), pygame.SRCALPHA, ss) crop.fill (TRANSPARENT) c = round (w / 2), round (h / 2) r = 1 pygame.gfxdraw. aacircle (crop, *c, r, OPAQUE) pygame

OpenGL default pipeline alpha blending does not make any sense for the alpha component

ε祈祈猫儿з 提交于 2021-02-04 14:47:07
问题 Q : Is there a way to use the default pipeline to blend the Alpha component properly? Problem : I'm drawing semi-transparent surfaces into a texture, then I want to blit that texture into the main frame back buffer. Normally when you use straightforward alpha blending for transparency or antialiasing, it is to blend color components into the back buffer ( which has no alpha channel by deafult ). However, when blending into a texture that has an alpha component, the usual GL_SRC_ALPHA, GL_ONE

Pygame image transparency confusion [duplicate]

五迷三道 提交于 2021-02-02 09:51:06
问题 This question already has answers here : How can I make an Image with a transparent Backround in Pygame? (2 answers) How do I blit a PNG with some transparency onto a surface in Pygame? [duplicate] (4 answers) pygame image background does not match main background (1 answer) How to make a surface with a transparent background in pygame (3 answers) Closed 3 months ago . I have read the top 20 posts relating to this issue here, read many examples on Google, tried using .convert() , .convert