drawing

Why is drawing to OnPaint graphics faster than image graphics?

I'm looking for a way to speed up the drawing of my game engine, which is currently the significant bottleneck, and is causing slowdowns. I'm on the verge of converting it over to XNA, but I just noticed something. Say I have a small image that I've loaded. Image img = Image.FromFile("mypict.png"); We have a picturebox on the scr...

Creating a drawable textbox in visual basic

hi all, so i'm pretty new to visual basic and i needed some functionality. A drawing pad has been created and several buttons on it( on the form , see the screenshot). Each button represents a drawable figure. I've created a screenshot for you to see. http://img231.imageshack.us/i/screenshotus.jpg/ So if you click for instance the...

Java Swing NullPointerException when drawing

I'm using a custom JLayeredPane. I have several Shapes which needed to be drawn on different layers in the JLayeredPane. To test this I create a JPanel and ask its graphics. Then I draw a test rectangle on that JPanel (preparing the graphics) and in my paintComponent method from the JLayeredPane I finally draw everything. But this fail...

C#: Drawing Stripes using the GDI/+ Libraries

I would like to know if there is a way to take create a brush that paints stripes in C#; I'm using the 4.0 standard. For simplicity, two colors, and possibly an angle. Any references or websites would be greatly appreciated. ...

Drawing and Animating with UIView or CALayer?

hello, i am trying to implement a graph which a uiview draws. There are 3 UIViews to animate a left/right slide. The problem is, that i can't cancel the UIView animation. So I replaced the UIViews by CALayer. Now, the question is if CALayer is appicable for this? Is it normal to draw on a CALayer like this? And why is a CALayer so slow w...

Winform not scrolling when drawing objects on it

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...

How can I draw over a panel in C#?

Hey, I need to do my drawing over a panel in C# but without placing my drawing code inside "panel1_Paint", how can I do that ?? BTW, I'm using WinForms. Update : I forgot to make something clear, I need not to place my drawing code inside paint handler, because I need to start drawing depending on buttons' events. ...

GDI+ Problem drawing a table

I try to draw a table on a panel in C# Windows Form by using GDI+. The problem is that when I minimize the application, my drawing disappears. How can I avoid this and why acting this way? ...

Linking a Drawing toolbar with a code

Hey all, I’m working on my semester’s project. It’s called “Algorithms Learning System”. It’s based on the idea of plug-ins; any developer can add his own algorithm to my application in order to be available to all students. However, my main obstacle is to create a recursion template which can help me deal with any recursive algorithm, ...

Onpaint events (invalidated) changing execution order after a period normal operation (runtime)

I have 3 data graphs that are painted via the their paint events. When I have data that I need to insert into the graph I call the controls invalidate() command. The first control's paint event actually creates a bitmap buffer for the other 2 graphs to avoid repeating a long loop. So the invalidate commands are in a specific order (1,...

Things you can draw with HTML tables

So I was watching a talk by Google's Marissa Mayer about speeding up Google's pages. They found that a shopping cart icon increased load time by 2%, and users then searched 2% less. They managed to replace the icon with an HTML table. Here is my attempt at drawing a shopping cart: (live example page) <html> <head> <style> ...

BitmapContext on iphone

Hello, I am repeatedly drawing to an offscreen bitmap context non-destructivly on iphone. Right now the only way I have figured out to get it to display is to update the drawRect of my UIView with the contents of the context. This runs really slow and seems unnecessary. Does any one know of a way to have the bitmap update on the screen ...

Put DrawingGroup on a Canvas?

Hello, I have a DrawingGroup and I want to put it on a Canvas, but because DrawingGroup is no UIElement, this is not possible. Whats the best way to do this? And from which class could I derive, so that I could do something like canvas1.Children.Add(new myDrawingGroup()); (Meaning I want to add my DrawingGroup as one element on the c...

GDI: Dynamical Multiple Graphics in a page?

Hi all, I'm quite new to drawing shapes, graphics, bitmaps etc. I googled for a few days,but still havent got a real clue what to do, so please help me: I want to draw a floorplan with certain objects(represented as circles) moving on it. When I click on a object, it needs to show something. So far, I ve been able to draw some circles ...

GDI+ Problem encountered in drawing multiples rectangles on the form

I whant to draw a table in C# Windows Forms using GDI+. When the number of rectangles is too large for all rectangles to be displayed on the form, it does not scroll. And can not access those who did not fit the form. What I need to do to see everything I drawing on the form? Thanks. ...

How to detect iPhone movement in space using accelerometer ?

Hi ! I am trying to make an application that would detect what kind of shape you made with your iPhone using accelerometer. As an example, if you draw a circle with your hand holding the iPhone, the app would be able to redraw it on the screen. This could also work with squares, or even more complicated shapes. The only example of appli...

when is the right time to draw

hi i just finished essential part of my own personal 2d engine in c++ and i'm kinda deciding how to complete the part where it is actually supposed to display everything on the screen, namely when do I call that function which does the job. I don't have much idea of how does the graphic card work, my biggest experience is calling bios g...

How can I get the dimensions of a drawn string without padding?

I'm trying to create an image with some text on it and I want the image's size to match the size of the rendered text. When I use System.Windows.Forms.TextRenderer.MeasureText(...) to measure the text, I get dimensions that include font padding. When the text is rendered, it seems to use the same padding. Is there any way to determin...

BlackBerry - Cropping image

Hi all i want to crop a part of Image ,for that i am using following code: int x=20; int y=50; int [] rgbdata=new int[(0+width-x+height-y)* (image.getWidth())]; image.getARGB(rgbdata, 0, image.getWidth(), x, y, width, height); cropedImage=new Bitmap(image.getWidth(),image.getWidth()); cropedImage.setARGB(rgbdat...

WPF, how can I optimize lines and circles drawing ?

Hello ! I am developping an application where I need to draw a graph on the screen. For this purpose, I use a Canvas and I put Controls on it. An example of such a draw as shown in the app can be found here : http://free0.hiboox.com/images/1610/d82e0b7cc3521071ede601d3542c7bc5.png It works fine for simple graphs, but I also want to b...