drawing

Why do I get a different behviour in Codename One simulator than on a real Android device?

半城伤御伤魂 提交于 2019-12-18 05:16:16
问题 I am trying to figure out why I get a different behaviour in the simulator (iPhone, Nexus, Nexus5, ... skins ) VS on an Android real device with the following code (my goal is to draw a text over a background image and save the whole in background image resolution) : Please note that the GUI was done with the Designer. protected void beforeMain(Form f) { // The drawing label will contain the whole photo montage f.setLayout(new LayeredLayout()); final Label drawing = new Label(); f

How to do freehand drawing in Google Maps on iOS?

霸气de小男生 提交于 2019-12-18 05:04:40
问题 In drawing application we can identify when the user is starting to draw and moving the finger to make a line/shape. I'm trying to do the same on a map, how can I do this? 回答1: Basic steps will involve: 1) Add a overlay view whenever user starts to draw. lazy var canvasView:CanvasView = { var overlayView = CanvasView(frame: self.googleMapView.frame) overlayView.isUserInteractionEnabled = true overlayView.delegate = self return overlayView }() @IBAction func drawActn(_ sender: AnyObject?) {

Core Animation or OpenGL ES?

无人久伴 提交于 2019-12-18 05:04:29
问题 I want to do the following: Tap the screen and draw 3 cricles around the the tapped point. Is it better to do this with Core Animation or OpenGL ES? Where do I start? 回答1: As mentioned, the Core Graphics framework is probably what you want. A good way to go about it would be to subclass UIView, then override the two methods drawRect: and touchesEnded:withEvent: . When a touch event ends on the UIView, you can get the point of the last touch from the event passed to touchesEnded:withEvent: ,

Draw Beautiful Speech Bubbles in Swing [closed]

為{幸葍}努か 提交于 2019-12-18 04:26:14
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am trying to create beautiful speech bubbles in swing but the result is not very good...I mean I want something better and more beautiful! here is the code i'm using: import javax.swing.*; import java.awt.*; import java.awt.geom.Area; import java.awt.geom.RoundRectangle2D; public class BubbleTest

Draw a parallel line

情到浓时终转凉″ 提交于 2019-12-17 22:34:21
问题 I have x1,y1 and x2,y2 which forms a line segment. How can I get another line x3,y3 - x4,y4 which is parallel to the first line as in the picture. I can simply add n to x1 and x2 to get a parallel line but it is not what i wanted. I want the lines to be as parallel in the picture. 回答1: What you want to do is to offset the coordinates in the orthogonal direction. If you know vector math, multiply the vector created by the distance between the endpoints of the line by the following matrix: [ 0

WHERE to find Android “Fingerpaint” demo? (Android Studio era)

冷暖自知 提交于 2019-12-17 22:01:06
问题 Many, many Android discussions focus on the (apparently, famous) Fingerpaint sample: https://stackoverflow.com/a/16650524/294884 Where do I get it, to use with Android Studio? .. 2014 http://developer.android.com/samples/index.html Or is it now just completely out of date and legacy? Thanks for any info Android Studio: it has NO folders, samples/ or the like............ There's a possibility the beloved SDK Manager, on Mac - Studio, could help? Would I have to go with the API11 folder? The

Stretching an UIImage while preserving the corners

白昼怎懂夜的黑 提交于 2019-12-17 21:49:33
问题 I'm trying to stretch a navigation arrow image while preserving the edges so that the middle stretches and the ends are fixed. Here is the image that I'm trying to stretch: The following iOS 5 code allows the image when resized to stretch the center portions of the image defined by the UIEdgeInsets. [[UIImage imageNamed:@"arrow.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(15, 7, 15, 15)]; This results in an image that looks like this (if the image's frame is set to 70 pixels wide): This

Punch a hole in a rectangle overlay with HW acceleration enabled on View

ぐ巨炮叔叔 提交于 2019-12-17 21:45:47
问题 I have a view which does some basic drawing. After this I want to draw a rectangle with a hole punched in so that only a region of the previous drawing is visible. And I'd like to do this with hardware acceleration enabled for my view for best performance. Currently I have two methods that work, but only works when disabled hardware acceleration and the other is too slow. Method 1: SW Acceleration (Slow) final int saveCount = canvas.save(); // Clip out a circle. circle.reset(); circle

OpenGL GL_POLYGON concave polygon doesn't color in

我是研究僧i 提交于 2019-12-17 21:31:07
问题 I have a problem when I try to use Polygon in OpenGL. I don't know how to explain this but all my vertices are connected with the beginning one. The problem happens when I try to color the object. I want to draw a simple object. void TOP (float x1, float y1, float x2, float h,float n) { float r = x2-x1; if(n==1){glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);} // FOR FILL OR NO FILL OBJECT glBegin(GL_POLYGON); glVertex2f(x1,y1); glVertex2f(x2,y1); glVertex2f(x2,y1+h/7); y1=y1+h/7; glVertex2f(x2-r

How to make a UserControls BackColor transparent in C#?

这一生的挚爱 提交于 2019-12-17 20:59:44
问题 I created a simple stick man in a Windows Form User-Control (consisting of a radio button and three labels and one progress bar). I set the back-color of the new user-control to transparent so that when I drag it onto my form, it blends with other colors and drawings on the form. I am not getting what I'm trying to achieve. Here is the picture: 回答1: UserControl already supports this, its ControlStyles.SupportsTransparentBackColor style flag is already turned on. All you have to do is set the