alphablending

Android - Is it possible to declare an alpha mask directly within layer-list XML definition?

那年仲夏 提交于 2019-11-28 17:29:04
A newbie question I have this layers.xml that I use as a source for an ImageView. And two images, mask.png and image.jpg layers.xml: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <bitmap android:src="@drawable/image" android:gravity="center"/> </item> <item> <bitmap android:src="@drawable/mask" android:gravity="center"/> </item> </layer-list> ImageView: <ImageView android:id="@+id/img_B" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/layers"/> At the moment the output is just the png over the image. I would like

opengl - blending with previous contents of framebuffer

不想你离开。 提交于 2019-11-28 16:54:23
I am rendering to a texture through a framebuffer object, and when I draw transparent primitives, the primitives are blended properly with other primitives drawn in that single draw step, but they are not blended properly with the previous contents of the framebuffer. Is there a way to properly blend the contents of the texture with the new data coming in? EDIT: More information requsted, I will attempt to explain more clearly; The blendmode I am using is GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA. (I believe that is typically the standard blendmode) I am creating an application that tracks mouse

Remove transparency/alpha from any image using PIL

人走茶凉 提交于 2019-11-28 12:08:37
How do I replace the alpha channel of any image (png, jpg, rgb, rbga) with specified background color? It must also work with images that do not have an alpha channel. This can be done by checking if the image is transparent def remove_transparency(im, bg_colour=(255, 255, 255)): # Only process if image has transparency (http://stackoverflow.com/a/1963146) if im.mode in ('RGBA', 'LA') or (im.mode == 'P' and 'transparency' in im.info): # Need to convert to RGBA if LA format due to a bug in PIL (http://stackoverflow.com/a/1963146) alpha = im.convert('RGBA').split()[-1] # Create a new background

Manually alpha blending an RGBA pixel with an RGB pixel

ぐ巨炮叔叔 提交于 2019-11-28 06:24:47
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 different than the operation I am doing. For how my values are set, take a look at this incPixelColor[0] = 0;

Is it possible to create a CImageList with alpha blending transparency?

不想你离开。 提交于 2019-11-28 01:12:07
问题 I would like to knwo if it is possible to create a CImageList with alpha blending transparency. Sample code that creates a CImageList with ugly transparency (no alpha blending) CGdiPlusBitmapResource m_pBitmap; m_pBitmap.Load(IDB_RIBBON_FILESMALL,_T("PNG"),AfxGetResourceHandle()); HBITMAP hBitmap; m_pBitmap.m_pBitmap->GetHBITMAP(RGB(0,0,0),&hBitmap ); CImageList *pList=new CImageList; CBitmap bm; bm.Attach(hBitmap); pList->Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 4); pList->Add(&bm, RGB(255

AlphaBlend in FireMonkey

岁酱吖の 提交于 2019-11-27 21:55:02
问题 How can I change AlphaBlend value (of a form) in a FireMonkey Desktop Application? Well It's available in VCL Application but I couldn't find it in FireMonkey. Screenshot: 回答1: To make your form background semitransparent you should set form Transparency property to true and use Fill.Color with alpha value like $AAFFFFFF (with Fill.Kind = bkSolid ). in this case form border becomes invisible (at least in Delphi XE2 ) if you need to make all components at form semitransparent then place

Remove transparency/alpha from any image using PIL

送分小仙女□ 提交于 2019-11-27 19:23:31
问题 How do I replace the alpha channel of any image (png, jpg, rgb, rbga) with specified background color? It must also work with images that do not have an alpha channel. 回答1: This can be done by checking if the image is transparent def remove_transparency(im, bg_colour=(255, 255, 255)): # Only process if image has transparency (http://stackoverflow.com/a/1963146) if im.mode in ('RGBA', 'LA') or (im.mode == 'P' and 'transparency' in im.info): # Need to convert to RGBA if LA format due to a bug

Windows Forms: Making a cursor bitmap partially transparent

杀马特。学长 韩版系。学妹 提交于 2019-11-27 18:12:37
问题 I want to use partially transparent images in drag/drop operations. This is all set up and works fine, but the actual transformation to transparency has a weird side effect. For some reason, the pixels seem to be blended against a black background. The following image describes the problem: Figure a) is the original bitmap. Figure b) is what is produced after alpha blending has been performed. Obviously this is a lot darker than the intended 50% alpha filter intended. Figure c) is the desired

Is it possible to render web content over a clear background using WebKit?

情到浓时终转凉″ 提交于 2019-11-27 17:27:29
I'm trying to gauge the possibility of a patch to WebKit which would allow all rendered graphics to be rendered onto a fully transparent background. The desired effect is to render web content without any background at all, it should appear to float over the desktop (or whatever is displayed behind the browser window). Has anyone seen an app do this? (I can think of some terminal emulators that can.) If anyone has worked inside of WebKit (or possibly Gecko?) do you think it would be possible to do this? Update: I've come to realize that Mac OSX dashboard widgets use this exact technique. So,

Heatmap style gradients in .NET

醉酒当歌 提交于 2019-11-27 15:31:18
I am trying to create a heat map with gradients that look similar to this: This image shows three points and the gradients blend nicely together. Here is what I am currently doing in my drawing function: public void DrawGradient(int x, int y, Graphics g) { using (var ellipsePath = new GraphicsPath()) { var bounds = new Rectangle(x, y, 100, 100); ellipsePath.AddEllipse(bounds); var brush = new PathGradientBrush(ellipsePath); Color[] colors = { Color.FromArgb(64, 0, 0, 255), Color.FromArgb(140, 0, 255, 0), Color.FromArgb(216, 255, 255, 0), Color.FromArgb(255, 255, 0, 0) }; float[]