draw

Android Draw Circle Pixel by Pixel

房东的猫 提交于 2019-12-25 03:06:05
问题 I am trying to draw a circle on my bitmap, pixel by pixel, using this code: for(int j = ((int)x - 20); j < ((int)x + 20); j++){ for(int k = ((int)y - 20); k < ((int)y + 20); k++){ int colorX = bitmap.getPixel((int)j, (int)k); if(Color.red(colorX) == 0 && Color.green(colorX) == 0 && Color.blue(colorX) == 0){ if(Math.sqrt(((j - (( int ) x )) ^ 2 ) + ((k - (( int ) y )) ^ 2) ) <= 20) bitmap.setPixel(j, k, Color.YELLOW); } } } But there is a problem, this is not drawing a circle.. it looks like a

Draw a hatched circle in android

孤街浪徒 提交于 2019-12-25 02:24:33
问题 Does anyone know how i can draw programmatically in android something like this (without using opengl)? Pic 回答1: You can use shape drawables (circles and lines) to define elements and then combine them in one drawable with Layer List. All this can be defined in XML. 来源: https://stackoverflow.com/questions/7384751/draw-a-hatched-circle-in-android

Drawing a flatten NLTK Parse Tree with NP chunks

本秂侑毒 提交于 2019-12-24 11:46:47
问题 I want to analyze sentences with NLTK and display their chunks as a tree. NLTK offers the method tree.draw() to draw a tree. This following code draws a tree for the sentence "the little yellow dog barked at the cat" : import nltk sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"), ("dog", "NN"), ("barked","VBD"), ("at", "IN"), ("the", "DT"), ("cat", "NN")] pattern = "NP: {<DT>?<JJ>*<NN>}" NPChunker = nltk.RegexpParser(pattern) result = NPChunker.parse(sentence) result.draw() The

Picturebox - Get image inside drawn rectangle and show in another Picturebox

大城市里の小女人 提交于 2019-12-24 10:45:28
问题 I made a search and successfully found a solution to draw a rectangle inside my Picturebox while mousemoving using a class named Rectangulo: Public Class Form1 Dim SelectionBoxObj As New Rectangulo() Dim IsMouseDown As Boolean = False Public SelectedObjPoint As Point Private Sub PictureBox1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then IsMouseDown = True SelectedObjPoint = New Point(e.X, e

Best way to draw an image dynamically

谁说我不能喝 提交于 2019-12-24 10:15:48
问题 I'm creating an android app that has to draw a map of an ambient that i have explored with laserscans. I have e text file with all my data like: index x y path 0 0 0 path 1 1 0 path 2 2 0 ...etc obstacle 0 10 10 obstacle 1 10 22 ..etc so I have xy coordinates of where I've been and xy of obstacles I've seen. I have a thread that reads the data from the text file and stores that data in a list . Another thread reads that list and draws all the points that are put in the list until that moment

How to draw a circle in Swift 3

霸气de小男生 提交于 2019-12-24 07:50:09
问题 Swift 3 How to make a circle? The circle should be located at the center. Was certain radius. The background - blackblur. Thank you 回答1: In order to make a circle draw a square and add a cornerRadius equal at width / 2: let circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)) circle.center = self.view.center circle.layer.cornerRadius = 50 circle.backgroundColor = UIColor.black circle.clipsToBounds = true var darkBlur = UIBlurEffect(style: UIBlurEffectStyle.dark) var

Android simple draw

杀马特。学长 韩版系。学妹 提交于 2019-12-24 06:41:17
问题 Why it doesn't work ? I'm trying to "paint" where i put my finger, to write something. For example, when i am trying to make a C he looks like this: http://postimg.org/image/5obyif4o1/ ........................................................................ public class BlackPixel extends View implements OnTouchListener{ private Bitmap mBitmap; Canvas mCanvas=new Canvas(); Path mPath=new Path(); Paint mBitmapPaint=new Paint(Paint.DITHER_FLAG); Paint mPaint=new Paint(); Paint circlePaint=new

Draw lines on jpanel

ⅰ亾dé卋堺 提交于 2019-12-24 05:49:45
问题 I want to make it like Draw a ruler (line with tick marks at 90 degree angle) just not on jframe but on jpanel. So I tried: JFrame f = new JFrame(); JPanel ff = new JPanel(); ff.add(new JComponent() { ... }); f.add(ff); ... but I failed. :( How to? 回答1: You can simply override paintComponent(Graphics g){} for ff and draw your within that method. i.e. JPanel ff = new JPanel(){ public void paintComponent(Graphics g){ // Draw what you want to appear on your JPanel here. // g.drawLine(blah blah

How to draw the below image in android programatically?

十年热恋 提交于 2019-12-24 04:54:10
问题 I am new to android. I'm finding very difficulty in using the Canvas. How to draw the below image in android? I also want to make the alphabet selected highlighted when it is touched. 回答1: Here it is: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="64dp" android:background="#000"> <!--

Draw diagonal line from corner to corner inside RelativeLayout

一世执手 提交于 2019-12-24 01:04:13
问题 I'm new in Android development and I'm trying to draw a line inside my yellow RelativeLayout from bottom left corner to top right corner. I've added a layer-list - diagonal_line <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="300dp" android:bottom="-300dp" android:left="0dp" android:right="-300dp"> <rotate android:fromDegrees="-10" android:pivotX="0%" android:pivotY="100%" > <shape android:shape="line" android:top="1dip" > <stroke android:width="1dip