shape

How to set a shape's background in xml?

拥有回忆 提交于 2019-12-04 23:37:46
I just created a red circle using android shapes: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadiusRatio="4" android:shape="ring" android:thicknessRatio="9" android:useLevel="false" > <solid android:color="#FF0000" /> <size android:height="48dip" android:width="48dip" /> </shape> This is really cool, but I cannot set the background color of the circle to my color. I tried android:background="#FFFFFF" but it always appear to be black in my layout. How can I set the background of the above shape? I think a layer-list

Computing the circularity of a binary image

為{幸葍}努か 提交于 2019-12-04 23:17:29
问题 I am trying to compute the circularity of a given binary image. After some research its clear to me that the formula for circularity is 4π*area/perimeter^2 Which should range from 0 to 1, 1 being most circular. Given the binary matrix im Computing the area is trivial area = sum(im) I am computing the perimeter following this rule: A pixel is part of the perimeter if it is nonzero and it is connected to at least one zero-valued pixel per = matrix(0, nrow(im), ncol(im)) for(i in 2:(nrow(im)-1))

How to change stroke color dynamically?

南楼画角 提交于 2019-12-04 22:32:08
问题 (Sorry for my language, I'm french) I need to change the stroke color of a Shape. I've the same problem described here. I need to change solid color when the EditText is not correct. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius=

WPF User Control - Round corners programmatically

你。 提交于 2019-12-04 21:10:55
Another WPF question... <UserControl x:Class="TKEApp.Components.UserControls.ButtonControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid Background="Black"> <TextBlock Foreground="White" Background="Brown" Name="lblCaption" TextAlignment="Center"></TextBlock> </Grid> </UserControl> Somwhere in the application code I have an instance of this control and I need to make it's corners rounded programmatically. Is this possible? You need to use a Border to provide rounded corners, so you could do something like this:

How to change the color of TextView at runtime with shape attribute on Android?

我们两清 提交于 2019-12-04 19:41:58
I'm using shape attribute like this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF" /> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp" /> </shape> and <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/rounded_textview"> </TextView> If I change the color at runtime with the following method: TextView

FabricJS image object clipTo shape object issue

断了今生、忘了曾经 提交于 2019-12-04 18:55:42
Why this clipTo method doesn't work on the latest fabricjs version, which you could resize the object container and the image inside it. Also you able to move the container object and image object. var imgInstance = new fabric.Image(img, { width: instanceWidth, height: instanceHeight, top: (canvas.getHeight() / 2 - instanceHeight / 2), left: (canvas.getWidth() / 2 - instanceWidth / 2), originX: 'left', originY: 'top' }); canvas.add(imgInstance); imgInstance.clipTo = function(ctx) { /* image clipping method doesn't work on latest fabricjs version*/ ctx.save(); ctx.setTransform(1, 0, 0, 1, 0, 0)

How to improve Canvas rendering performance?

半城伤御伤魂 提交于 2019-12-04 18:52:40
问题 I have to draw a lot of Shape (about 1/2 hundred thousand) as [Canvas][2]'s childrens. I make this in my WPF application dividing work in two parts: first thing I create shapes by setting the properties of each of them (like Margin, Fill, Width, etc...), after I add shapes as Canvas's children. MyCanvas.Children.Add(MyShape) Now i want to improve the performance of the second part, because when i draw the shapes my application is blocked for a long period of time. So i tried to use the

Cutting irregular shape on image

三世轮回 提交于 2019-12-04 18:05:12
I am trying to cut an image into a particular shape using the canvas clip() method. I have followed the following steps to do so: Draw a rectangle. Draw semi circles on each side. The right and bottom semi circles protrude outwards and the left and top semi circles are inwards. The code snippet is provided below: var canvasNode = this.hasNode(); var ctx = canvasNode && canvasNode.getContext('2d'); var image = new Image(); image.onload = function() { ctx.drawImage(image, 0, 0, 512, 384); }; image.src = "images/image.png"; var startX = 200; var startY = 0; var rectWidth = 150; var rectHeight =

Interesting CSS shape navigation (chevrons)

一个人想着一个人 提交于 2019-12-04 14:43:42
问题 I'm building a fairly interestingly shaped navigation for a site at the moment. The shape each menu item needs to be is illustrated below: The final nav will look like an extended version of this: I thought it would be an interesting experiment to do these shapes in CSS. The CSS and HTML for one of the arrow shapes is here: .arrowEndOn { font-size: 10px; line-height: 0%; width: 0px; border-top: 11px solid #FFFFFF; border-bottom: 11px solid #FFFFFF; border-left: 5px solid transparent; border