draw

iPad (very) simple drawing

十年热恋 提交于 2019-12-02 18:55:34
I'm trying to implement a very simple drawing view in my app. This is only a small part of my app but it's turning into a real hassle. This is what I have so far, but all it's displaying right now is morse code like dots and lines. - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docsPath = [paths objectAtIndex:0]; NSString *savePath = [NSString stringWithFormat:@"%@/notePadImage.jpg",docsPath]; NSData *data = [NSData dataWithContentsOfFile

Fabric.js - Free draw a rectangle

♀尐吖头ヾ 提交于 2019-12-02 16:24:20
I have the following which doesn't work correctly: var canvas = new fabric.Canvas('canvas'); canvas.observe('mouse:down', function(e) { mousedown(e); }); canvas.observe('mouse:move', function(e) { mousemove(e); }); canvas.observe('mouse:up', function(e) { mouseup(e); }); var started = false; var x = 0; var y = 0; /* Mousedown */ function mousedown(e) { var mouse = canvas.getPointer(e.memo.e); started = true; x = mouse.x; y = mouse.y; var square = new fabric.Rect({ width: 1, height: 1, left: mouse.x, top: mouse.y, fill: '#000' }); canvas.add(square); canvas.renderAll(); canvas.setActiveObject

Delphi: how to draw small icons in List View on CustomDrawItem

故事扮演 提交于 2019-12-02 11:31:32
how to extend this code: ListView in vsReport mode colouring of Items and rows to draw small icons? and why do I have the error 'List index out of bounds (2)' if I have 3 columns? Thanks! There are many ways to draw the icons, depending on where they come frome (a file, a resource, a system icon, etc.) and depending on if there should be a single icon for all items or if every item has its own icon. Anyhow, the general idea should be clear from this extended version of the code in the previous question (and I have also fixed the out-of-bounds bug...): type TForm1 = class(TForm) ... private {

Android: Draw text on ImageView with finger touch

≯℡__Kan透↙ 提交于 2019-12-02 11:11:01
问题 i completed the drawing text on ImageView and i saved the final image in sd card. My problem is, when i am touching the screen to draw the text, my image in the ImageView is disappearing. Code import java.io.File; import java.io.FileOutputStream; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.StrictMode; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import

Drawing with a brush

こ雲淡風輕ζ 提交于 2019-12-02 09:53:55
I need help with the implementation of the brush on PyQt5 I already have some event code for the mouse: def mousePressEvent(self, event): if event.button() and event.button() == Qt.LeftButton: self.lastPoint = event.pos() self.scribbling = True def mouseMoveEvent(self, event): if (event.buttons() & Qt.LeftButton) and self.scribbling: self.drawLineTo(event.pos()) def mouseReleaseEvent(self, event): if event.button() == Qt.LeftButton and self.scribbling: self.drawLineTo(event.pos()) self.scribbling = False Inside of which the brush drawing function is declared: def drawLineTo(self, endPoint):

how to animate a bouncing ball on canvas

孤街醉人 提交于 2019-12-02 09:30:08
问题 Hi I've just started coding Java and HTML, etc, so I tend to struggle at times. Hence I have joined StackOverflow for your help (Be nice to me please :) ) I'm trying to animate using setInterval() and draw method to create a bouncing ball which moves by a number of pixels in each frame. When it hits an edge it should bounce back by reversing the direction of the relevant horizontal or vertical pixel velocity. Here is what has been done so far, my HTML code: <!DOCTYPE html> <html lang="en">

Cosinus drawing

回眸只為那壹抹淺笑 提交于 2019-12-02 07:18:30
问题 I'd like to make a program which draws a cosinus graph in orderd range. But there is an error which I'm not able to repair. Error Message: "z = int(self.entry.get()) AttributeError: program instance has no attribute 'entry" Here is my code: # -*- coding: utf-8 -*- from Tkinter import Tk, W, E from ttk import Label, Button, Frame, Entry,Style import math import sys import matplotlib as mp class program(Frame): def __init__(self,main): Frame.__init__(self,main) self.main = main self.initUI()

Using plot3 for drawing cones in MATLAB

好久不见. 提交于 2019-12-02 06:34:13
问题 I'm looking for a way to draw a cone at a specific location in a 3D surf plot. Would it also be possible to have the cone 50% transparent? Right now I'm drawing a basic 3d environment using the surf function. I'm trying to use the function plot3 to draw a cone with specific dimensions at a specific location. 回答1: The following code creates a cone by pinching a cylinder between zero and one with t=[0;1] . The alpha(...) function fan then be used to set the transparency. To reposition a

As3: Draw overlapping rectangles to a sprite and apply alpha

社会主义新天地 提交于 2019-12-02 06:28:05
I need to draw independet rectangles to a sprite. But the overlapping areas will get visible if I apply alpha to my sprite (the sprite will be fade in and out): var spBox:Sprite = new Sprite(); this.addChild(spBox); spBox.graphics.beginFill(0x123456) spBox.graphics.drawRect(100, 100, 50, 50); spBox.graphics.endFill(); spBox.graphics.beginFill(0x123456) spBox.graphics.drawRect(125, 125, 50, 50); spBox.graphics.endFill(); Is there a way to compine/flatten/merge the rectangles of my sprite? I want a seamless aplha appearence. I suspect that the graphics object does not support this kind of

Cosinus drawing

大兔子大兔子 提交于 2019-12-02 05:13:10
I'd like to make a program which draws a cosinus graph in orderd range. But there is an error which I'm not able to repair. Error Message: "z = int(self.entry.get()) AttributeError: program instance has no attribute 'entry" Here is my code: # -*- coding: utf-8 -*- from Tkinter import Tk, W, E from ttk import Label, Button, Frame, Entry,Style import math import sys import matplotlib as mp class program(Frame): def __init__(self,main): Frame.__init__(self,main) self.main = main self.initUI() def initUI(self): self.main.title('COSINUSEK') Style().configure('TFrame', background = 'black') Style()