alpha

How to make WebGL canvas transparent

a 夏天 提交于 2019-12-04 10:08:02
问题 Is it possible to have WebGL canvas with transparent background? I want to have contents of web page visible through the canvas. This is what I have now: http://i50.tinypic.com/2vvq7h2.png As you can see, the text behind the WebGL canvas is not visible. When I change style of Canvas element in CSS and add opacity: 0.5; The page will look like this: http://i47.tinypic.com/302ys9c.png Which is almost what I want, but not entirely - the color of text due to the CSS alpha setting is of course not

Efficient Bitmap masking with black and white alpha mask in Android

限于喜欢 提交于 2019-12-04 09:58:45
I wanted to mask a Bitmap with a black and white alpha mask. My mask image is black and white, the BLACK area means TRANSPARENT and WHITE area means OPAQUE. What I need is: When I use this mask image to mask any other image, the area of resultant image should TRANSPARENT if the corresponding area of mask image is BLACK. Otherwise the area of resultant image should be OPAQUE. I have attached the sample images. Please help me with this guys. Sample Image: Sample Image for Masking What I have tried so far: The following methods work fine. But they are very slow. I needed some solution that is

Painting in Canvas which fades with time | Strange alpha layering behaviour

余生颓废 提交于 2019-12-04 09:34:55
I'm painting to a canvas which isn't being cleared and making it so that the canvas either fades to a solid colour over time, or fades in alpha revealing the layer behind. My first instinct was to simply fill a rectangle over the drawing with a low alpha each frame so that the fill colour accumulates gradually fading out the painting. But I found some strange behaviour (to me at least, I'm sure there's a reason). The fill colour never fully accumulates. And the results change depending on wether paint & fill colours are lighter/darker than each other. I found this question where someone was

colorWithAlphaComponent example in Swift

泄露秘密 提交于 2019-12-04 08:49:12
问题 What is the correct syntax for this function in Swift? The following works fine, and colors the background purple: self.view.backgroundColor = UIColor.purpleColor() When I chain the colorWithAlphaComponent function, the view shows the correct alpha for a moment, and then changes to an opaque purple that is relatively dark: self.view.backgroundColor = UIColor.purpleColor().colorWithAlphaComponent(0.5) Is this the recommended function for adding an alpha value to a UIColor? Furthermore, why