alpha

How to set the opacity/alpha of a UIImage?

只谈情不闲聊 提交于 2019-11-26 18:28:38
I know you can do this with a UIImageView, but can it be done to a UIImage? I want to have the animation images array property of a UIImageView to be an array of the same image but with different opacities. Thoughts? I just needed to do this, but thought Steven's solution would be slow. This should hopefully use graphics HW. Create a category on UIImage: - (UIImage *)imageByApplyingAlpha:(CGFloat) alpha { UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGRect area = CGRectMake(0, 0, self.size.width, self.size.height);

SVG fill color transparency / alpha?

拥有回忆 提交于 2019-11-26 17:55:24
问题 Is it possible to set a transparency or alpha level on SVG fill colours? I've tried adding two values to the fill tag (changing it from fill="#044B94" to fill="#044B9466"), but this doesn't work. 回答1: You use an addtional attribute; fill-opacity : This attribute takes a decimal number between 0.0 and 1.0, inclusive; where 0.0 is completely transparent. For example: <rect ... fill="#044B94" fill-opacity="0.4"/> Additionally you have the following: stroke-opacity attribute for the stroke

Android and setting alpha for (image) view alpha

房东的猫 提交于 2019-11-26 17:27:38
问题 Is there really no XML attribute counterpart to setAlpha(int) ? If not, what alternatives are there? 回答1: No, there is not, see how the "Related XML Attributes" section is missing in the ImageView.setAlpha(int) documentation. The alternative is to use View.setAlpha(float) whose XML counterpart is android:alpha . It takes a range of 0.0 to 1.0 instead of 0 to 255. Use it e.g. like <ImageView android:alpha="0.4"> However, the latter in available only since API level 11. 回答2: It's easier than

Merging two images

萝らか妹 提交于 2019-11-26 14:53:32
I need to merge two images (BufferedImage) in Java. It wouldn't be a problem if there was no transparency. The base image already has some transparency. I want to keep this as it is and apply a "mask" to it, the second image. This second image has no opaque pixels, in fact it's almost completely transparent, just has some less transparent pixels to give some sort of "light effect", like a reflex. Important detail: I don't want to do this on screen, with graphics, I need to obtain a BufferedImage with the resultant merge. Can anyone help me? Thanks! DETAILS: Merge two images maintaining

Transparency for windows forms textbox

孤街醉人 提交于 2019-11-26 13:48:44
I'm using windows forms in C# and I need to make a textbox's background color transparent. I have a trackbar that goes from 0 to 255 that is supposed to control it, but I'm having some trouble. I created a question earlier today asking the exact same thing, but no success. Here is the code I currently have: private void trackAlpha_ValueChanged(object sender, EventArgs e) { newColor = Color.FromArgb(trackAlpha.Value, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B); colorDialog.Color = newColor; // The Windows dialog used to pick the colors colorPreview.BackColor = newColor; //

Set BufferedImage alpha mask in Java

喜夏-厌秋 提交于 2019-11-26 12:24:44
问题 I have two BufferedImages I loaded in from pngs. The first contains an image, the second an alpha mask for the image. I want to create a combined image from the two, by applying the alpha mask. My google-fu fails me. I know how to load/save the images, I just need the bit where I go from two BufferedImages to one BufferedImage with the right alpha channel. 回答1: Your solution could be improved by fetching the RGB data more than one pixel at a time(see http://java.sun.com/javase/6/docs/api/java

How to change the opacity (alpha, transparency) of an element in a canvas element after it has been drawn?

人盡茶涼 提交于 2019-11-26 12:17:53
问题 Using the HTML5 <canvas> element, I would like to load an image file (PNG, JPEG, etc.), draw it to the canvas completely transparently, and then fade it in. I have figured out how to load the image and draw it to the canvas, but I don\'t know how to change its opacity once it as been drawn. Here\'s the code I have so far: var canvas = document.getElementById(\'myCanvas\'); if (canvas.getContext) { var c = canvas.getContext(\'2d\'); c.globalAlpha = 0; var img = new Image(); img.onload =

ios overlaying alpha channel video on another video

老子叫甜甜 提交于 2019-11-26 11:39:43
问题 I have been trying to create a video template which uses alpha channel video overlayed on the mp4 videos and images. This is how I need to create a video http://viewptch.ptchcdn.com/rendered/52b28a9f8d4f980f3a3f99c3_cb44bf2b/52b28a9f8d4f980f3a3f99c3_lrg_main_main.mov For overlaying alpha video on another videos, I have used AVAnimator, I was succeeded for playing a preview using AVFoundation, AVSynchronizedLayer and AVAnimator. When rendering video from composition, frames of alpha channel

Transparent background with three.js

青春壹個敷衍的年華 提交于 2019-11-26 09:18:00
问题 The code work, but I\'m having a problem setting transparent background to the canvas with three.js. I use: Background.renderer.setClearColor(0xffffff, 0); But then the background gets black. How do I change it to be transparent? The code: var camera, scene, renderer; var mouseX = 0, mouseY = 0; var p; var windowHalfX = site.Width / 2; var windowHalfY = site.Height / 2; Background.camera = new THREE.PerspectiveCamera( 35, site.Width / site.Height, 1, 2000 ); Background.camera.position.z = 300

Transparency for windows forms textbox

假如想象 提交于 2019-11-26 08:51:19
问题 I\'m using windows forms in C# and I need to make a textbox\'s background color transparent. I have a trackbar that goes from 0 to 255 that is supposed to control it, but I\'m having some trouble. I created a question earlier today asking the exact same thing, but no success. Here is the code I currently have: private void trackAlpha_ValueChanged(object sender, EventArgs e) { newColor = Color.FromArgb(trackAlpha.Value, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B);