Sign in to follow this  

[.net] GDI+ pixel

This topic is 3588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to draw a pixel in GDI+ but theres no function for it. Theres one for drawing rectangles, circles, arcs, but no drawpoint. Does anyone know how I can accomplish this? Thanks

Share this post


Link to post
Share on other sites
Come on man, how many of your threads are going to be about drawing pixels? Me and many others have already told you how to, in many different APIs as well. Also what's with all the API changes? First it was MDX, then OpenGL, then MDX again and now it's GDI+?

Seriously just pick your favorite API and got on with it.

To answer your question though, the fastest method would be to create a Bitmap and then write to it. However since writing and locking is expensive, you should "draw" to an array and then just write the whole array to the Bitmap. This should sound familiar since it's the same technique as in DirectX and openGL, just with a Bitmap in place of a texture.

Share this post


Link to post
Share on other sites
System.Drawing.Bitmap has a SetPixel method, but it is slow.

You should tell us what you're trying to do, because raw pixel access is rarely, rarely ever needed. That's why most ways of doing it are slow, because it's just not an important enough task to provide an easy means of doing it quickly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Scet
Come on man, how many of your threads are going to be about drawing pixels? Me and many others have already told you how to, in many different APIs as well. Also what's with all the API changes? First it was MDX, then OpenGL, then MDX again and now it's GDI+?

Seriously just pick your favorite API and got on with it.


I wasn't told how to draw to a texture using Managed Directx, only to use rendertosurface class. I tried OpenGL, but VB isn't good for that. Now I'm trying GDI+ but it's too slow to draw a point.

Share this post


Link to post
Share on other sites
Quote:
Original post by ed209
I wasn't told how to draw to a texture using Managed Directx, only to use rendertosurface class.


Really? Because I seem to remember sending you a PM detailing how to write to both SDL surfaces and DirectX textures. Actually drawing the texture or surface is trivial and could be found with a simple Google search.

Quote:
Original post by capn_midnight
You should tell us what you're trying to do, because raw pixel access is rarely, rarely ever needed.


If you look through his posts you'll see he's trying to make an emulator. For which system now I'm not sure. Initially it was for the NES, but that would be far too difficult for him so we suggested the CHIP-8. However at this stage it looks like looking up a simple tutorial is difficult.

I know my posts here sound kind of harsh, but I've responded to many of this guys posts and even shared source code with him through PMs and at this point it's like talking to a brick wall. His threads all die out because he rarely responds to them and then a week later we get the same question with a different API. We're here to help you ed209, but you're not giving us a lot to work with.

Share this post


Link to post
Share on other sites
Quote:
Original post by Scet
Come on man, how many of your threads are going to be about drawing pixels? Me and many others have already told you how to, in many different APIs as well. Also what's with all the API changes? First it was MDX, then OpenGL, then MDX again and now it's GDI+?



Originally, I asked how to draw to a texture in managed directx and was told to search for rendertosurface. I found a tutorial that shows you how to render to a texture in managed directx but I didn't know how to write an array to the texture.

It was suggested in one of my threads that I just use GDI+ because directx would be overkill unless I wanted to be able to resize the window. So I figured out how to draw shapes to a bitmap in GDI+, but still didn't know how to draw points to the bitmap. Isn't that what you mean by writing an array to a texture or bitmap - drawing an array of pixels?

I'm trying here, man.

Share this post


Link to post
Share on other sites

This topic is 3588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this