drawing

How can I draw the same lines from the first computer on a different computer? [closed]

孤街浪徒 提交于 2019-12-23 05:27:38
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am developing a drawing app. HTML code is the client side and server.js as server. I am using node.js and socket.io as connection index.html <html> <head> <script src="http://localhost:4000/socket.io/socket.io.js"></script> <script> var socket = io.connect('http://localhost:4000

How to Draw a line pixel by pixel using objective C

别来无恙 提交于 2019-12-23 05:09:11
问题 I want to draw a line(on iphone) such that i can view each pixel being draw. I am currently calling the drawRect method using a timer. Following is the code where i am drawing a wave using the values from an array: static int i=0; int x = 10; int y = 0; int x2; int y2; - (void)drawRect:(CGRect)rect { // Drawing code. CGContextRef c = UIGraphicsGetCurrentContext(); CGFloat black[4] = {0.0f,0.0f,0.0f,1.0f}; CGContextSetStrokeColor(c, black); CGContextBeginPath(c); NSLog(@"fired..."); int ecg

How can I add a label above just the last bar in a Chart.JS bar chart?

十年热恋 提交于 2019-12-23 04:54:46
问题 I am creating a bar chart like so: var ctxForecastChart = $("#forecastLineChart").get(0).getContext("2d"); var forecastChartData = { labels: [ "Total Sales" ], datasets: [ { label: "8/28/2016 - 9/3/2016", backgroundColor: "rgba(255,0,0,0.75)", hoverBackgroundColor: "rgba(255,0,0,1)", data: [240] }, { label: "9/25/2016 - 10/2/2016", backgroundColor: "rgba(255,153,0,0.75)", hoverBackgroundColor: "rgba(255,153,0,1)", data: [272] }, { label: "9/18/2016 - 9/24/2016", backgroundColor: "rgba(255,255

Cocoa: Accepting and responding to keystrokes

♀尐吖头ヾ 提交于 2019-12-23 04:53:08
问题 Hey everyone, I'm a newbie and I have what I anticipate will be a pretty easy question to answer. In order to learn a bit about event handling and drawing, I'm attempting to write a program that draws a black rectangle that increases in length every time the user hits the 'c' key. So far it just draws a black rectangle on a blue background without responding to keystrokes. Here is what I have so far: Input.h #import <Cocoa/Cocoa.h> @interface Input : NSView { int length; } - (void)keyDown:

Implementing Eraser functionality for drawing app

[亡魂溺海] 提交于 2019-12-23 04:49:26
问题 I was following this great tutorial at ray wenderlich's site about creating a simple drawing app with UIKit. http://www.raywenderlich.com/18840/how-to-make-a-simple-drawing-app-with-uikit the tutorial is great and everything is working. the problem that I have is that when it came to creating the eraser functionality the solution proposed by ray was to use the brush with the same color that the background has. To me this doesn't seem like a great solution. what if the background is not a

Is there a way to save a Graphics object in Codename One without without taking a screenshot?

情到浓时终转凉″ 提交于 2019-12-23 03:44:06
问题 The question is in the title. For example how can I save g in a file in the following snippet ? public void paints(Graphics g, Image background, Image watermark, int width, int height) { g.drawImage(background, 0, 0); g.drawImage(watermark, 0, 0); g.setColor(0xFF0000); // Upper left corner g.fillRect(0, 0, 10, 10); // Lower right corner g.setColor(0x00FF00); g.fillRect(width - 10, height - 10, 10, 10); g.setColor(0xFF0000); Font f = Font.createTrueTypeFont("Geometos", "Geometos.ttf").derive

How to draw a rectangle on a button click?

走远了吗. 提交于 2019-12-23 02:31:21
问题 I want when I click button, add one rectangle to the form I can add in form paint how much I want but I can't add shape like rectangle by click button and I searched about it but I didn't find a solution for it is here somebody know how to do it? This is my code in form paint private void Form1_Paint(object sender, PaintEventArgs e) { locationX = locationX + 20; locationY = locationY + 20; e.Graphics.DrawRectangle(Pens.Black, new Rectangle(10 + locationX, 10 + locationY, 50, 30)); } and this

Optimize drawing for paint application c#

佐手、 提交于 2019-12-23 01:58:12
问题 I am making a paint project like photoshop using c#. I have used GDI+ for the drawing. Sadly I cannot post the screen shot cuz of the reputation points required. EDIT : Ok i got enough rep to upload a pic. My drawing using the mouse lags when the brush size increases. I have a canvasBuffer which is drawn to the canvas panel protected override void OnPaint(PaintEventArgs e) { if (canvasBuffer != null) { using (Graphics g = e.Graphics) { g.DrawImage(canvasBuffer, e.ClipRectangle, e

Prevent other views than textview to update/redraw when setting text of textview every second

你说的曾经没有我的故事 提交于 2019-12-22 18:46:43
问题 I've got a slightly complicated layout, containing several custom-views that each calculate how much space they need and whatnot. At the top of this layout, I've got a TextView which is supposed to count down from say.. 02:04:20 (hh:mm:ss), and update every second. My problem is not updating the text, the problem is that when I DO update the text, ALL of the views in my layout gets re-drawn.. Also, I'm using a gallery in this layout, so when interacting with the gallery while the text is

Redrawed inset NSShadow on a Custom View using -setClip method

和自甴很熟 提交于 2019-12-22 13:59:10
问题 I have and odd problem, related with the answer of this question: Draw an Inset NSShadow and Inset Stroke I use this code into the drawRect method of a custom view. I have exactly this: - (void)drawRect:(NSRect)rect { // Create and fill the shown path NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:4.0f yRadius:4.0f]; [[NSColor colorWithCalibratedWhite:0.8f alpha:0.2f] set]; [path fill]; // Save the graphics state for shadow [NSGraphicsContext