shape

How to draw filled triangle on android Canvas

跟風遠走 提交于 2019-11-28 09:03:22
I have class MyView that extends View class. MyView should draw filled triangle. I drew a triangle but I cannot get it filled. This is my onDraw() method: @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(android.graphics.Color.BLACK); canvas.drawPaint(paint); paint.setStrokeWidth(4); paint.setColor(android.graphics.Color.RED); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); Point a = new Point(0, 0); Point b = new Point(0, 100); Point c = new Point(87, 50); Path path = new Path(); path.setFillType(FillType

Shape Transformers and Interfaces OpenCV3.0

北城余情 提交于 2019-11-28 06:16:29
问题 I was trying to make use of the new Shape Transformers and Interfaces of OpenCV3.0. Unfortunately it doesn't work as expected. To ensure not making any fancy warps and getting strange results cause of that reason I initialized a transformation where nothing at all should happen. But output of the transformation for a testpoint is always [0,0] and the warped image is always completley gray. Any suggestions what could be wrong are welcome. int main(void){ Mat img1 = imread("C:\\opencv\\sources\

Android: How can i use the layer-list and shape elements to draw a horizontal rule when set as background?

对着背影说爱祢 提交于 2019-11-28 05:44:34
I want to set the background of a Relative or LinearLayout to a custom drawable. I want the shape to draw two horizontal lines across the bottom, leaving the central part transparent (empty). The following draws the horizontal lines centered vertically, where as i need them to be aligned to the bottom of the shape. (If you add a rectangle as an item you can see the shape expands to the dimenstions of the parent, but the lines are still centrally aligned). <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape=

Android ring shape for radio button

你说的曾经没有我的故事 提交于 2019-11-28 04:20:36
问题 I need to create 2 ring shapes for my radio buttons: white circle white circle with another circle inside it with a different color I dont have much clue on how to do this. What I tried so far: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false"><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring"> <android:solid android:color="@color/white" /> <android:size android

I need to change the stroke color to a user defined color. Nothing to do with the state

耗尽温柔 提交于 2019-11-28 03:33:00
I need to change the stroke color from the app. The user is able to change the background color so I need to also let them change the stroke (outline) of the button. As its is already set in the drawable (sample below) I have not found a way to change this. Seems like all of the other questions like this just said to use the XML file.... but that doesnt let me make it dynamic. Thank you for any help! I need to change the stroke color to a user defined color. Nothing to do with the state. <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">

Convert Shape into reusable Geometry in WPF

房东的猫 提交于 2019-11-28 02:06:16
I am trying to convert a System.Windows.Shapes.Shape object into a System.Windows.Media.Geometry object. With the Geometry object, I am going to render it multiple times with a custom graph control depending on a set of data points. This requires that each instance of the Geometry object has a unique TranslateTransform object. Now, I am approaching the issue in two different ways, but neither seems to be working correctly. My custom control uses the following code in order to draw the geometry: //Create an instance of the geometry the shape uses. Geometry geo = DataPointShape.RenderedGeometry

JFrame the same shape as an Image / Program running in background

左心房为你撑大大i 提交于 2019-11-28 00:27:43
My question is simple, the solution surely not. I am looking for a way to shape a JFrame the same as an Image it will be displaying. By shape I mean the shape of the pixels that have an alpha != 0. I've already found a working example using a GeneralPath object, but it created ~110000 "nodes" for an Image of about 500*400, so starting the JFrame took more than 2 minutes, which is definitely not the desired effect, the startup should be in under 2 seconds. Thanks for your time. I personally would ditch the window shape in favor of a transparent window, it's just simpler for what you are trying

determine if a point sits inside an arbitrary shape?

假装没事ソ 提交于 2019-11-27 22:01:06
Given a point's coordinates, how can I determine if it is within an arbitrary shape? The shape is defined by an array of points, I do not know where the shape is 'closed', the part I really need help is to work out where the shape is closed. Here's an image to illustrate what I mean a little better: Easiest way to do it is cast a ray from that point and count how many times it crosses the boundary. If it is odd, the point is inside, even the point is outside. Wiki: http://en.wikipedia.org/wiki/Point_in_polygon Note that this only works for manifold shapes. If you want to determine whether or

How to get round shape in Android [duplicate]

对着背影说爱祢 提交于 2019-11-27 18:05:41
This question already has an answer here: How to define a circle shape in an Android xml drawable file? 14 answers How would I achieve a round shape in Android, like below, through an Android shape drawable: You need to create a shape drawable in the drawable folder that looks something like: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF" android:angle="270"/> </shape> (For this example I have saved the drawable as circle.xml and it will have a

Performance wise, what is typically better, using an image or a xml created shape as a drawable?

天大地大妈咪最大 提交于 2019-11-27 17:50:52
问题 For example, if each row in a list had a background that was a gradient, would it be better to use a image of a gradient or to define that gradient in a shape drawable in xml? Is there is significant performance difference between the two methods? 回答1: I just asked a similar question and it sounded like that using an image drawable is more efficient computationally than using a vector.(but i'm not expert so don't quote me on that) It really depends on what your trying to set out to achieve in