alpha-transparency

Calculate resulting RGB from 2 colors, one is transparent

最后都变了- 提交于 2019-11-30 07:29:43
I'm looking for a formula to convert them. I know to convert a general transparency it is alpha * new + ( 1 - alpha ) * old I have: Color A : RGB( 85, 113, 135 ) Color B : RGB( 43, 169, 225 ) Color A has 90% opacity and is laid on top of Color B, resulting in Color C : RGB( 65, 119, 145 ) My question is, how does it get Color C? If I substitute Color B for another thing, how do I get Color C? Here's another example, same base color: Color A : RGB( 85, 113, 135 ) Color B : RGB( 45, 67, 82 ) -------- Color C : RGB( 65, 109, 131 ) Those are working examples done with images -- I'm trying to now

Is there a way to set drawable's Alpha using XML?

三世轮回 提交于 2019-11-29 22:49:05
Easy like itself . I wanna make an alpha button , which would have a selected drawable this way: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Play/Pause --> <item android:state_selected="false" android:drawable="@drawable/item" /> <item android:state_selected="true" android:drawable="@drawable/item" /> </selector> I would wanna make something like this: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Play/Pause --> <item android:alpha="125" android:state

Transparent equivalent of given color

青春壹個敷衍的年華 提交于 2019-11-29 22:48:36
I've had this a few times, so here goes: I'm making some plots which hold curves with estimates of a parameter given a tuning parameter. Typically, I also have SDs for each estimated value, so I could show error bars around each of them. However, I don't like error bars, and would prefer some smoothed version of it. This is in itself no problem (ie I know how to do this). However, my plot contains several of these similar curves, each one in its own color. So I would like to add the 'smoothed errorregion' to each curve in a color that matches the color of the curve itself. Of course, I would

How To Make Part of Web View Slightly Translucent?

。_饼干妹妹 提交于 2019-11-29 18:09:26
In Objective-C with Mac OSX Cocoa , is there any way to make a DIV on a WebView slightly translucent so that the desktop applications behind the window bleed through slightly, but only on that DIV and not the rest of the WebView ? Or perhaps I can make the whole WebView translucent, but turn it off for all DIV s except one DIV ? I have a WebView loading a web page. In the web page, I have a sidebar on the left, and then an IFRAME on the right. I click items on the sidebar and they change the IFRAME pages on the right. It's this sidebar that I want to make slightly translucent. In my

Semi-transparent colors in Google Charts?

别说谁变了你拦得住时间么 提交于 2019-11-29 15:21:03
A call like chart.draw(data, { colors: ['#e0440e', '#e6693e', '#ec8f6e', ...], ... }); creates a chart with colors looking like semi-transparent . However, we passed RGB colors, with no alpha parameter! In other chart apps (like jqPlot, CanvasJS etc) you may pass rgba calls instead, like in [ 'rgba(255,0,0,0.5)', 'rgba(0,255,0,0.5)', ...] Google Charts does not seem to support this. But is there any other way to pass RGBA custom colors instead, with a simple syntax? PS: there is a somehow similar question for pie charts, but mine is different, for custom color palettes. once the 'ready' event

ggplot2: how to transparently shade alternate days on a plot

旧时模样 提交于 2019-11-29 13:10:05
问题 What am I doing wrong here please? I'm trying to shade alternate 24-hr daily rectangles with transparent gray. But only the last rectangle from the for-loop gets drawn(?!?) If I do things manually instead of by for-loop it works fine. Is there a way to vectorize this to avoid the for-loop? (And can it be done with qplot?) I'm new to ggplot2 and yes I read through Hadley's site, book and examples. Second issue: the alpha setting on the aesthetic doesn't prevent the rectangles occluding the

turning a div into transparent to see through two containers

空扰寡人 提交于 2019-11-29 10:59:14
I have following markup <body> <div class="holder"> <div class="circle"></div> </div> </body> and i have applied a fixed background to body element and white background applied to class holder body { background: url(image.png); background-attachment: fixed; } .holder { width: 500px; height: 500px; background: #fff; } .circle { width: 100px; height: 100px; border-radius: 50%; background: rgba(0, 0, 0, 0); } what i have tried to do is to make the circle transparent to see the body background. Simply, what i am trying is, making the circle transparent to see the body background image while the

Why does openCV's convertto function not work?

随声附和 提交于 2019-11-29 09:55:32
I have an image which has 4 channels and is in 4 * UINT8 format. I am trying to convert it to 3 channel float and I am using this code: images.convertTo(images,CV_32FC3,1/255.0); After the conversion, the image is in a float format but still has 4 channels. How can I get rid of 4th (alpha) channel in OpenCV? As @AldurDisciple said, Mat::convertTo() is intended to be used for changing the data type of a Mat , not for changing the number of channels. To work out, you should split it into two steps: cvtColor(image, image, CV_BGRA2BGR); // 1. change the number of channels image.convertTo(image, CV

ggplot legend showing transparency and fill color

假装没事ソ 提交于 2019-11-29 09:23:47
I'm plotting two semi-transparent ribbons together. Using the code below, without the scale_fill_manual portion, I get basically what I want, with a legend called "red" , and labels blue and red . Adding the scale_fill_manual portion allows me to name the legend and its entries what I want, but i lose the transparency of the colored rectangles in the legend. x=1:10 y1=1:10 y2=2:11 y3=10:1 y4=9:0 dt=data.frame(x,y1,y2,y3,y4) library(ggplot2) ggplot(dt)+ geom_ribbon(aes(x=x,ymin=y1,ymax=y2,fill='red'), alpha=0.4,)+ geom_ribbon(aes(x=x,ymin=y3,ymax=y4,fill='blue'), alpha=0.5)+ scale_fill_manual

Access to raw data in ARGB_8888 Android Bitmap

烂漫一生 提交于 2019-11-28 20:52:06
I am trying to access the raw data of a Bitmap in ARGB_8888 format on Android, using the copyPixelsToBuffer and copyPixelsFromBuffer methods. However, invocation of those calls seems to always apply the alpha channel to the rgb channels. I need the raw data in a byte[] or similar (to pass through JNI; yes, I know about bitmap.h in Android 2.2, cannot use that). Here is a sample: // Create 1x1 Bitmap with alpha channel, 8 bits per channel Bitmap one = Bitmap.createBitmap(1,1,Bitmap.Config.ARGB_8888); one.setPixel(0,0,0xef234567); Log.v("?","hasAlpha() = "+Boolean.toString(one.hasAlpha())); Log