alpha-transparency

Manually alpha blending an RGBA pixel with an RGB pixel

烈酒焚心 提交于 2019-11-27 01:19:58
问题 I am trying to do an alpha blend operation of an RGBA image (foreground image), on to a RGB image (background image). However, while doing so I think I may be doing the wrong alpha blending operation or doing it wrong. For example, the pixel of my RGB image is a grayish color of (127, 127, 127). The pixel of my RGBA image for the pixel will be (0, 0, 255). After I do my blending operation, the final color will be (127, 0, 255). However, I thought that was more of an additive blend and

Convert Transparent PNG to JPG with Non-Black Background Color

穿精又带淫゛_ 提交于 2019-11-27 00:53:57
I'm using System.Drawing.Image in .Net to do a simple conversion from png to jpeg. I'm basically just using these two lines of code: Image img = Image.FromFile(filename); img.Save(newFilename, System.Drawing.Imaging.ImageFormat.Jpeg); it works fine except for when the png files contain transparency due to the alpha channel. In which case the converted jpeg has a black background. Is there any way to make the background white instead? // Assumes myImage is the PNG you are converting using (var b = new Bitmap(myImage.Width, myImage.Height)) { b.SetResolution(myImage.HorizontalResolution, myImage

How to set given channel of a cv::Mat to a given value efficiently without changing other channels?

我是研究僧i 提交于 2019-11-26 23:27:25
问题 How to set given channel of a cv::Mat to a given value efficiently without changing other channels? For example, I want to set its fourth channel (alpha channel) value to 120 (i.e. half transparent), something like: cv::Mat mat; // with type CV_BGRA ... mat.getChannel(3) = Scalar(120); // <- this is what I want to do P.S.: My current solution is first split the mat into multiple channels and set the alpha channel, and then merge them back. P.S.2: I know that I can do this quickly if I also

How to create transparent activity in android?

心不动则不痛 提交于 2019-11-26 19:46:41
问题 How to create transparent activity in android in that screen tap to dismiss button automatically dismiss the activity. please provide any solution. 回答1: There are two ways to achieve this use the following theme for activity. android:theme="@android:style/Theme.Translucent" Set background of the activity as a trans parent png image or a transparent code eg. android:background="@drawable/transparent_bg" or android:background="#33BBFFFF" this is a semi transparent color Related Links How to

JTextArea not selectable, but still showing a “ghost” cursor

纵然是瞬间 提交于 2019-11-26 12:48:10
问题 I put a JTextArea in a JPanel. This JPanel has a picture on the background, and the JTextArea is translucent (translucid red) to show the background through. I don\'t want the user to be able to edit or select the text, I want it to act just as a JLabel (but with multiple lines and easy to word wrap and adjust to screen resize). I tried all these options: text.setEditable(false); text.setFocusable(false); text.setEnabled(false); text.setHighlighter(null); but still some change of color

How to convert an image to an icon without losing transparency?

纵然是瞬间 提交于 2019-11-26 11:34:39
问题 I have PNG images which I need to convert to an icon before displaying it. This is how I did it: public Icon ImageToIcon(Image imgTest) { Bitmap bitmap = new Bitmap(imgTest); Icon icoTest; IntPtr iPtr = bitmap.GetHicon(); icoTest = (Icon) Icon.FromHandle(iPtr).Clone(); return icoTest; } I lose transparency after doing this, alpha transparent images are not rendered as expected....can this be solved? 回答1: No, there's a lot more to it. Icons have a pretty elaborate internal structure, optimized

Replace transparency in PNG images with white background

青春壹個敷衍的年華 提交于 2019-11-26 10:06:32
问题 I\'ve got some PNG images with transparency, and I need to create versions with the image layer composed onto a white background. I\'ve tried various things with Image Magick \"convert\" operations, but either nothing happens at all or I get an error. I don\'t want to go to an intermediate JPG form because I don\'t want the artifacts. Of course it\'s easy to do this in Gimp or Photoshop or whatever, but I\'d really rather script it from the command line because there are many of these things.

Convert Transparent PNG to JPG with Non-Black Background Color

你离开我真会死。 提交于 2019-11-26 09:32:14
问题 I\'m using System.Drawing.Image in .Net to do a simple conversion from png to jpeg. I\'m basically just using these two lines of code: Image img = Image.FromFile(filename); img.Save(newFilename, System.Drawing.Imaging.ImageFormat.Jpeg); it works fine except for when the png files contain transparency due to the alpha channel. In which case the converted jpeg has a black background. Is there any way to make the background white instead? 回答1: // Assumes myImage is the PNG you are converting

CSS opacity and child elements

丶灬走出姿态 提交于 2019-11-26 08:19:12
问题 <style type=\"text/css\"> div#foo { background: #0000ff; width: 200px; height: 200px; opacity: 0.30; filter: alpha(opacity = 30); } div#foo>div { color: black; opacity:1; filter: alpha(opacity = 100); } </style> <div id=\"foo\"> <div>Lorem</div> <div>ipsum</div> <div>dolor</div> </div> In the above example, the opacity of div#foo is inherited by child elements, causing the text to become nearly unreadable. I suppose it\'s wrong to say it is inherited, the opacity is applied to the parent div