graphics

Soft Paint Bucket Fill: Colour Equality

I'm making a small app where children can fill preset illustrations with colours. I've succesfully implemented an MS-paint style paint bucket using the flood fill argorithm. However, near the edges of image elements pixels are left unfilled, because the lines are anti-aliased. This is because the current condition on whether to fill is c...

What is the equivalent to Java's canvas object in C#?

I'm working on creating a basic application that will let a user draw (using a series of points) and I plan to do something with these points. If this were Java, I think I would probably use a canvas object and some Java2D calls to draw what I want. All the tutorials I've read on C#/Drawing involve writing your own paint method and add...

How do I capture a WinForm window to a bitmap without the caret

I've got window on a WinForm that I want to get the bitmap representation of. For this, I use the following code (where codeEditor is the control I want a bitmap representation of): public Bitmap GetBitmap( ) { IntPtr srcDC = NativeMethods.GetDC( codeEditor.Handle ) ; var bitmap = new Bitmap( codeEditor.Width, co...

perl: tk: a way/widget that allows pixel level control over the output

I want something like a canvas, but where i'd be able to manipulate pixels easily in addition to all the provided geometries, that can be drawn on canvas. Is it possible to embed something like GD::Image into a canvas? So then I maybe could make the image transparent and set some pixels in it (GD::Image->setPixel()) positioning it over ...

C# Graphics.RotateTransform works on localhost, but not on remote server

It works on my machine... I have a problem with using a C# Graphics method on my ASP.NET web host. I'm combining two map pins into a single image. I load an empty pin image and write a number on top of it. I then combine two of these, having rotated one 15 degrees and the other -15 degrees. It looks fine running through my localhost we...

solving origin of a vectors

I have two endpoints (xa,ya) and (xb,yb) of two vectors, respectively a and b, originating from a same point (xo, yo). Also, I know that |a|=|b|+s, where s is a constant. I tried to compute the origin (xo, yo) but seem to fail at some point. How to solve this? ...

Double buffering with C# has negative effect

I have written the following simple program, which draws lines on the screen every 100 milliseconds (triggered by timer1). I noticed that the drawing flickers a bit (that is, the window is not always completely blue, but some gray shines through). So my idea was to use double-buffering. But when I did that, it made things even worse. Now...

Encode complex number as RGB pixel and back

How is it better to encode a complex number into RGB pixel and vice versa? Probably (logarithm of) an absolute value goes to brightness and an argument goes to hue. Desaturated pixes should receive randomized argument in reverse transformation. Something like: 0 -> (0,0,0) 1 -> (255,0,0) -1 -> (0,255,255) 0.5 -> (128,0,0) i -> (255,2...

Text-based game graphics in Python

I'm pretty new to programming, and I'm creating a simple text-based game.> I'm wondering if there is a simple way to create my own terminal-type window with which I can place coloured input etc. Is there a graphics module well suited to this? I'm using Mac, but I would like it to work on Windows as well Thanks ...

smallest filesize for transparent single pixel image

I'm looking for the smallest (in terms of filesize) transparent 1 pixel image. Currently I have a gif of 49 bytes which seems to be the most popular. But I remember many years ago having one which was less than 40 bytes. Could have been 32 bytes. Can anyone do better? Graphics format is no concern as long as modern web browsers can di...

Code Interaction with Quartz Composition

Hi, i have a Quartz Composition with a Cube, and X/Y/Z rotation inputs are published. On Interface Builder i made a QCView and a QCPatchController with the previous Quartz Composition loaded. In QCView the Patch Controller is binded, and the rotation published ports are binded too to three NSSlider, so when i change the value of the NSSl...

how to move a character using 2D XNA framework?

I have different positions to a character and I want to move it and I don't know how. Thanks for help. ...

Which containers / graphics components to use in a simple Java Swing game?

I'm creating a simple labyrinth game with Java + Swing. The game draws a randomized labyrinth on the screen, places a figure in the middle, and the player is then supposed to find the way out by moving the figure with arrow-keys. As for now, I'm using a plain background and drawing the walls of the labyrinth with Graphics.drawLine(). I h...

How to better create stacked bar graphs with multiple variables from ggplot2?

I often have to make stacked barplots to compare variables, and because I do all my stats in R, I prefer to do all my graphics in R with ggplot2. I would like to learn how to do two things: First, I would like to be able to add proper percentage tick marks for each variable rather than tick marks by count. Counts would be confusing, whi...

Horizontal lines and PDF drawing on iPhone/iPad Quartz 2D

I'm trying to display a PDF of music using the Quartz 2D calls: CGPDFDocumentGetPage and CGPDFPageGetDrawingTransform The problem is that some horizontal lines in the PDF get drawn thicker than others. The biggest problem is that I notice this in Preview on the Mac and on iPhone/iPad. Even when viewing this PDF in the iPhone/iPad mail,...

Draw text on a .net Control with negative color of the background - blend

Hi, I'd like to draw a progress bar with percentage in its center, but I'd like the text to have negative (contrasted) color of the background. So the part of the text that is over the filled portion of ProgressBar would be white and the part over unfilled portion would be white. I could do this simply by "cheating" painting the bla...

VB Graphics : copy region (determined by 4 points ) to rectangle

Programming language : VB6 I have a problem to copy region within a picture deteremined by 4 points(p1,p2,p3,p4), and reskew it to a another picture with fixed rectangle (P1,P2,P3,P4), as shown : thank you so much in advance for your help ...

Zoom image to pixel level

For an art project, one of the things I'll be doing is zooming in on an image to a particular pixel. I've been rubbing my chin and would love some advice on how to proceed. Here are the input parameters: Screen: sw - screen width sh - screen height Image: iw - image width ih - image height Pixel: px - x position of pixel in image py ...

Graphics/Bitmap Limits?

Im having some weird problems with Graphics and Bitmap. I have a Graphics Object that is displayed on a PictureBox and im capturing the MouseMove and MouseClick Events that give X and Y Position of the Mouse on the Image but if the Y Position goes Bigger then 32775 it then goes into Negatives which means everything breaks. And if the Im...

Simulating 3D 'cards' with just orthographic rendering

I am rendering textured quads from an orthographic perspective and would like to simulate 'depth' by modifying UVs and the vertex positions of the quads four points (top left, top right, bottom left, bottom right). I've found if I make the top left and bottom right corners y position be the same I don't get a linear 'skew' but rather a ...