gradient

Android create iphone-like Gradient

本秂侑毒 提交于 2019-12-05 08:44:39
I need to create black iphone like gradient in my android application. Please view black gradient at the top in the image below. How to do it? Thanks Something like this, perhaps? <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FF000000" android:endColor="#FF8E8E8E" android:angle="270"/> </shape> I've posted a blog about an Iphone look an Android: http://www.dibbus.com/2011/06/android-gradient-toolbar/ You can find some examples of gradients and what is possible using xml and/or 9-pacth images. You can create gradients

Multi-color diagonal gradient in winforms [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-05 08:31:49
This question already has answers here : Multi-color linear gradient in WinForms (2 answers) Closed 3 years ago . I am trying to fill a rectangle with a multi-color diagonal gradient in winforms that looks like the following example: diagonal gradient I know this is a WPF example, but is it possible to get similar results in winforms? punker76 Here is a little example for you void MainFormPaint(object sender, PaintEventArgs e) { LinearGradientBrush br = new LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 0 , false); ColorBlend cb = new ColorBlend(); cb.Positions = new[] {0,

createRadialGradient and transparency

喜欢而已 提交于 2019-12-05 07:06:38
I'm playing around with createRadialGradient() on HTML5 canvas. It works like a charm, except when I'm trying to implement (semi-)transparency. I made this jsFiddle to make things hopefully clearer: http://jsfiddle.net/rfLf6/1/ . function circle(x, y, r, c) { ctx.beginPath(); var rad = ctx.createRadialGradient(x, y, 1, x, y, r); rad.addColorStop(0, c); rad.addColorStop(1, 'transparent'); ctx.fillStyle = rad; ctx.arc(x, y, r, 0, Math.PI*2, false); ctx.fill(); } ctx.fillRect(0, 0, 256, 256); circle(128, 128, 200, 'red'); circle(64, 64, 30, 'green'); What is happening is a circle (radial gradient

Tensorflow gradients: without automatic implicit sum

烈酒焚心 提交于 2019-12-05 04:57:20
In tensorflow, if one has two tensors x and y and one want to have the gradients of y with respect to x using tf.gradients(y,x) . Then what one actually gets is : gradient[n,m] = sum_ij d y[i,j]/ d x[n,m] There is a sum over the indices of y, is there a way to avoid this implicit sum? To get the whole gradient tensor gradient[i,j,n,m] ? Here is my work around just taking the derivative of each component (as also mentionned by @Yaroslav) and then packing them all together again in the case of rank 2 tensors (Matrices): import tensorflow as tf def twodtensor2list(tensor,m,n): s = [[tf.slice

creating gradient stroke using layer-list

左心房为你撑大大i 提交于 2019-12-05 01:40:35
问题 I am trying to use layer-list to create a gradient stroke (i.e. perimeter/border) as the background of my view. But it's not working. Here is my code <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <gradient android:angle="270" android:centerColor="#FFFFFFFF" android:endColor="#FFCCCCCC" android:startColor="#FFCCCCCC" android:type="linear" /> </shape> </item> <item> <shape android:shape=

Angled Gradient Layer

╄→尐↘猪︶ㄣ 提交于 2019-12-04 23:28:40
问题 I have custom UIView class that renders a gradient in Swift 2. I'm struggling with making an angled gradient so that it draws from the top-left to the bottom-right. Can somebody help me a bit? import UIKit class GradientView: UIView { let gradientLayer = CAGradientLayer() override func awakeFromNib() { // 1 self.backgroundColor = ColorPalette.White // 2 gradientLayer.frame = self.bounds // 3 let color1 = ColorPalette.GrdTop.CGColor as CGColorRef let color2 = ColorPalette.GrdBottom.CGColor as

android image gradient

﹥>﹥吖頭↗ 提交于 2019-12-04 22:55:17
I want to create a "glow" effect on top of an image. On dark it's almost working, but on bright images you can see a gray rectangle on image, as seen in below image: Here is my code: public static Bitmap drawModifiedImage(Bitmap bitmap) { Canvas bigCanvas = new Canvas(bitmap); Bitmap b = Bitmap.createBitmap(bitmap.getWidth(), 20, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); c.drawColor(Color.TRANSPARENT); LinearGradient grad = new LinearGradient(bitmap.getWidth()/2, 0, bitmap.getWidth()/2, 20, Color.WHITE, Color.TRANSPARENT, Shader.TileMode.CLAMP); Paint p = new Paint(); p.setStyle

Gradient in continuous regression using a neural network

独自空忆成欢 提交于 2019-12-04 22:11:22
问题 I'm trying to implement a regression NN that has 3 layers (1 input, 1 hidden and 1 output layer with a continuous result). As a basis I took a classification NN from coursera.org class, but changed the cost function and gradient calculation so as to fit a regression problem (and not a classification one): My nnCostFunction now is: function [J grad] = nnCostFunctionLinear(nn_params, ... input_layer_size, ... hidden_layer_size, ... num_labels, ... X, y, lambda) Theta1 = reshape(nn_params(1

java: How to add Transparent Gradient Background to JFrame

瘦欲@ 提交于 2019-12-04 20:18:32
java: I want to use the Gradient style Transparent Background to JFrame. On the top the transparency should be 100% but when going down it should go on decreasing and at the bottom it should be 20% I know i can use the images already having such effect but i want to provide the themes facility and allowing user to use their favorite images but allow transparency at the run time. Sun added support for translucent backgrounds to java in 6u10 but it is not formally described in the API. In Java 7 the functionality was formally added to the API via the setBackground(), setOpacity(), and setShape()

ggplot2 Color Scale Over Affected by Outliers

萝らか妹 提交于 2019-12-04 17:48:12
问题 I'm having difficulty with a few outliers making the color scale useless. My data has a Length variable that is based in a range, but will usually have a few much larger values. The below example data has 95 values between 500 and 1500, and 5 values over 50,000. The resulting color legends tend to use 10k, 20k, ... 70k for the color changes when I want to see color changes between 500 and 1500. Really, anything over around 1300 should be the same solid color (probably median +/- mad), but I