shapes

Create shape for drawable

谁说我不能喝 提交于 2019-12-12 10:08:11
问题 I have ListView , and i have a background for the list items: Is there any way to recreate this background as a shape in drawable XML? The most outer grey is not part of the item background, it is actually the ListView . 回答1: You can try following with the values of your choice. It will make the bottom two corners rounded. rounded_rectangle.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <gradient android:angle=

Drawing a diamond with Polygon on the end of a Line2D

别说谁变了你拦得住时间么 提交于 2019-12-12 06:36:38
问题 I'm trying to draw a diamond (for a composition UML relationship). Right now, I am making a triangle like this: but I want to make something like this: And I do the triangle with this code: private void drawArrowHead(Graphics2D g2, Point tip, Point tail, Color color) { g2.setPaint(color); double dy = tip.y - tail.y; double dx = tip.x - tail.x; double theta = Math.atan2(dy, dx); double x, y, rho = theta + phi; Point p1 = new Point(); Point p2 = new Point(); p1.setLocation(tip.x - barb * Math

Can you return the color of a rectangle object in java?

喜欢而已 提交于 2019-12-12 03:48:23
问题 For example, I create a rectangle object and set its fill to black. Would I be able to check the fill color of the rectangle to determine if its white or black? Something like: Rectangle r = new Rectangle(10.0, 10.0, 10.0, 10.0); if (r.getFill == 'BLACK') { r.setFill(Color.'PURPLE'); } 回答1: The getFill() method returns a Paint object. Therefore, you should use equals for comparison: Rectangle r = new Rectangle(1.0, 1.0, Color.WHITE); if (r.getFill().equals(Color.WHITE)) { System.out.println(

Draw section of shape with EaselJS

試著忘記壹切 提交于 2019-12-12 02:19:27
问题 I have been trying to find out if it is possible to draw only a section of a shape using EaselJS. For example, is it possible to create a Rounded Rectangle, but only draw the top two thirds of it? (Effectively not displaying the bottom third). Thank you in advance for any advice you may have! 回答1: What is the end goal? Depending on what you want to do, there are a few ways to do it: Mask it using another shape to crop it Cache it to the size you want http://jsfiddle.net/lannymcnie/f1zh3qwx/ /

How to design shape class

為{幸葍}努か 提交于 2019-12-12 01:34:41
问题 I want to design shape class. I need to distinguish several different shapes: -Point -Line -Triangle -Circle -Polygons The main purpose of this class is to calculate distance between two shapes. I've all methods for calculating those distances, but I want to have a single method that can be used, it should looks like this: float Distance(Shape a, Shape b) Simplest way to do it is to put a lot of if statements and then invoke proper method but this is deffinitely not OOP. How to design such

Change Shape color in a loop VBA PPT

孤街浪徒 提交于 2019-12-11 10:35:11
问题 I need to change Colors of certain Shapes in a slide, based on the criteria if the shape is an EndConnectedShape of certain Connectors (the connectors are selected based on some data in a .txt file, but the data input part works fine). Although it must be straightforward, the part where I try to get the Shape by its Name is still not working: Sub test() Dim oFSO As FileSystemObject Set oFSO = New FileSystemObject Dim oFS As TextStream Dim i, j As Long Dim filePath, smth As String filePath =

resizing a substraction shape

随声附和 提交于 2019-12-11 07:44:03
问题 I would like to resize the below created shape. but cannot get it. The project is to create a transparent rectangle to show only a part of the desktop, and hide the rest. The transparent zone is the result of a substraction, and I need to make it resizable by the user. I tryed several ways, such as adapting from this : https://gist.github.com/jewelsea/1441960 But couldn't get it. Here is my code : @Override public void start(Stage stage) { Group group = new Group(); Rectangle rect = new

How to make “compound” shapes in pymunk?

喜夏-厌秋 提交于 2019-12-11 03:36:03
问题 As the title says, How can I join/constraint 2 pymunk bodies/shapes so that they don't they act as one single object?? For example, in this case, I have a cricket bat, made up of 2 separate bodies and polys. I want to join the bat's "handle" to my bat's "blade", So that I get a bat-like object. My code: ### BAT n Co. ### # body format: [vertices, offset, position, mass] bat_bodies_v = [ # bat [[[0, 34], [4, 34], [4, 0], [0, 0]],(-2,-20),(103,190),20], # handle [[[6, 90] , [0, 32] , [0, 17],

Creating shapes with CSS

泪湿孤枕 提交于 2019-12-11 03:29:18
问题 At my website i want to make a speech bubble and found a great tutorial for doing so. But i want to do some changes, but i dont know how to. Basicly i want to flip the little triangle horizontally, so its vertical on the right side instead of the left. Here is the CSS: .bubble { margin-top: 100px; position: relative; width: 200px; height: 100px; text-align: center; line-height: 100px; background-color: #fff; border: 8px solid #666; -webkit-border-radius: 30px; -moz-border-radius: 30px; border