Sign in to follow this  

[.net] Need help with GDI+

This topic is 3549 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 currently working on a chip 8 emulator with GDI+ and have run into a problem. The resolution has to be 64x32 pixels, and so I made a bitmap thats 64x32. The problem is that this creates a tiny bitmap that I can barely see. Is there any way to increase the size of the bitmap will maintaining the same 62x32 resolution?

Share this post


Link to post
Share on other sites
You could also use a PictureBox with the bitmap assigned to it's Image property. Then just set it's SizeMode to StretchImage. When you want the PictureBox to update after you've drawn to the bitmap just call it's Invalidate method.

Not sure of the performance comparisons between these different methods. If you do use this method use DrawImageUnscaled instead as it's faster than DrawImage. It would be interesting to get out the old System.Diagnostics.Stopwatch and compare the speeds.

Share this post


Link to post
Share on other sites
Quote:
Original post by Headkaze
You could also use a PictureBox with the bitmap assigned to it's Image property. Then just set it's SizeMode to StretchImage. When you want the PictureBox to update after you've drawn to the bitmap just call it's Invalidate method.

Not sure of the performance comparisons between these different methods. If you do use this method use DrawImageUnscaled instead as it's faster than DrawImage. It would be interesting to get out the old System.Diagnostics.Stopwatch and compare the speeds.


thanks.
I will test both methods to see which one is faster.

One more question i had was when I draw a bitmap with the same color over another bitmap, the bitmap darkens. Should I clear the bitmap before everytime it is drawn to the form or is this method too slow?

Share this post


Link to post
Share on other sites
Quote:
Original post by ed209
I will test both methods to see which one is faster.

One more question i had was when I draw a bitmap with the same color over another bitmap, the bitmap darkens. Should I clear the bitmap before everytime it is drawn to the form or is this method too slow?


You can use Graphics.Clear() to clear it. But a better way would be to set the alpha byte when writing the pixels directly.

Share this post


Link to post
Share on other sites

This topic is 3549 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