Search Results

Search found 2702 results on 109 pages for 'drawing'.

Page 2/109 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Image drawing library for Haskell?

    - by absz
    I'm working on a Haskell program for playing spatial games: I have a graph of a bunch of "individuals" playing the Prisoner's Dilemma, but only with their immediate neighbors, and copying the strategies of the people who do best. I've reached a point where I need to draw an image of the world, and this is where I've hit problems. Two of the possible geometries are easy: if people have four or eight neighbors each, then I represent each one as a filled square (with color corresponding to strategy) and tile the plane with these. However, I also have a situation where people have six neighbors (hexagons) or three neighbors (triangles). My question, then, is: what's a good Haskell library for creating images and drawing shapes on them? I'd prefer that it create PNGs, but I'm not incredibly picky. I was originally using Graphics.GD, but it only exports bindings to functions for drawing points, lines, arcs, ellipses, and non-rotated rectangles, which is not sufficient for my purposes (unless I want to draw hexagons pixel by pixel*). I looked into using foreign import, but it's proving a bit of a hassle (partly because the polygon-drawing function requires an array of gdPoint structs), and given that my requirements may grow, it would be nice to use an in-Haskell solution and not have to muck about with the FFI (though if push comes to shove, I'm willing to do that). Any suggestions? * That is also an option, actually; any tips on how to do that would also be appreciated, though I think a library would be easier.

    Read the article

  • Windows Phone Mango: Making a drawing app with various brushes option

    - by Md. Abdul Munim
    I am trying to make a drawing app. The purpose is simple. Let the user draw something on a canvas with various brush options like square brush,far brush,pencil brush and many more like any other drawing app available in android market. At present I can let the user draw smooth curves using following code: currentPoint = e.GetPosition(this.canvas); Line line = new Line() { X1 = currentPoint.X, Y1 = currentPoint.Y, X2 = oldPoint.X, Y2 = oldPoint.Y }; line.Stroke = new SolidColorBrush(Colors.Purple); line.StrokeThickness = 2; this.drawnImage.Add(line); this.canvas.Children.Add(line); oldPoint = currentPoint; Now I want some custom brush options and let the user draw using that.How can I achieve that? Thanks in advance.

    Read the article

  • Drawing Sprites for iOS games on iPad

    - by TheGamingArt
    So, I'm quite new and confused on the way to tackle creating sprites/sprite sheets for iOS games. I own the full CS5 sweet and have been told that fireworks is the best way to go for creating these (although I don't have the slightest idea in how yet and would love some tutorials/books specifying sprite sheet creation). My thoughts directed me towards tablet drawing, as I am awful at drawing with a mouse and/or tablet without a screen on it (such as a basic wacom). I was thinking about getting an iPad, as this would provide me with an iPad for testing purposes and a tablet. Does anyone know if it's possible (or even a good idea) to draw out your sprites on the iPad. Is it possible to export them out into Fireworks and such?

    Read the article

  • Drawing rectangles on a grid in a web browser

    - by Dhruv
    I would like to create an online, simple WYSIWYG drawing editor allowing people to draw rectangular shapes. I'm thinking of a grid which the lines and points can snap on to, ensuring that the lines are strictly vertical or horizontal. I will be parsing the rectangular shapes to obtain some area calculations and compute certain things. How can I achieve the drawing ability? The new canvas tag is good but people have been telling me that IE does not support it. I found some Java applets but I have never programmed in Java before. Is there a way to do this using pure javascript or jquery? Does ASP.NET help at all? Thanks.

    Read the article

  • How does Photoshop (Or drawing programs) blit?

    - by user146780
    I'm getting ready to make a drawing application in Windows. I'm just wondering, do drawing programs have a memory bitmap which they lock, then set each pixel, then blit? I don't understand how Photoshop can move entire layers without lag or flicker without using hardware acceleration. Also in a program like Expression Design, I could have 200 shapes and move them around all at once with no lag. I'm really wondering how this can be done without GPU help. I don't think super efficient algorithms could justify that? Thanks

    Read the article

  • UIView: how to do non-destructive drawing?

    - by Caffeine Coma
    My original question: I'm creating a simple drawing application and need to be able to draw over existing, previously drawn content in my drawRect. What is the proper way to draw on top of existing content without entirely replacing it? Based on answers received here and elsewhere, here is the deal. You should be prepared to redraw the entire rectangle whenever drawRect is called. You cannot prevent the contents from being erased by doing the following: [self setClearsContextBeforeDrawing: NO]; This is merely a hint to the graphics engine that there is no point in having it pre-clear the view for you, since you will likely need to re-draw the whole area anyway. It may prevent your view from being automatically erased, but you cannot depend on it. To draw on top of your view without erasing, do your drawing to an off-screen bitmap context (which is never cleared by the system.) Then in your drawRect, copy from this off-screen buffer to the view. Example: - (id) initWithCoder: (NSCoder*) coder { if (self = [super initWithCoder: coder]) { self.backgroundColor = [UIColor clearColor]; CGSize size = self.frame.size; drawingContext = [self createDrawingBufferContext: size]; } return self; } - (CGContextRef) createOffscreenContext: (CGSize) size { CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, size.width, size.height, 8, size.width*4, colorSpace, kCGImageAlphaPremultipliedLast); CGColorSpaceRelease(colorSpace); CGContextTranslateCTM(context, 0, size.height); CGContextScaleCTM(context, 1.0, -1.0); return context; } - (void)drawRect:(CGRect) rect { UIGraphicsPushContext(drawingContext); CGImageRef cgImage = CGBitmapContextCreateImage(drawingContext); UIImage *uiImage = [[UIImage alloc] initWithCGImage:cgImage]; UIGraphicsPopContext(); CGImageRelease(cgImage); [uiImage drawInRect: rect]; [uiImage release]; } TODO: can anyone optimize the drawRect so that only the (usually tiny) modified rectangle region is used for the copy?

    Read the article

  • Optimize a views drawing code

    - by xon1c
    Hi, in a simple drawing application I have a model which has a NSMutableArray curvedPaths holding all the lines the user has drawn. A line itself is also a NSMutableArray, containing the point objects. As I draw curved NSBezier paths, my point array has the following structure: linePoint, controlPoint, controlPoint, linePoint, controlPoint, controlPoint, etc... I thought having one array holding all the points plus control points would be more efficient than dealing with 2 or 3 different arrays. Obviously my view draws the paths it gets from the model, which leads to the actual question: Is there a way to optimize the following code (inside the view's drawRect method) in terms of speed? int lineCount = [[model curvedPaths] count]; // Go through paths for (int i=0; i < lineCount; i++) { // Get the Color NSColor *theColor = [model getColorOfPath:[[model curvedPaths] objectAtIndex:i]]; // Get the points NSArray *thePoints = [model getPointsOfPath:[[model curvedPaths] objectAtIndex:i]]; // Create a new path for performance reasons NSBezierPath *path = [[NSBezierPath alloc] init]; // Set the color [theColor set]; // Move to first point without drawing [path moveToPoint:[[thePoints objectAtIndex:0] myNSPoint]]; int pointCount = [thePoints count] - 3; // Go through points for (int j=0; j < pointCount; j+=3) { [path curveToPoint:[[thePoints objectAtIndex:j+3] myNSPoint] controlPoint1:[[thePoints objectAtIndex:j+1] myNSPoint] controlPoint2:[[thePoints objectAtIndex:j+2] myNSPoint]]; } // Draw the path [path stroke]; // Bye stuff [path release]; [theColor release]; } Thanks, xonic

    Read the article

  • Graph paper like drawing software

    - by Algorist
    Hi, I have a college assignment, where I have to draw diagrams of voronoi, delaunay, minimum spanning tree etc for the college. I want to do that in computer. I searched in google with no luck. Is there any good graph drawing software you are aware of? Thank you Bala

    Read the article

  • converting rgb values to System.Drawing

    - by Chris
    Hi, I've looked around, but don't see this question - maybe its too easy, but I don't have it. If I have file containing color values like: 255, 65535, 65280 ( I think this is green) is there a way to either: convert these to a System.Drawing.Color type or....better yet.. have .NET accept them as is to represent the color? thanks,

    Read the article

  • Drawing connected lines with OpenGL

    - by user146780
    I'm drawing convex polygons with OpenGL. I then do the same thing but use GL_LINE_LOOP. The problem I have is the lines are not always connected. How could I ensure that the lines are always connected? In the photo below, Iv highlighted in green, the corners that are connected and in red, those that are not. I would like for them to be all like the green ones. http://img249.imageshack.us/i/notconnected.png/ Thanks

    Read the article

  • XNA 2D/3D Drawing method?

    - by Adir
    What would be a better parctice, writing the drawing method inside the GameObject class or in the Game class? GameObject obj = new GameObject(); obj.Draw(); Or GameObject obj = new GameObject(); DrawGameObject(obj);

    Read the article

  • Dealing with Imprecise Drawing in CAD Drawing

    - by Graviton
    I have a CAD application, that allows user to draw lines and polygons and all that. One thorny problem that I face is user drawing can be highly imprecise, for example, a user might want to draw two rectangles that are connected to each other. Hence there should be one line shared by two rectangles. However, it's easy for user to, instead of draw a line, draw two lines that are very close to each other, so close to each other that when look from the screen, you would be mistaken that they are the same line, except that they aren't when you zoom in a little bit. My application would require user to properly draw the lines ( or my preprocessing must be able to do auto correction), or else my internal algorithm would not be able to process the inputs correctly. What is the best strategy to combat this kind of problem? I am thinking about rounding the point coordinates to a certain degree of precision, but although I can't exactly pinpoint the problem of this approach, but I feel that this is not the correct way of doing things, that this will introduce a new set of problem. Any idea?

    Read the article

  • OpenGL ES Simple Undo Last Drawing

    - by Erika
    Hi Everyone, I am trying to figure out how to implement a simple "undo" of last drawing action on the iPhone screen. I draw by first preparing the frame buffer: [EAGLContext setCurrentContext:context]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); I then prepare the vertex array and draw this way: glVertexPointer(2, GL_FLOAT, 0, vertexBuffer); glDrawArrays(GL_POINTS, 0, vertexCount); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); [context presentRenderbuffer:GL_RENDERBUFFER_OES]; How do I simple undo this last action? There has to be a way to save previous state or an built-in OpenGL ES function, I would think. Thanks

    Read the article

  • drawing above gtkentry using cairo

    - by Durgesh
    Hi Experts, I want to use cairo to enhance gtkentry look. For this, I have connected a callback to 'expose-event'. In callback, I call gtkentry's original expose-event handler. After that, I create cairo context and draw some lines and destroy the cairo. I return 'TRUE' as return value of callback function so that expose-event does not propagate. Now my problem is, I am drawing line from (0,0) to (100,100). But line appears only over the border areas of the gtkentry. The place where text is, it does not appear. Please help. Kind Regards -Durgesh O Mishra

    Read the article

  • How to Serialize a WPF Drawing?

    - by Néstor Sánchez A.
    Hi, maybe I'm missing something. I believed that WPF vector-based Drawings (like DrawingGroup, DrawingGeometry, etc.) were ready to be serialized. But they are not. So, should I navigate all these drawing childrens, and store they points, lines, brushes (that also are not serializable) and so on, and then made my custom serialization? Is really that difficult or I'm missing something pretty obvious? I mean, even serializing Bitmap images is easy. I thinked serializing vector-based drawings were easier (no quality loss, just descriptive info, no massive data). Thanks for your practical answers, alternate-way suggestions and comments!

    Read the article

  • C# Drawing Oracle Spatial Geometries

    - by Keeper
    I need to create a simple app which can display geometries from Oracle Spatial in C#. These geometries are exported from AutoCAD Map 3D 2010 to Oracle Spatial. I need to pan, zoom, manage layers of these objects, events (like right click to popup a contextual menu, potentially different for every object), creating/deleting points (maybe also other polygons): a sort of simple AutoCAD interface. Should I look for an AutoCAD OEM license? Is there a drawing framework which can handle this or do I need to create my own?

    Read the article

  • Drawing Directed Acyclic Graphs: Minimizing edge crossing?

    - by Robert Fraser
    Laying out the verticies in a DAG in a tree form (i.e. verticies with no in-edges on top, verticies dependent only on those on the next level, etc.) is rather simple without graph drawing algorithms such as Efficient Sugimiya. However, is there a simple algorithm to do this that minimizes edge crossing? (For some graphs, it may be impossible to completely eliminate edge crossing.) A picture says a thousand words, so is there an algorithm that would suggest: instead of: EDIT: As the picture suggests, a vertex's inputs are always on top and outputs are always below, which is another barrier to just pasting in an existing layout algorithm.

    Read the article

  • how can c# help in drawing using memory layers concept?

    - by moon
    hello all i am facing problem in drawing dynamically in a picture box. i works very good when the drawing objects are few but as the drawing objects increases the response time of my GUI is getting worse and worse, my GUI works very well up to 90 drawing objects but i have to support more than 1000 so this technique didn't work for me. know i have decided to adopt layers mechanism, i mean i will draw different layers of drawing in memory and then XOR them to load the final image to my display. the question is "i Can play directly with memory do draw layers using C# (Examples needed?)" other ideas are also appreciated, (Drawing objects means the shapes line,circles etc. that i have to draw on my GUI) thanx in advance

    Read the article

  • Winform not scrolling when drawing objects on it

    - by dezkev
    Hello All, C#3.0,.net framework 3.5 I am drawing ( using the draw method in the graphics class) a lot of solid rectangles on a windows form vertically. The form starts at 500 x 500 px and the rectangles are only drawn at runtime after data is downloaded from the net -and the number of rectangles depends on the download so I do not know it upfront. So only a few rectangles are drawn as the size of the form is fixed. So I googled/Binged ( lest someone suggest I do that) and found a few tips but they don't work in this case -like setting the forms AutoScroll property to true or trying double buffering.I also tried to draw on a listbox control and set it's scroll property etc...but no dice. I'm guessing there is no way to display , say 200 rectangles vertically on a windows form using draw. I need some other solution... any ideas please. Maybe a list of pictureboxes and then populate each picturebox with the solid color ? Thanks

    Read the article

  • Rewriting a simple Pygame 2D drawing function in C++

    - by Dominic Bou-Samra
    I have a 2D list of vectors (say 20x20 / 400 points) and I am drawing these points on a screen like so: for row in grid: for point in row: pygame.draw.circle(window, white, (particle.x, particle.y), 2, 0) pygame.display.flip() #redraw the screen This works perfectly, however it's much slower then I expected. I want to rewrite this in C++ and hopefully learn some stuff (I am doing a unit on C++ atm, so it'll help) on the way. What's the easiest way to approach this? I have looked at Direct X, and have so far followed a bunch of tutorials and have drawn some rudimentary triangles. However I can't find a simple (draw point).

    Read the article

  • Drawing Color Spectrum with Waveform

    - by TheDarkIn1978
    i've come across this ActionScript sample, which demonstrates drawing of the color spectrum, one line at a time via a loop, using waveforms. however, the waveform location of each RGB channel create a color spectrum that is missing colors (pure yellow, cyan and magenta) and therefore the spectrum is incomplete. how can i remedy this problem so that the drawn color spectrum will exhibit all colors? // Loop through all of the pixels from '0' to the specified width. for(var i:int = 0; i < nWidth; i++) { // Calculate the color percentage based on the current pixel. nColorPercent = i / nWidth; // Calculate the radians of the angle to use for rotating color values. nRadians = (-360 * nColorPercent) * (Math.PI / 180); // Calculate the RGB channels based on the angle. nR = Math.cos(nRadians) * 127 + 128 << 16; nG = Math.cos(nRadians + 2 * Math.PI / 3) * 127 + 128 << 8; nB = Math.cos(nRadians + 4 * Math.PI / 3) * 127 + 128; // OR the individual color channels together. nColor = nR | nG | nB; }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >