alpha-transparency

How to set alpha value for drawable in a StateListDrawable?

浪尽此生 提交于 2019-12-07 05:20:55
问题 I want to change a drawable's alpha value when it is pressed. So I create two drawables and put them in a StateListDrawable and set the alpha value for the pressed state. But it just doesn't work. StateListDrawable content = new StateListDrawable(); Drawable contentSelected = this.getResources().getDrawable( R.drawable.content_background); contentSelected.mutate().setAlpha(100); Drawable contentNormal = this.getResources().getDrawable(R.drawable.content_background); content.addState(new int[]

Keep alpha-transparency of a video through HDMI

旧城冷巷雨未停 提交于 2019-12-06 10:32:39
The scenario I'm dealing with is actually as follow: I need to get the screen generated by OpenGL and send it through HDMI to a FPGA component while keeping the alpha channel. But right now the data that is being sent through HDMI is only RGB (24bit without alpha channel) So i need a way to force sending the Alpha bits through this port somehow. See image: http://i.imgur.com/hhlcbb9.jpg One solution i could think of is to convert the screen buffer from RGBA mode to RGB while mixing the Alpha channels within the RGB buffer. For example: The original buffer: [R G B A][R G B A][R G B A] The

Unusual result when merging two transparent images in php

瘦欲@ 提交于 2019-12-06 07:48:46
Im wondering if I'm doing something wrong, or if this is as good a result as im going to get. Both PNGs on the left are 95x111. The image of the robot has a 5px or so padding of transparent pixels around it, but it seems to be causing problems when they merge? $avatar = imagecreatefrompng("../guy.png"); $borderImg = imagecreatefrompng("../frame.png"); imagealphablending( $borderImg, false ); imagesavealpha( $borderImg, true ); imagecopyresampled($avatar,$borderImg, 0, 0, 0, 0, 95, 111,95, 111); imagepng($avatar, $newfilenameBig); Ive tried every combo of imagealphablending and imagesavealpha I

2 opposite opacity values dont produce opaque color

纵然是瞬间 提交于 2019-12-06 05:16:56
I want to produce an opaque solid color with 2 opacity values of that color. eg: 0.5 opacity black color rectangle when placed above same 0.5 opacity black color doesn't give me same result as an opaque (opacity 1) black color. I have tried this with different range of opacity values and found something like 0.5 & 0.8 produce 0.9 opacity black color, 0.4 & 0.82 and so on. These are not accurate values. What is the exact formula for calculating exactly opposite opacity values? If two elements with opacity 1-a and 1-b are stacked on top of each other, their combined opacity will be 1-a*b , so

unable to transparent pixels of a bitmap image

若如初见. 提交于 2019-12-06 00:50:10
I am working with bitmap images whose transparent parts are colored in magenta (in some languages it is possible to set a color as transparent). I try to transparent pixels which are in magenta in the original bitmap image. I load the bitmap from SD-card: Bitmap bitmap = BitmapFactory.decodeFile(myImagePath); copy it to another bitmap to make it mutable: Bitmap bitmap2 = bitmap.copy(Bitmap.Config.ARGB_8888,true); Then scan it pixel by pixel to find pixels in magenta and try to change their transparency. for(int x=0;x<bitmap2.getWidth();x++){ for(int y=0;y<bitmap2.getHeight();y++){ if(bitmap2

How to create child layered alpha-transparent window?

末鹿安然 提交于 2019-12-05 22:41:59
I am trying to create transparent child window. procedure TForm1.BtnGoClick(Sender: TObject); var bmp:TBitmap; BitmapPos: TPoint; BitmapSize: TSIZE; BlendFunction: _BLENDFUNCTION; exStyle: Cardinal; begin bmp := TBitmap.Create; bmp.LoadFromFile('my32bitbitmap.bmp'); exStyle := GetWindowLongA(Form2.Handle, GWL_EXSTYLE); if (exStyle and WS_EX_LAYERED = 0) then SetWindowLong(Form2.Handle, GWL_EXSTYLE, exStyle or WS_EX_LAYERED); BitmapPos := Point(0, 0); BitmapSize.cx := bmp.Width; BitmapSize.cy := bmp.Height; BlendFunction.BlendOp := AC_SRC_OVER; BlendFunction.BlendFlags := 0; BlendFunction

How to detect a browser that dosen't render .png transparency

孤者浪人 提交于 2019-12-05 21:16:40
I have this code that render's a image acording to the day of the week. But in IE6 and lower and probably some other browsers it won't render png opacity. So I want to change it a litle so that it will detect the browser's that don't render alpha transparency and tell them to load this image instead: "img/horarios2.png". Ive tried making it so that it would rule out IE6 and lower that are known for not rendering, but then I thinking about all the other browsers that I probably don't know about that don't render either and needed something that would rule them out also. I don't know the best

How to set alpha value for drawable in a StateListDrawable?

萝らか妹 提交于 2019-12-05 10:44:52
I want to change a drawable's alpha value when it is pressed. So I create two drawables and put them in a StateListDrawable and set the alpha value for the pressed state. But it just doesn't work. StateListDrawable content = new StateListDrawable(); Drawable contentSelected = this.getResources().getDrawable( R.drawable.content_background); contentSelected.mutate().setAlpha(100); Drawable contentNormal = this.getResources().getDrawable(R.drawable.content_background); content.addState(new int[] { android.R.attr.state_pressed }, contentSelected); content.addState(new int[] { android.R.attr.state

Transparent webm video displays solid background color on Chrome for Android 68 on android 9.0

核能气质少年 提交于 2019-12-04 19:36:50
I have simple page with a webm video with transparent background. It works well on desktop. It works well on Chrome for Android version 66 on my android phone running android 9.0 too. But after upgrading to Chrome for Android version 68, the video displays solid background color. I checked the console and no error or warning found. Chrome 66: ] 2 ] 2 Chrome 68: I tested on Chrome for Android version 68 on other phones which running Android 7 and it works well. Does anyone know why this happens that and how to resolve it? I had a similar problem when webm was converted with VP8 codec. I fixed

Why does System.Drawing.Graphics blank the RGB channels when Alpha==0?

[亡魂溺海] 提交于 2019-12-04 12:36:22
This has become a serious blocker for a program I'm working on to manipulate images that have Alpha channels. Many of the images I have contain color information where an Alpha channel is completely transparent, and yet as soon as I try to load them into System.Drawing.Graphics, it changes anything with of Alpha of 0, into Black with an Alpha of 0. Here is a basic sample of the issue. I have looked around trying to find a reason, answer, or workaround, but I haven't found anything that even alludes to this issue. Any help would be appreciated at this point. var myTestTransparentColor = Color