shape

Delphi - moving overlapping TShapes

心已入冬 提交于 2019-12-17 06:51:21
问题 I've needed own triangle shape so, I inherited my triangle class form TShape and override paint method. Everything works fine, but I need to move this shapes with mouse. I set the method for every shape handling onMouseDown event. Moving work also fine. But If two shapes overlaps (shapes are in fact rectangles with some transparent areas), that the top's shape transparent area is over another shape, then the top shape moves instead of the shape below. It's correct, that is how Delphi works.

Image/Graphic into a Shape

北城余情 提交于 2019-12-17 02:49:11
问题 I was wondering whether there is any way to convert an image/graphic into a Shape ? For example, can I convert the outline of a motorcycle shape into a Shape so I can then use it in Java? I know you can do it with normal squares or with rounded corners, polygons, etc. But is there a way to do a custom shape? 回答1: motorcycle.jpg motorcycle-03.png ImageOutline.java This code requires some patience (when running). import java.awt.*; import java.awt.image.BufferedImage; import java.awt.geom.Area;

How to create a resizable rectangle with user touch events on Android?

好久不见. 提交于 2019-12-17 02:42:09
问题 I want to create a rectangular shape that will be resized with the touches of the user. Below image is a good example of what i want to do: Is there any example like that? What do I need to study to implement this? Thanks in advance, 回答1: To implement a custom view, you derive a class from View :) Override onDraw() for looks, override onTouchEvent() for input processing. Note that in Android, you cannot draw on view outside onDraw() ; if you want to refresh the view, call invalidate() . You

How to create a resizable rectangle with user touch events on Android?

核能气质少年 提交于 2019-12-17 02:42:08
问题 I want to create a rectangular shape that will be resized with the touches of the user. Below image is a good example of what i want to do: Is there any example like that? What do I need to study to implement this? Thanks in advance, 回答1: To implement a custom view, you derive a class from View :) Override onDraw() for looks, override onTouchEvent() for input processing. Note that in Android, you cannot draw on view outside onDraw() ; if you want to refresh the view, call invalidate() . You

Draw cube vertices with fewest number of steps

依然范特西╮ 提交于 2019-12-14 04:22:23
问题 What's the fewest number of steps needed to draw all of the cube's vertices, without picking up the pen from the paper? So far I have reduced it to 16 steps: 0, 0, 0 0, 0, 1 0, 1, 1 1, 1, 1 1, 1, 0 0, 1, 0 0, 0, 0 1, 0, 0 1, 0, 1 0, 0, 1 0, 1, 1 0, 1, 0 1, 1, 0 1, 0, 0 1, 0, 1 1, 1, 1 I presume it can be reduced less than 16 steps as there are only 12 vertices to be drawn You can view a working example in three.js javascript here: http://jsfiddle.net/kmturley/5aeucehf/show/ 回答1: Well I

How to store and retrieve multiple shapes in XAML/WPF?

旧街凉风 提交于 2019-12-14 01:21:27
问题 Seem to be having a lot of problems doing what should be simple things with XAML / WPF - I have created some XAML-based images using shapes like Rectangle and Ellipse to create icons which I need other parts of my application to use - but I cannot seem to find out how to do this - I seem to be able to store a Canvas in the Resource Dictionary but no way of using it in any other Window. How is this done - these are simple images just two or three shapes I want to use throughout my project! The

How to set line as a background using xml (shape) below to EditText?

只谈情不闲聊 提交于 2019-12-13 14:36:19
问题 I want to set the line as background below EditText using shape xml but when I set it line set on center I want like below but when I set the shape below drawable/line.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:height="4dp" android:color="@color/crabfx_dark_gray" /> </shape> activity_main.xml <EditText android:id="@+id/edt" android:layout_width="match_parent" android:layout_height="wrap

How to create PictureBoxes with shapes based on a Picture

做~自己de王妃 提交于 2019-12-13 11:24:51
问题 Problem: I have pictures of objects on a white background. I need PictureBoxes that do have the exact shape of these objects, but I do not know how these objects look like a priori. 回答1: My solution to this is a new class: class ShapedPictureBox : PictureBox { public ShapedPictureBox() { } public Color transparentColor = Color.White; public void updateShape() { if(this.Image = null) return; Bitmap bitmap = new Bitmap(this.Image); System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System

Delphi, How to make a shape stop moving

心不动则不痛 提交于 2019-12-13 09:48:23
问题 I am trying to make a shape move towards onother using 2 shapes and 2 timer, but i really can't seem. I was thinking: At the beggining, I will make shape 1 calculate the distance of shape 2 and then move towards it, this is what i have done, i have also added comments to help you understand the code, because it is a little bit confusing: procedure TForm1.Timer1Timer(Sender: TObject); begin timer1.Interval:=100; //set interval=200 //begin if shape1.Left=shape2.Left then begin shape1.Left:

Trying to store many rectangles without duplicate areas efficiently in ruby

痞子三分冷 提交于 2019-12-13 08:59:13
问题 I'd like to store several rectangles in one variable in ruby. It's in order to add rectangles in which the screen must be refreshed. I tried it with a class Rectangle with top, left, height and with, and stored rectangle variables in an array. But it's much too slow when iterating over it and calculating with it. When adding a new rectangle, there shouldn't be any duplicates on the screen to refresh, and it shouldn't take much time to calculate in order to remove duplicates (no time in the