![]() |
| Register | Login | |||||
|
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
|
| | |||
| 0 users currently in Programming. |
| Acmlm's Board - I3 Archive - Programming - .NET Bitmap Problems |
New poll | | ![]() |
| Add to favorites | Next newer thread | Next older thread |
| User | Post | ||
Dan![]() Purple Leever Since: 11-18-05 Last post: 5916 days Last view: 5907 days |
| ||
I have been writing some code to draw NES tiles using this tutorial here as a template. I think I have it pretty much coded, but one major problem exists. The bitmap that is produced comes out extremely blurry. Presumably, I'm doing something not quite right, or haven't set some obscure property. I would post a screenshot but I'm at work and have no access to a webserver or any such thing to upload it to. The source should be in the attachment hopefully. Or not. Screw it, here's the function:
public void DrawTile(int pX, int pY) (edited by Dan on 02-15-06 10:00 AM) |
|||
|
Guy Perfect Since: 11-18-05 Last post: 5909 days Last view: 5907 days |
| ||
| You can upload images as attachments to this forum. New feature. And OGG files, which I think is durn awexome.
Post a screenie of your problem. Actually seeing graphical anomalies is far more effective than looking at code and assuming a problem exists. |
|||
Dan![]() Purple Leever Since: 11-18-05 Last post: 5916 days Last view: 5907 days |
| ||
| Hopefully this works through the firewall.
Edit- Nope. Doesn't work. (edited by Dan on 02-15-06 10:08 AM) |
|||
|
FreeDOS + Giant Red Koopa Legion: freedos = fritos Since: 11-17-05 From: Seattle Last post: 5907 days Last view: 5907 days |
| ||
| Try forwarding/unblocking port 80, it's probably the one that is stopping you from uploading files. | |||
|
Disch Red Cheep-cheep Since: 12-10-05 Last post: 6187 days Last view: 6187 days |
| ||
This is probably of no/little use to you -- but I was bored and decided to clean that up a bit:
One of the things that stood out to me in your original code was you had your bitplanes backwards (the second bitplane is the high one -- the one you multiply by 2... not the first bitplane). But of course this has nothing to do with your question. |
|||
Dan![]() Purple Leever Since: 11-18-05 Last post: 5916 days Last view: 5907 days |
| ||
| Okay, this is pretty much my problem here:
And here's the source-code. |
|||
|
Guy Perfect Since: 11-18-05 Last post: 5909 days Last view: 5907 days |
| ||
| It simply looks stretched to me. I don't know how things are in .NET, but in VB, you have to set the Form's ScaleMode property to Pixels to get stuff to look right. | |||
|
Euclid Since: 11-17-05 From: Australia hmm... Last post: 5913 days Last view: 5907 days |
| ||
| Code looks ok to me...
it's sizeMode in .net, check that pictureBox's properties, Normal seems to work for me. |
|||
|
||bass Administrator Since: 11-17-05 From: Salem, Connecticut Last post: 5908 days Last view: 5907 days |
| ||
Originally posted by BGNGI'm pretty sure that ScaleMode is in pixels by default for all projects in .NET languages. |
|||
|
sloat Since: 11-18-05 From: Delaware, US Last post: 6010 days Last view: 6010 days |
| ||
| I'll throw my possible solution in to the ring...
set the graphics object (whatever you're drawing to) .SmoothingMode property to System.Drawing.Drawing2D.SmoothingMode.None |
|||
Dan![]() Purple Leever Since: 11-18-05 Last post: 5916 days Last view: 5907 days |
| ||
Tried those solutions, but none of them seem to correct the problem. I don't believe the picturebox control is the problem, as when I save the bitmap object to disk, the bitmap has the problem also.
Does anyone have any working .NET source code that does pixel access in a fast manner? |
|||
|
Euclid Since: 11-17-05 From: Australia hmm... Last post: 5913 days Last view: 5907 days |
| ||
| Have you tried looking into BitmapData and Bitmap.lockBits? They allow you to pretty much write binary for the bitmap image.
That's what i'm using anyway, here's a quick slab of code to draw stuff...
|
|||
Dan![]() Purple Leever Since: 11-18-05 Last post: 5916 days Last view: 5907 days |
| ||
| Now, I feel a wee bit dumb. I was looking at the image zoomed in Windows Picture and Fax Viewer, and it appeared like above also. However, when I opened the image up in Paint, it appeared fine. So it must be something to do with the actual picturebox control. Is there anyway I can disable this rather annoying behaviour and have it zoom normally?
I tried the SmoothingMode = none thing, but I don't even use a graphics object to paint the bitmap onto the Picturebox (I just set the Bitmap property of the control to the Bitmap object). I'm not entirely sure if this is the best way, or even how to work with the Paint events of the Picturebox control. Edit - I fixed it thankfully. I now use a bitmap of form-level scope, and on every paint operation on the Picturebox, I draw it to the Picturebox. I also set the InterpolationMode to Drawing2D.InterpolationMode.NearestNeighbor, which fixed the weird scaling problem. Thanks for all the help guys. ![]() (edited by Dan on 02-16-06 07:08 AM) |
| Add to favorites | Next newer thread | Next older thread |
| Acmlm's Board - I3 Archive - Programming - .NET Bitmap Problems |
| ![]() |