alpha

Resize PNG image without losing color data from fully transparent pixels

做~自己de王妃 提交于 2019-12-11 01:02:23
问题 I've been trying to figure out a way to resize a PNG image without losing color data from pixels that are completely transparent. Here is the code that I'm using to achieve this: //sourceImage is also a bitmap read in earlier using (var scaledBitmap = new Bitmap(desiredWidth, desiredHeight, PixelFormat.Format32bppArgb)){ using (var g = Graphics.FromImage(scaledBitmap)){ var attr = new ImageAttributes(); attr.SetWrapMode(WrapMode.TileFlipXY); g.CompositingQuality = CompositingQuality

Android fade in not working

痞子三分冷 提交于 2019-12-10 22:27:09
问题 android newb here. I got fade out animations to work but not fade in animations. What is wrong with it? This method is called after a fade out method. The way the fade out works is by fading the view out and then making it gone. Doing the opposite in my fadeInLogin method seems not to work. Also I call fadeInLogin with a delay after the fadeOut so I don't think that these animations are interfering with each other although it is possible. view1.animate() .alpha(0f)//Fades buttons .setDuration

Android - getAlpha() from Animated View

不想你离开。 提交于 2019-12-10 21:18:22
问题 I have an animation like this: Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setInterpolator(new DecelerateInterpolator()); fadeOut.setDuration(350); myView.startAnimation(fadeOut); I am trying is to get its Alpha durring the Animation as such: System.out.println(myView.getAlpha()); However, it always returns "1.0" throughout the animation. How can I obtain the actual alpha value of myView during the animation process? 回答1: By using Transformation with your AlphaAnimation , you may be

PyQt: Create QPixmap with alpha channel and not premultiplied color channels

纵然是瞬间 提交于 2019-12-10 20:06:10
问题 I would like to create a QPixmap to draw on using a QPainter. The QPixmap should support transparency without using premultiplied color channels. Currently I do this by creating a QPixmap with the desired dimensions and filling it with a QColor that has been set to zero for each channel (including alpha). tex = QtGui.QPixmap(width, height) c = QtGui.QColor(0) c.setAlpha(0) tex.fill(c) This adds transparency to the QPixmap. However, if I draw to the QPixmap using a QPainter, the drawn color

OpenCV: load image with alpha channel but 8bit depth

核能气质少年 提交于 2019-12-10 19:11:27
问题 I am getting a bit confused with the flags that cv::imread takes. My goal is to load images that have an alpha channel with this alpha channel (i.e. as CV_8UC4 ). At the same time I want to load them always with a depth of 8bit. First of all I tried using the following: cv::imread(/*path*/, cv::IMREAD_COLOR); This strips the alpha channel and returns an 8bit image. For transparent TIFs everything looks kind of right, just the transparent parts are black. For transparent PNGs, hovever, it

in three.js, alpha channel works inconsistently

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 18:32:03
问题 I'm building a "paper cutout" world in three.js. All my models are simple "planes," and I texture them with PNGs that have alpha channels to trim the plane to a more pleasing shape. The strange thing: the transparency appears and disappears unpredictably, based on the position of the plane and the position of the camera. Symptom 1: if the plane is partially below the ground plane, transparency works, but if I move it above the ground plane the transparent area fills with white. Symptom 2:

Semi-Transparent TextureViews not working

这一生的挚爱 提交于 2019-12-10 17:28:58
问题 I cannot change the transparency of a TextureView by setAlpha method to maske it semi-transparent as it is promised by the android SDK. For example mTextureView.setAlpha(0.5f) does not have any effect. 回答1: You need to make sure and setOpaque(false). From the docs: public void setOpaque (boolean opaque) Added in API level 14 Indicates whether the content of this TextureView is opaque. The content is assumed to be opaque by default. 回答2: The solution I used to make it happen was to wrap the

TextBlock brush giving incorrect color

北城余情 提交于 2019-12-10 13:39:33
问题 I have a TextBlock and a Rectangle, both sitting in an empty WPF4 window. The TextBlock's Foreground and the Rectangle's Fill are both set to a SolidColorBrush with value #80800000. This is what it looks like: The Rectangle's color is correct (a 50% transparent maroon) but the TextBlock gives a flat grey. What's going on? EDIT: Here's the XAML: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com

How can i find out where a BufferedImage has Alpha in Java?

蓝咒 提交于 2019-12-10 13:36:09
问题 I've got a BuferredImage and a boolean[][] array. I want to set the array to true where the image is completely transparant. Something like: for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { alphaArray[x][y] = bufferedImage.getAlpha(x, y) == 0; } } But the getAlpha(x, y) method does not exist, and I did not find anything else I can use. There is a getRGB(x, y) method, but I'm not sure if it contains the alpha value or how to extract it. Can anyone help me? Thank you! 回答1:

How to add shadow to a transparent UIView?

旧街凉风 提交于 2019-12-10 13:17:47
问题 How can I reproduce this shadowing? My problem, that if I use high alpha color or clearColor, there is no drop shadow, if I use low alpha color, I can't see the drop shadow under the plate. As the level of the volume is changing (colorful part) the shadow is moving also, so it is not pure Photoshop. 回答1: try something using thoses properies of your view. it might end up with something view.layer.shadowColor = [UIColor colorWithWhite:.5 alpha:1].CGColor; view.layer.shadowRadius = 4.0f; view