Menu
  • HOME
  • TAGS

Customize a ProgressBar to become a Thermometer

android,drawing,draw,android-custom-view,android-progressbar

First I would provide 2 setters, one for color and one for the temperature value, normalized from 0 ... 1, where 0 means no visible bar, and 1 means a fully visible bar. public void setColor(int color) { mColor = color; invalidate(); // important, this triggers onDraw } public void...

Draw hair thin line on iOS, using OpenGL ES

ios,opengl-es,drawing,line

Have a look at http://oleb.net/blog/2014/11/iphone-6-plus-screen/ This shows that the iPhone 6 Plus uses a scaling factor and says that you can disable the scaling by "set the contentScaleFactor of your GLKView to the value of UIScreen.nativeScale" Hopefully that will fix your problem...

Draw String to centre of elipse using C#

c#,drawing

Use Graphics.DrawString to draw text in center of surrounding rectangle. Specify an StringFormat object with Alignment and LineAlignment set to StringAlignment.Center: RectangleF bounds = new RectangleF(x, y, width, height); using (StringFormat format = new StringFormat()) { format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; graphicsObj.DrawText("Number", SystemFonts.Default, Brushes.Black, bounds, format); } ...

How to draw a rectangle using a char parameter in C++?

c++,parameters,char,drawing

Your draw is missing a variable. Change draw(char); to draw(char c); And both for loops need a maximum range, not the same value as the incrementing variable. height<=height; and width<=width; #include <iostream> using namespace std; void draw(char c ) { int rheight=10; int rwidth=20; for(int height=0;height<=rheight;height++) { for(int width=1;width<=rwidth;width++) {...

write vertical text using DrawString

c#,graphics,drawing

Use System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat(); drawFormat.FormatFlags = StringFormatFlags.DirectionVertical; and add it as the last param to DrawString...

completely erasing UIBezierPath & CAShapeLayer drawn items

ios,objective-c,drawing,uibezierpath,cashapelayer

You can either remove the previous CAShapeLayer (with removeFromSuperlayer) or replace the path of the previous CAShapeLayer. You would appear to be adding a new layer without removing the old one, but of course it is impossible to tell without source code.

Drawing on canvas with opacity (dots in line) javascript

javascript,html5,canvas,drawing

Yes, that is to be expected as each line is overdrawn at the connection points, and their alpha data will add up. I would suggest the following approach and attach a proof-of-concept demo at the end, feel free to adopt that code to your project: Create two canvases, one main...

Get coordinates of a drawing point from Chart Values in TextBoxes?

c#,.net,winforms,charts,drawing

The task of translating drawing coordinates into DataPoints and back is not exactly intuitive. It is possible but you need to know the rules and pay a certain price. I have outlined the way in this post and it is worth looking into.. But as the problem is coming up...

SDL_TTF Drawing int to string memory leak?

c++,memory-leaks,drawing,sdl,sdl-ttf

Every time you call textManager::intToString you create a surface with TTF_RenderText_Blended and then create a texture from that surface. You are freeing the surface but it looks like you aren't doing the same for the texture. This means every frame the texture point will be re-assigned but the memory will...

OnRender equivalent in Windows Phone

c#,wpf,drawing,windows-phone-8.1,onrender

Since Windows.UI.Xaml doesn't have a raster graphics API the only options are to use vector graphics, to render into a bitmap and display that, or to interop to DirectX. Microsoft's Win2D library at http://microsoft.github.io/Win2D (also see http://blogs.msdn.com/b/win2d/ ) exposes Direct2D through C# and is probably the best match for what...

Clipping a graphic in memory before drawing on form

c#,drawing,gdi+,widescreen

I guess it is indeed the wrong approach. The ClippingRegion is only used for clipping the DrawXXX and FillXXX commands, including DrawImage (!). The CopyFromScreen however will use the given Points and Size and not clip the source. For a Rectangle region this is no problem since you can achieve...

wxPython DrawRectangle Not Filled with Black Background

python,wxpython,drawing

DrawRectangle is drawed with the current pen and filled with the current brush. So you must also call self.dc.SetBrush.

Drawing shapes with “+,-,|” in Java

java,loops,for-loop,drawing,shapes

I think you could make it much clearer by using separate methods: private void verticalLine() { for (int i = 0; i <= 9; i++) { if (i % 3 == 0) { System.out.print("|"); } else { System.out.print(" "); } } System.out.println(""); } private void horizontalLine() { for (int i...

saving drawing to sdcard from a custom view android

android,bitmap,drawing,android-canvas,android-custom-view

On the assumption you want to save the file to the devices storage, here is the solution i use... Add permission to manifest: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> Here is how I am doing it: // Variables i needed private String mFileName; private Bitmap mBitmap; // apply this listener to your button private...

Fill image with texture/pattern

javascript,canvas,html5-canvas,drawing,mask

If you're just after an illustrative approximation you can use a combination of blending and composition modes. First thing is to make sure your main image has transparency - this is important for composition to work (I made a rough cut-off in the following demo). Main steps: Draw the pattern...

Corona SDK Lua, How do I make a finger drawing/painting app?

ios,sdk,lua,drawing,corona

Based on your code, what you're doing there is just putting a circle (hence the display.newCircle) whenever a touch event is triggered. The touch event is triggered when you start touching the screen (click of mouse in simulator), when you move your finger on the screen, and when you unclick...

Highcharts - Diagonal line X/Y axis

javascript,charts,highcharts,drawing

You can do it by detecting the setExtremes() event on you axes, and fire a function to get the axis extremes and draw a line. (or, in this case, I used the afterSetExtremes() function) In my example I did it by using a line series. I assume you can adapt...

Drawing a moving line in a transparent panel in C#

c#,drawing,transparency

No need to erase the old line! Just invalidate the Panel and draw the fresh one, best in the Paint event. But for this to work, the Panel must not overlay the PictureBox. It must be inside it! Put this in the load or constructor event : yourPanel.Parent = yourPictureBox;...

Perfect alignment of triangles with Quartz2D drawing

ios,drawing,quartz-2d

the problem is that you are drawing using antialiasing. disable it for your context via CGContextSetShouldAntialias(context, NO); and everything should be fine. EDIT: in case of antialiasing is needed (your updated multicolor example), you could try to not only fill the triangles but also stroke their border in the same...

C# Win.Form - graphics disappear after load

c#,winforms,graphics,user-controls,drawing

The comments pretty much answer this, but since no-one has posted an answer yet, here's how you should change your code: private void drawDates(Graphics graphics) { // create pens and brushes // do not CreateGraphics, use the parameter instead //<-----drawing all graphics------>\\ // dispose pens and brushes; do not dispose...

NSTableView displaying incorrectly in NSSplitView

xcode,cocoa,drawing,nstableview,nssplitview

I actually got this working by calling the subview and then just resetting the position of the splitview divider. NSView *v = [vc view]; [self.superDisplayView addSubview:v]; [self.SourceListSplitView setPosition:250 ofDividerAtIndex:0]; ...

Loading drawing program through emacs

emacs,drawing,latex

Initial Draft -- Not Fully Tested -- Prototype (June 22, 2014):  The following is a first rough draft / not fully tested protype of the concept function idea outlined in the comment beneath the question by the original poster. Because @lawlist does not have an Ubantu OS set-up, or pinta...

how can i draw straight line using UIBezierPath in ios

ios,xcode,drawing

Try this: @implementation View { NSMutableArray paths; UIBezierPath *currentPath; CGPoint startPoint; } - (id)initWithCoder:(NSCoder *)aDecoder // (1) { if (self = [super initWithCoder:aDecoder]) { [self setMultipleTouchEnabled:NO]; // (2) [self setBackgroundColor:[UIColor whiteColor]]; paths = [NSMutableArray array]; } return self; } - (void)drawRect:(CGRect)rect // (5) { [[UIColor blackColor] setStroke]; for(UIBezierPath *path in...

Java: Drawing single dots at specified (x,y) coordinates?

java,graphics,drawing

This should give you basic idea. Normally with Swing graphics, you override the paintComponent() method and draw from some shared state Instead you can just draw to a large image, and then draw that image using paintComponent() I've compressed this into a single self contained example, this can be separated...

Drawing on bitmap with shared source

c#,bitmap,drawing,share,pixel

Basically, you have used LockBits() and the Bitmap() constructor incorrectly, and so whatever behavior you see, it's purely academic and indeterminate. The IntPtr that you pass to the Bitmap(int, int, int, PixelFormat, IntPtr) constructor is required to be one that you allocated for the purpose of that particular bitmap. You...

How can I calculate where to start my line based on the stroke cap?

android,drawing,ondraw,stroke

While writing the question, I realized that the answer may be fairly obvious to some. For those who are not thinking clearly (as I wasn't), here's the solution. The radius of the cap will always be one half the stroke width. cap_width = (int)paint.getStrokeWidth / 2; ...

HTML, Canvas Path2D alternative.

canvas,drawing,mobile-safari

Path2D is not yet supported in all browsers. You may be able to use a polyfill such as this one to get around this.

Drawing linechart in Swift with 1000+ datapoints

xcode,osx,swift,drawing,linechart

I cannot understand what the exact problem is without seeing a screenshot but visibility of the datapoints depends on the number of pixels on the screen. You cannot display more datapoints than the number of pixels, without letting some datapoints share the same pixel column or downsampling the data. You...

Rotate a individual rectangle and ALL its contents

c#,drawing,rotatetransform

Your RotateRectangle is not rotating a rectangle of canvas; it's drawing a rotated rectangle. Everything that's drawn between setting the Transform and the ResetTransform will be drawn rotated. Therefore, if you want the DrawString to be rotated, you need to put it after you set the Transform, and before you...

change alpha of a UIImage then use as colorWithPatternImage

xcode6,drawing,alpha,uigraphicscontext

So I figured this out: In TouchesBegan I made brushImage = self.imagesView.image; Then in TouchesMoved I used code to erase the stroke form imagesView and (draw2) redraw it using colorWithPatternColor brushImage but instead of using blendModeNormal I used blendModeCopy. And I works just the way I want....

wxPython Paint Damaged, Clipped area

python,wxpython,drawing,wx

Ok I found the problem, but I'll try to post more details later. Basically the goal of this code is to move a panel around and then update the parent panel. SetPosition calls Move which going through the wxWidget code calls DoMoveWindow, all of this leads to a change in...

How can I draw some png pictures on a TabPage in c# winforms (TabControl)?

c#,winforms,tabs,drawing

The problem to draw 'a few pictures' has turned out to mean: combine a flexible number of pictures into one single map. Place one PictureBox of sufficient size maybe with Dock=Fill and SizeMode=Center on the target tabpage. You will need to provide the names of the pictures if you want...

libGDX - TextureRegion drawing weird when scaled

java,libgdx,drawing,textures,texture-packing

Your frames of animation need padding around them to account for rounding error. Put two pixels of clear pixels all around each image. If you use TexturePacker to combine the images into your file, it will automatically add the two pixels of padding by default. If you name your four...

Masking circle segments in swift

swift,drawing,circle,masking

I came up with this solution recently: class CircularProgressView: UIView { private let floatPi = CGFloat(M_PI) private var progressColor = UIColor.greenColor() private var progressBackgroundColor = UIColor.grayColor() @IBInspectable var percent: CGFloat = 0.11 { didSet { setNeedsDisplay() } } @IBInspectable var lineWidth: CGFloat = 18 override func drawRect(rect: CGRect) { let...

OpenCV: how to draw continously with a mouse?

python,python-2.7,opencv,drawing,mouse

Instead of drawing single circles for each call of the callback function, try to draw a line from the last point to the current point. Therefore, you have to store the last point in a global variable.

javascript library to perspective distort a drawing [closed]

javascript,drawing,javascript-library,distortion

In Raphael just apply a matrix, I show you an example made with a set of 2 different types of draws: var R = Raphael(10,150,200,140); var r = R.rect(0,0,200,100).attr({fill: "red"}); var p = R.path("M0,50h200"); var s = R.set(); s.push(r); s.push(p); s.transform("m1,0.2,0,1,0,0"); The second value is the X skew, it will...

How to draw multiple texts on canvas

android,canvas,drawing

Ok, I found a way to do this. After drawing the text, I got the bitmap from getDrawingCache, then drew the bitmap onto the canvas.

FillEllipse Error

c#,exception,graphics,drawing,ellipse

Since you are passing in the PaintEventArgs e you can and should use its e.Graphics! And since you didn't create it, don't dispose of it! But those Pens and Brushes you create you should disposed of or better yet, create them inside a using clause! For the SolidBrush we can...

self updating drawings C#

c#,winforms,drawing

How about you store two time variables(DateTime) one that has the time when you started checking for that 2 second difference, another with current time and on the beginning of every iteration you verify if the difference of both times is 2 seconds. Remember, the first variable is the one...

Ideas with how to draw a specific large amount of circles on a page using a loop

html,css,drawing

You can do this fairly efficiently in JavaScript, by creating 10,000 divs with these styles: .circle { box-sizing: border-box; //include border in total width width: 0.8%; //width + margin === 1%, margin: 0.1%; //... so 100 circles will fill up their container's width border: 1px solid #aaa; //light gray border...

How to understand use-cases in specific scenerio

drawing,uml,modeling,use-case

Login is not a use case simply because it does not bring any value to the actor. It is a constraint. Just draw the association from user to update status (use verb substantive, not a concatenated identifier). You can put the login association inside the use case. Ask yourself for...

Java 2D Graphics get image from URL instead of resource

java,drawing,2d,java-2d

Something like... image = Image.IO.read(new URL("http://...")); FYI Class#getResource returns a URL If the code is an example from the tutorial, then the tutorial is wrong and you should find a new one. Don't override paint, instead override paintComponent. You MUST call super.paint (or super.paintComponent if you've overridden paintComponent) in order...

Why cant i paint on the panel

java,swing,jpanel,awt,drawing

You created another instance of JFrame inside the constructor drawing() Remove that instance and replace with this for all the initialization inside the constructor. add super.paint(g); to the first line of your public void paint(Graphics g) method. ...

How to draw text of multiple sizes aligned on line with TextRenderer? [duplicate]

c#,winforms,drawing,gdi,text-rendering

The Link in donald's comment pointing to dar7yl's excellent answer get it just right. All kudos to dar7yl! Below is an example and the result, nicely lined up on the same line: private void Form1_Load(object sender, EventArgs e) { using (Graphics G = panel2.CreateGraphics() ) { fonts.Add(new DrawFont(G, new FontFamily("Arial"),...

performance loading images game class

java,performance,variables,drawing

This is more of a design question. For a start, this: ... some other drop in efficiency, noticeable or not. ... is not a very healthy or productive way of thinking. If it's not noticeable, it's not worth worrying about. Otherwise you might as well be writing your game in...

Drawing circles on canvas so they are equal or at least comparable sizes on different devices

android,canvas,drawing,scaling,screen-resolution

You can use a dp value instead of pixel. I think this should do the trick. myCanvas.drawCircle(crcl.x, crcl.y, dipToPixels(getApplicationContext(),crcl.radius), selected_paint); This function converts dp to pixel. public static float dipToPixels(Context context, float dipValue) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics); } ...

Errors in bitmap creation in Java

java,bitmap,drawing,bmp

It seems to me that this code doesn't work as intended. Check out this part, for example: saveInfoHeader(rgbValues.length, rgbValues[0].length); saveInfoHeader has this signature: saveInfoHeader(int height, int width) So, when you pass int[100][50]; you should get bmp with height 100 and width 50. I suppose this part of the code is...

Create a line when press a button

vb.net,drawing,system.drawing,paintevent

You should call the Refresh method of the Form, not call the event handler yourself. That method will eventually invoke the Paint event and its handler. Private Sub b_Click(sender As Object, e As EventArgs) Handles b.Click a = t1.Text c = t2.Text Refresh() End Sub ...

Java encountering unknown errors in Eclipse- won't draw objects

java,eclipse,swing,jpanel,drawing

gates = new ArrayList<OutPin>(); //Unused currently ... OutPin b = gates.get(0); // line 48 gates, being empty, does not have an element number 0. That's why you get the IndexOutOfBoundsException. You probably intended to do outputs.get(0) instead....

update NSView automatically with the function swift

swift,drawing,updates,nsview

You need to put the NSBezier stroke in the drawRect, not in the mouseDragged. Save the coordinates in mouseDragged in an instance array and then do the final drawing with Bezier in drawRect. drawRect is called by the OS when the view needs display (either being told by needsDisplay =...

Drawing/Moving/Deleting strokes on HTML5 Canvas

javascript,cordova,canvas,html5-canvas,drawing

The HTML5 canvas works like a canvas in real-life. When you draw a line on a piece of paper, the only way to change it afterwards is to erase it with an eraser (potentially also damaging something else drawn there) or draw something over it which covers it. When you...

Matrix (?) to Rectangle and vise versa

c#,geometry,drawing

p01 and p02 are center coordinates (CenterX and CenterY) d01-d04 represent cosine and sine of rotation angle (or dx,dy components of unit-length direction vector) l01 and l02 are half-width and half-height of initial axis-aligned rectangle. sxi and syi are X and Y-coordinates of ith vertice. These coordinates are rounded toward...

C#: Save image error

c#,image,drawing

Windows File Paths do not support the colon (:) character, as well as several others for file names: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#naming_conventions In summation; invalid characters are: < (less than) > (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) * (asterisk)...

Drawing by Windows GDI inside of Qt

qt,drawing,gdi,qgraphicsview

A QWidget that intends to paint via GDI only must: Reimplement paintEngine to return nullptr. Set the WA_PaintOnScreen attribute. Optionally set the WA_NativeWindow attribute. This only speeds up the first redraw of the widget. Reimplement QObject::event and catch Paint and UpdateRequest events. These events should result in calling a method...

Qt - Draw on canvas

qt,drawing,qt5

I have provided an example that shows this. https://github.com/jsuppe/qt-paint What this example shows is: Create a widget & handle mouse events & paint event The widget contains a QImage which is the size of the widget. Write to the QImage the pixel coordinates when the mouse events occur Tell the...

Parasite points appears on WPF canvas when clicking

wpf,canvas,drawing

I think you need to check the position in img_MouseDown and img_MouseUp and if those positions are equal then you should just delete the rectangle that you have created. Because you are adding a rectanlge of strokethickness of 2 in your mousedown, you are always going to end up with...

How can I draw with pen width of 0 (invisible not cosmetic)?

c++,qt,drawing

You can simply set no pen, i.e.: painter->setPen(Qt::NoPen); In this case it will not draw a border line at all....

Draw and fill a signal

c#,drawing

Do not use DrawCurves to plot real data! They look nice and are useful when creating a freehand plot of your mouse movements. But when plotting data they are not so good as they tend to overdraw esp. when the direction changes quickly. See here for an instructive example of...

Bitmap from Drawing not render outside of Load_Form

c#,.net,bitmap,drawing,system.drawing

Not telling us about the bigger picture makes it hard to recommend the best course of action but let me simply assume two possible aims: either you simply want something drawn onto the Form or you want to display a bitmap into which you sucessively draw more and more things....

Getting a line that has the coordinates defined by the mouse location

c#,graphics,drawing,line,mouse

So short answer is you will need some custom painting. The longer answer involves custom drawing, and event handling. The other piece of code you need is a list of some sort to hold all of the lines. The code below creates a user control and does the custom painting...

Why am I getting a QWidget error?

python,graphics,drawing,pyqt4

The error is exactly what it says it is: You need to construct a QApplication before you try to make any QWidgets, or the Qt system does not know where to start. Replace main() with this: def main(): app = QApplication(sys.argv) global PyForm PyForm = CreateUI() PyForm.show() sys.exit(app.exec_()) And add...

Generate 10 balls in tkinter canvas

python-3.x,canvas,tkinter,drawing,tkinter-canvas

Every time through your loop you are deleting everything you created before, including what you created the previous iteration. Move the delete statement outside of the loop: def display(self): self.canvas.delete("circle") for i in range(0, 10): ... ...

How to draw the outline of circle within it, in Android

drawing,android-canvas

After a long search and hit and trial, I found solution to this problem, Hope it will help others- This problem got solved, when I defined my circle in the xml file instead of creating it by code. Add this file, say empty_circle.xml and write this- <?xml version="1.0" encoding="UTF-8"?> <shape...

How can I toggle shapes on and off screen in Java Swing?

java,swing,graphics,drawing,jtogglebutton

You could... Maintain a List of Shapes which are to be painted, adding or removing them as needed. You would then loop through the list in the paintComponent method, painting what ever was in the List and simply calling repaint when you want the component updated You could... Have a...

Numpy-compatible image drawing library

python,image,numpy,drawing

With matplotlib, playing around with dpi seems to give OK results, once you remove frames and tick marks. There's one snatch however that the bounding box calculation runs into rounding errors, so we need to fix the bbox size manually: import numpy as np import matplotlib import matplotlib.pyplot as plt...

How to draw an animated path with multiple colors in ios?

ios,swift,animation,drawing

I found a general solution that work very well. Since there is no way for drawing a unique path of different colors, then I just draw, without animation, all the paths of different colors that compound the path that I want. After that, I drawn an unique path in the...

iOS - Fill bezierPath with multiple colors based on percentage

ios,drawing,uibezierpath

Here is how you can do this, I have divided the path into 5 parts 20 % of each. UIBezierPath* bezierPath = UIBezierPath.bezierPath; [bezierPath moveToPoint: CGPointMake(50, 50)]; [bezierPath addLineToPoint: CGPointMake(60, 90)]; [bezierPath addLineToPoint: CGPointMake(80, 90)]; [bezierPath addLineToPoint: CGPointMake(90, 50)]; bezierPath.lineCapStyle = kCGLineCapRound; bezierPath.lineJoinStyle = kCGLineJoinBevel; [UIColor.redColor setFill]; bezierPath.lineWidth = 4;...

Swift - UIView draw 1 pixel-width line

ios,swift,uiview,drawing,line

Two issues here: CoreGraphics drawing functions work in terms of points (the unit of screen layout which is constant in approximate physical size across all devices), not in pixels. The number of pixels per point is different on devices with different screen scales: iPad 2 and iPad mini are the...

GradientPaint Working Strangely

java,swing,drawing,gradient

So, based on the JavaDocs GradientPaint public GradientPaint(float x1,     float y1,     Color color1,     float x2,     float y2,     Color color2) Constructs a simple acyclic GradientPaint object. Parameters:   x1 - x coordinate of the first specified Point in user space   y1 - y coordinate of the first specified Point in user space...

How to draw squares in java and put values inside it?

java,linked-list,drawing

you can use a StringBulder for the upper and lower lines because they are the same. and you can build all the lines in the same loop, so that can handle variable lengths for values: StringBuilder line = new StringBuilder(); StringBuilder values = new StringBuilder(); for(;temp!=null;temp = temp.next) { String...

Drawing pool table ball trajectory w/o containers

c++,drawing

int positiveMod(int x, int y) { return ((x % y) + y) % y; } int main() { int x,y,sx,sy; int startX; int minStartX = 0; cin >> sy >> sx; startX = 0; // compute the various start points on x with y=0, keep the smallest to identify the...

UIImage drawInRect

ios,uiimage,drawing,core-graphics

If what you are trying to achieve is a cropped version of the original image, then you should know that the canvas you are drawing in as frame with {0,0} origin. So for example if your desired effect is to get an image with size 100x100 and origin {10, 10}....

How to move panels up/down on keysDown event in c#

c#,winforms,drawing,panel

Each time you click a panel, a PreviewKeyDownEventHandler is added - so 3 clicks will trigger 3 (different) eventhandlers with the same invocation target, and each will move your panel for 10 pixels up/down: protected void panel_Click(object sender, EventArgs e) { CircleButton panel = sender as CircleButton; index = (int)panel.Tag;...

Drawing to the left of x,y coordinates

qt,drawing,coordinates,qml,qt-quick

You can not use negative values for this purpose since negative width or height is not supported in QML. But you can use Scale type to accomplish this : Rectangle { id: rectangle1 x: 257 y: 221 width: 50 height: 50 color: "#000000" transform: Scale { origin.x: 0; origin.y: 0;...

Processing in Java - drawn clearing rectangle breaks after calling a method

java,drawing,processing

I'm not sure if that approach is the best. You can try something as simple as this: // Learning Processing // Daniel Shiffman // http://www.learningprocessing.com // Example: a graph of random numbers float[] vals; void setup() { size(400,200); smooth(); // An array of random values vals = new float[width]; for...

C++/C# path/vector drawing library (2D)

c#,c++,vector,path,drawing

You have too many demands. I used to use Qt, it's convenient. Using signal and slot to implement callback is very easy. Qpainter can draw many shapes, but i'am not sure it can meet your requirement. You can learn more about Qt, it has many demos to learn.

how to draw a text on a circle in SWIFT

swift,text,drawing,draw

By using this library : https://github.com/javenisme/CurvaView var arctext : CoreTextArcView = CoreTextArcView(frame: CGRectMake(50, 50, 200, 200), font: UIFont.systemFontOfSize(15), text: "Hello this is radious arc with text", radius: 85, arcSize: 130.0, color: UIColor.redColor()) arctext.backgroundColor = UIColor.clearColor() self.view.addSubview(arctext) Remove arc for one file like as follows (set -fno-objc-arc to that library's .m...

Drawing canvas animation for pie on time h:m:s

javascript,jquery,canvas,drawing

First of all what you need to do is to check the total time of your values. Do this when pressing the start-button. var hours = document.getElementById("hh").value; var minutes = document.getElementById("mm").value; var seconds = document.getElementById("ss").value; var totalTime = 60*60*hours + 60*minutes + seconds; The next step is to separate the...

wxPython Draw A Triangle

python,wxpython,drawing

As the docs say: The last argument specifies the fill rule: wx.ODDEVEN_RULE (the default) or wx.WINDING_RULE. So, those are the only two values you can pass for fillstyle. If you pass anything else, you'll probably get an exception. But notice that it has a perfectly good default. If you're drawing...

How to check if text overflows a rectangle in Tkinter?

python-3.x,tkinter,drawing

You can use the bbox command to get the coordinates of a rectangle that completely encloses the text. Then, you can compare that to the coordinates of the actual rectangle you've drawn around the text.

How to draw and save 3D model in Qt from an array of 3d points?

c++,qt,opengl,3d,drawing

Qt has a tutorial on importing and displaying 3ds models. It's not exactly what you wanted, since it does not operate with array of 3d point coordinates, but how about editing the model in Maya/Blender/anything else that can export 3ds and loading it this way? Moreover (I haven't tried this,...

Drawing function but only on a certain screen/page (actionscript3)

actionscript-3,flash,actionscript,drawing

To draw something in your stage, you have added some MouseEvent listeners to your stage, so to stop drawing, you have simply to remove these listeners and clear your Graphics object, if you need of course, like this : stage.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown1) stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUp1); stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove1); Line.graphics.clear(); Hope that can help....

Coordinates not corresponding

java,android,canvas,drawing

I finally figured out the problem, which was here: Bitmap bg = Bitmap.createBitmap(480, 800, Bitmap.Config.ARGB_8888); with this call i was specifying a view of 480px of width and 800px of height, whereas my view is occupying the entire parent view (which is the screen). This was a quite a newbie...

Draw with arbitrary shaped pen

c#,.net,graphics,drawing

The best idea I've got involves some redundant drawing, but I think it will work. Treat the aperture polygon as a list of line segments. For each line segment in the list, draw a parallelogram using the line segment of the aperture at the start of the move, and using...

How to draw smooth movement on surface

android,canvas,drawing,surfaceview

The application does not determine the display's refresh rate. Attempts to "set" the rate to 60fps by sleeping for 16.7ms will produce jerky results. You should be using Choreographer to get notifications and timing info, and advancing your animation by actual time deltas rather than fixed-length frames. A discussion of...

How to paint additional things on a drawn panel?

c#,winforms,drawing,gdi+

I looked for another Q&A that would include the information you need. Frankly, it's a fundamental question, how to properly deal with drawing a Forms control. MSDN topics like Overriding the OnPaint Method and Custom Control Painting and Rendering provide some detail on the right way to do this. But...

Is it possible to rotate a drawing half-way its definition?

c#,drawing,rotatetransform

RotateTransform certainly does change the subsequent drawing. Note that you usually need a TranslateTransform before to set the rotation point. But it 'it didn't change anything' is certainly wrong. Try again! And yes you can rotate (or scale or move) at any point and move/turn it back or completely reset...

Onclick on image that is created in a javascript canvas

javascript,html,canvas,onclick,drawing

You've given the click event to the canvas context and not the canvas, change it to: myCanvas.onclick = function() As for making the individual images clickable (if you draw more than one), you can always keep an array of the clickable areas and the links they should go to that...

HTML / CSS / JS line drawing

javascript,html,css,canvas,drawing

It seems like my original plan of using canvas was not too far off then. I was not aware that it could handle so many points/lines. The predrawn image option is a good idea, but I'm giving users a choice between which 2 lines (out of a selection of many)...

Undo/Redo for iOS Painting App

ios,drawing,opengl-es-2.0,paint,undo-redo

I have decided to try a hybrid approach, where I save a bitmap snapshot every 10-15 actions, and use command lines to restore individual actions past the snapshots. A more in depth answer is offered here: http://stackoverflow.com/a/3944758/2303367

Clear NSView programmatically in swift

osx,cocoa,swift,drawing,nsview

Not too sure what you mean by completely clear that view but can't you just fill it with a solid colour? [[NSColor windowBackgroundColor] setFill]; NSRectFill(self.bounds); (Not up to speed with the Swift hotness yet) update I improving my Swift chops behold! NSColor.windowBackgroundColor().setFill() NSRectFill(self.bounds) ...

iOS swift - how to draw an ellipse with touch event

ios,swift,drawing,ellipse

Animating inside a drawRect is never recommended. Why not just put an UIView on the place where you want it and animate the coordinates of that view? The UIView could be a custom view responding to touch and then triggering the drawRect with a new color. The parent view where...

Drawing a line with a pixmap brush in Qt?

c++,qt,drawing,qpixmap

Nevermind, I've found the solution here The accepted answer shows how to draw a pixmap repeatedly along a path. That's great. For reference, I'll copy the code here: QPointF lastPosition, currentPosition; qreal spacing; void draw() { QPainterPath path; path.moveTo(lastPosition); path.lineTo(currentPosition); qreal length = path.length(); qreal pos = 0; while (pos...

Custom card view shape

java,android,xml,canvas,drawing

This should set you down the right path: http://developer.android.com/tools/help/draw9patch.html It allows you to define how a custom image will stretch. I recommend you use a dialog or custom view with the 9patch image set as the background. If the custom view is a relative layout then you can just center...