drawing

Canvas, drawing a line segment

守給你的承諾、 提交于 2019-12-12 04:14:26
问题 My trigonometry is more than weak, and therefore I do not know how to draw a line segment shorter than full lines start point and end point. http://jsfiddle.net/psycketom/TUyJb/ What I have tried, is, subtract from start point a fraction of target point, but it results in a wrong line. /* * this is an excerpt from fiddle, that shows * the actual calculation functions I have implemented */ var target = { x : width / 2 + 60, y : 20 }; var start = { x : width / 2, y : height }; var current = { x

Drawing a shape in Canvas on repeat

匆匆过客 提交于 2019-12-12 04:05:21
问题 I'm new here and trying to get canvas to work for me. I wanted to make a canvasanimation where a circle was redrawn every 2 seconds with a canvas reset in between. The circle should appear randomly within(which i managed to get to work) but i cant figure out how to get the animation to repeat itself every 2 seconds. I used the requestAnimationFrame callback, but this refreshes like 60 times a second. var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var

Slow screen drawing in .Net C# winforms application

可紊 提交于 2019-12-12 04:01:54
问题 I have a very large C# .net 2.0 winforms application which has some drawing issues. When going into different forms you can see controls being drawn and even the title bar of the form being resized and then disappearing. The base form that all other forms inherit from has the following code in its constructor. Including setting DoubleBuffering to true. this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles

Android FingerPaint Sample Draws Four Lines

牧云@^-^@ 提交于 2019-12-12 03:48:17
问题 I am trying to follow the code for the FingerPaint example provided in Android's APIDemos sample project. In my case (unless this is supposed to happen), four mirrored lines are being drawn, instead of one line under the user's finger , which is what I want. I have not made any changes to the code: package com.example.android.apis.graphics; import android.content.Context; import android.graphics.*; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import

jfree chart draw image on a category plot

隐身守侯 提交于 2019-12-12 03:45:14
问题 Heyy folks I have a pretty strange requirement.I need to draw an arrow shaped image beside a stacked bar chart in a category plot .The arrow image has to be red or green depending on some pre defined condition.I just need help to find a method to draw an image outside the stacked bar on the plot using jfree chart.Please help me out with this guys .Being stuck with this for days !!!! 回答1: You could implement the CategoryAnnotation interface: plot.addAnnotation(new CategoryAnnotation(){ Image

Drawing circles with canvas

匆匆过客 提交于 2019-12-12 03:03:33
问题 when I try draw this I do not see any solid circles our outlines.. var ball = (function () { function ball(x, y) { this.color = "white"; this.x = x; this.y = y; this.radius = Math.round(Math.random() * ball.MAX_RADIUS); } ball.MAX_RADIUS = 5; ball.prototype.draw = function (context) { context.fillStyle = "#ffffff"; context.arc(this.x, this.y, this.radius, 0, 2 * Math.PI, false); }; ball.prototype.update = function () { }; return ball; })(); 回答1: You were close! You always have to do context

Drawing with lines function in Android using Java

China☆狼群 提交于 2019-12-12 02:56:49
问题 Ok, so I have a server (on computer) and the client (android phone). I have set up a connection via socket, and I can draw on the server frame, and then show it on the clients screen. This is what I'm sending: addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { // save coord x,y when mouse is pressed startDrawing=true; oldX = e.getX(); oldY = e.getY(); try { if (s != null) { mouseSend = new MouseData(oldX, oldY, currentX, currentY, startDrawing, isDrawing,

Flex Path - capturing Click event

匆匆过客 提交于 2019-12-12 02:54:02
问题 I am working through an example for creating Arc and Wedge shapes in Flex that use the Path component to draw the stroke and fill. http://hansmuller-flex.blogspot.com/2011/10/more-about-approximating-circular-arcs.html#comment-form I was looking to add a click event to the Arc/Wedge, but a Path cannot have a Click event (or really any other events as its a primitive variable I think). Is there a workaround do you think? 回答1: Answering my own question: I added the Path to a Group, set the

C++ how to draw a tone curve (gamma) to graph using setpixel function

旧城冷巷雨未停 提交于 2019-12-12 02:46:15
问题 As title mentions. I'm trying to draw a gamma tone curve but i do not have any idea how to do it. I can do linear tone curve just fine, but when it comes to drawing gamma tone curve, i totally just lose it. As referenced from http://www.mediachance.com/pseam/help/curves.html (1st or 2nd drawing) Codes as below #include <math.h> static COLORREF red=RGB(255,0,0); static COLORREF blue=RGB(0,0,255); static COLORREF green=RGB(0,255,0); The part where i should incorporate in to draw the gamma tone

Draw opaque graphics on transparent form - C# winforms

可紊 提交于 2019-12-12 01:45:30
问题 I've been working on a screen recorder lately and I wanted to implement a region recorder. I set up the code required to draw the region but the problem is that I can't get rid of the form. I tried TransparencyKey = BackColor; but that made the form click through which doesn't allow the user to draw the region I also tried Opacity = 0F; but that made the form invisible, and when set to very low values, it makes even the rectangle transparent. My goal is to make the form fully transparent and