alphablending

Antialiased text on transparent bitmap

空扰寡人 提交于 2019-11-27 15:09:28
I'd like to draw antialiased text on a transparent bitmap and have the antialiasing drawn as alpha blended pixels. This way, I can draw the bitmap onto any color surface (or an image, for that matter) and the antialiasing still looks fine. Here is a simplified sample showing the problem: protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Bitmap bitmap = new Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(bitmap); g.Clear(Color.Empty); g.DrawString("hello world", new Font(this.Font.FontFamily, 24), Brushes.Blue, new Point(50, 50)); e.Graphics.DrawImage(bitmap,

What do the blend modes in pygame mean?

…衆ロ難τιáo~ 提交于 2019-11-27 15:03:47
问题 Surface.blit has a new parameter in 1.8: blend. The following values are defined: BLEND_ADD BLEND_SUB BLEND_MULT BLEND_MIN BLEND_MAX BLEND_RGBA_ADD BLEND_RGBA_SUB BLEND_RGBA_MULT BLEND_RGBA_MIN BLEND_RGBA_MAX BLEND_RGB_ADD BLEND_RGB_SUB BLEND_RGB_MULT BLEND_RGB_MIN BLEND_RGB_MAX Can someone explain what these modes mean? 回答1: You can find the source for the blend operations here: surface.h Basically, ADD adds the two source pixels and clips the result at 255. SUB subtracts the two pixels and

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

家住魔仙堡 提交于 2019-11-27 10:30:52
问题 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"

opengl - blending with previous contents of framebuffer

邮差的信 提交于 2019-11-27 10:02: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.

Antialiased text on transparent bitmap

旧时模样 提交于 2019-11-27 04:06:26
问题 I'd like to draw antialiased text on a transparent bitmap and have the antialiasing drawn as alpha blended pixels. This way, I can draw the bitmap onto any color surface (or an image, for that matter) and the antialiasing still looks fine. Here is a simplified sample showing the problem: protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Bitmap bitmap = new Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(bitmap); g.Clear(Color.Empty); g.DrawString("hello

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

Creating a transparent window in C++ Win32

断了今生、忘了曾经 提交于 2019-11-26 23:56:05
I'm creating what should be a very simple Win32 C++ app who's sole purpose it to ONLY display a semi-transparent PNG. The window shouldn't have any chrome, and all the opacity should be controlled in the PNG itself. My problem is that the window doesn't repaint when the content under the window changes, so the transparent areas of the PNG are "stuck" with what was under the window when the application was initially started. Here's the line where I setup the new window: hWnd = CreateWindowEx(WS_EX_TOPMOST, szWindowClass, szTitle, WS_POPUP, 0, height/2 - 20, 40, 102, NULL, NULL, hInstance, 0);

How to calculate an RGB colour by specifying an alpha blending amount?

随声附和 提交于 2019-11-26 19:27:07
I'm writing a colour picker that gets the pixel RGB values from wherever you point to on the screen. I want to also have the option of specifying that the colour I picked already has an alpha value. I'm just wondering how I can calculate the resulting colour. For example: The resulting pixel colour is 240,247,249 but I know that the original colour had a 10% opacity and was on top of a white (255,255,255) background. What's the calculation to work out the original RGB values? The standard blending equation is: out = alpha * new + (1 - alpha) * old Where out , new and old are RGB colors, and

Multiple transparent textures on the same mesh face in Three.js

百般思念 提交于 2019-11-26 18:22:16
Is it possible to lay multiple textures on top of each other on the same face in Three.js so that the alpha blending is done GPU accelerated in webGL? The textures are (or should be) applied to the same face so that the bottom texture (texture 1) is without alpha channel and the above textures are alpha channeled in a way like texture 2 in the below image example. This blending can be achieved using HTML5 Canvas as pre-step, but because texture bitmaps can be huge, I prefer to skip Canvas blending operations. I tested by creating a copy of the mesh and applying one texture per mesh and made

blend two uiimages based on alpha/transparency of top image

一世执手 提交于 2019-11-26 18:21:42
I'm trying to blend a background with a foreground image, where the foreground image is a transparent image with lines on it. I am trying to do it this way. UIGraphicsBeginImageContext(CGSizeMake(320, 480)); CGContextRef context = UIGraphicsGetCurrentContext(); // create rect that fills screen CGRect bounds = CGRectMake( 0,0, 320, 480); // This is my bkgnd image CGContextDrawImage(context, bounds, [UIImage imageNamed:@"bkgnd.jpg"].CGImage); CGContextSetBlendMode(context, kCGBlendModeSourceIn); // This is my image to blend in CGContextDrawImage(context, bounds, [UIImage imageNamed:@"over.png"]