drawing

Artefact drawing in Swift

为君一笑 提交于 2019-12-12 13:29:44
问题 The code below draws lines by overriding touches, however there is an artefact that persists when drawing, seen in the images below. When changing direction while zig zagging drawing across the screen, sometimes the line turns into a flat straight corner instead of remaining circular. The artefact is also experienced when drawing on the spot in small circles, the drawing point flashes half circles sometimes leaving half circles and partial circle residue when the finger leave the screen. The

How to draw over second monitor with GDIPLUS

邮差的信 提交于 2019-12-12 10:20:51
问题 I'm want to draw some text and lines over the desktop. I'm using gdiplus.h for print texts with the function DrawString. But its only print text on a primary screen monitor. If has in presentation mode, with 2 monitors I need to print text in a second monitor. #define _WIN32_WINNT 0x500 #include <windows.h> #include <gdiplus.h> using namespace Gdiplus; #pragma comment (lib,"Gdiplus.lib") int main() { HWND desktop = GetDesktopWindow(); HDC hdc = GetWindowDC(desktop); ULONG_PTR m_gdiplusToken;

Qt, QTransform rotation

﹥>﹥吖頭↗ 提交于 2019-12-12 09:47:16
问题 I'm trying to draw text "on cylinder". It means, that I have five rows of text. Top row is rotated by the X axis for 10 degrees. The second for 5 degrees. The middle is not rotated at all. The four's row is rotated for -5 degrees. The five's is rotated for -10 degrees. Rows 1, 2, 3 draws OK, but something is wrong with 4,5 rows. What am I doing wrong ? I provides an image for understanding a problem and code snippet: for( int i = 0; i < iterationsCount; ++i ) { const QRect r( x2, y2,

How to use Path in a DrawingImage?

半城伤御伤魂 提交于 2019-12-12 08:34:10
问题 I have some paths defined that I would like to convert into DrawingImage resources but I must be missing something. i.e. I want to take something like this: <Path Stroke="DarkGoldenRod" StrokeThickness="3" Data="M 100,200 C 100,25 400,350 400,175 H 280" /> and use it with something like this: <DrawingImage x:Key='icon'> <DrawingImage.Drawing> <DrawingGroup> <DrawingGroup.Children> <GeometryDrawing ... /> . . . </DrawingGroup.Children> </DrawingGroup> </DrawingImage.Drawing> </DrawingImage>

What is the right way of creating circle animation?

老子叫甜甜 提交于 2019-12-12 08:18:29
问题 I just saw this image and it's interesting to me, how to create such type of animation in Swift: So, I have many gray teeth in circle and when I set the angle, for example 45degree it will fill these gray teeth into blue within 0..45 degree. You can just explain me the right way of doing it or you can show different snippets(it would be great). And later I will search or read about it. Thanks in advance! 回答1: If you only need the individual 'teeth' to change color, instead of using the teeth

Drawing on canvas with opacity (dots in line) javascript

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 07:28:33
问题 I have that drawing logic: Draw = function(canvas, ctx, mousePosition) { var grad = ctx.createLinearGradient(0, 0, canvas[0].width, 0); grad.addColorStop(0, currentLineColor); grad.addColorStop(1, currentLineColor); ctx.lineWidth = currentLineWidth; ctx.strokeStyle = grad; ctx.lineCap = 'round'; ctx.lineJoin = 'round'; ctx.globalAlpha = 0.4; ctx.beginPath(); ctx.moveTo(lastMousePosition.x, lastMousePosition.y); ctx.lineTo(mousePosition.x, mousePosition.y); ctx.stroke(); }; When i set the

How do I change this Raphael drawn pie chart, so that the colors dont change

℡╲_俬逩灬. 提交于 2019-12-12 05:38:37
问题 I'm trying to change this pie chart, so that when I click on a segment, the color of the different segments don't change. I see that the fill has a direct relationship with the shape of the segment, but I totally suck. Please help! You can see the pie chart in action here: http://raphaeljs.com/growing-pie.html function drawgrowingpie () { var r = Raphael("holder"); r.customAttributes.segment = function (x, y, r, a1, a2) { var flag = (a2 - a1) > 180, clr = (a2 - a1) / 360; a1 = (a1 % 360) *

Design: extend JPanel twice or pass JPanel as parameter?

ぐ巨炮叔叔 提交于 2019-12-12 05:17:30
问题 I have design issue here. There two options which sound possible to implement but I don't like neither one. I need to provide two functionality in my JPanel. draw several lines draw several strings ads Approach extend twice If I would need only to draw lines then I can just copy-past solution from the following answer. Draw a line in a JPanel with button click in Java public class LinePanel extends JPanel { ... @Override protected void paintComponent(Graphics g) { super.paintComponent(g); ...

Moving a drawn circle to settled position in C# WPF

感情迁移 提交于 2019-12-12 05:16:20
问题 I would like to move the circle by clicking the buttons. For Example; There is circle on the position of (0,0) and I would like to move it by clicking on X+ button. This will increase X one by one without stopping and circle move on the X position. Then when I click on the Y+ button, It will increase Y just 20 times and the circle start the move on Y axis as well. I have one code, but I couldn't move it dynamically. It moves to predefined position. XAML: <Window x:Class="circle_animation

Getting a string index based on a pixel offset

∥☆過路亽.° 提交于 2019-12-12 04:39:26
问题 I am custom drawing a text box and now I am implementing the part where the user can click on a line and have the cursor move to where he clicked. I know how to get the row of text he clicked on because the character height is constant across all fonts, but not the column, because I'm not sure how to say "get me all the text that can be drawn before this amount of pixels," and because character width is not consistent unless you're using a fixed-width font, which is not a guarantee. So I have