Illnab1024 Posted September 15, 2006 Share Posted September 15, 2006 ...(0 == src[x,y].A)... Scaring me with that backwards stuff... dst[x-1, y] Never thought about that, but the destination has already been written....nice! Quote ~~ Link to comment Share on other sites More sharing options...
trickman Posted September 16, 2006 Author Share Posted September 16, 2006 OK, what I want is to stretch something like this: http://img143.imageshack.us/img143/1931/screen2it8.png Is it possible to NOT stretch the alpha pixels and just the color pixels? Quote Link to comment Share on other sites More sharing options...
entY8 Posted September 16, 2006 Share Posted September 16, 2006 OK, what I want is to stretch something like this:http://img143.imageshack.us/img143/1931/screen2it8.png Is it possible to NOT stretch the alpha pixels and just the color pixels? stretch which pixels in which direction?isn't sepcot's last code snippet doing what you want? how about giving some manually created before- and after-images, so people get what you are looking for :wink: Quote Link to comment Share on other sites More sharing options...
trickman Posted September 16, 2006 Author Share Posted September 16, 2006 OK, what I want is to stretch something like this:http://img143.imageshack.us/img143/1931/screen2it8.png Is it possible to NOT stretch the alpha pixels and just the color pixels? stretch which pixels in which direction?isn't sepcot's last code snippet doing what you want? how about giving some manually created before- and after-images, so people get what you are looking for :wink: What I simply want is for the code to take the last non-transparent pixel in each row and scretch it to the left or to the right! Quote Link to comment Share on other sites More sharing options...
entY8 Posted September 16, 2006 Share Posted September 16, 2006 OK, what I want is to stretch something like this:http://img143.imageshack.us/img143/1931/screen2it8.png Is it possible to NOT stretch the alpha pixels and just the color pixels? stretch which pixels in which direction?isn't sepcot's last code snippet doing what you want? how about giving some manually created before- and after-images, so people get what you are looking for :wink: What I simply want is for the code to take the last non-transparent pixel in each row and scretch it to the left or to the right! well, sepcot's routine is doing that (apart of a few exceptions). in which way is it working wrong for you? Quote Link to comment Share on other sites More sharing options...
trickman Posted September 16, 2006 Author Share Posted September 16, 2006 no, it isn't... Quote Link to comment Share on other sites More sharing options...
Illnab1024 Posted September 16, 2006 Share Posted September 16, 2006 What I simply want is for the code to take the last non-transparent pixel in each row and scretch it to the left or to the right! Thank you for wording it that way! Excuse me a minute... Quote ~~ Link to comment Share on other sites More sharing options...
Picc84 Posted September 16, 2006 Share Posted September 16, 2006 What will this feature allow you to do? Quote Link to comment Share on other sites More sharing options...
Illnab1024 Posted September 16, 2006 Share Posted September 16, 2006 Okay. Thank god. This is true: void Render(Surface dst, Surface src, Rectangle rect) { bool foundthis = false; for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (src[x, y].A == 255 && foundthis == false) { foundthis = true; for (int x3 = x; x3 < rect.Right; x3++) { ColorBgra col = src[x, y]; col.A = src[x3, y].A; dst[x3,y] = col; } } } foundthis = false; } } Tell me if you don't like the white stripes you get from antialiasing... EDIT: And rick, before you say anything...it works, and I believe it is thread safe, so hush. Quote ~~ Link to comment Share on other sites More sharing options...
trickman Posted September 16, 2006 Author Share Posted September 16, 2006 It works! Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Illnab1024 Posted September 16, 2006 Share Posted September 16, 2006 Your welcome...That boolean statement is what did it EDIT:Also, if you ever get black or white stripes in your image after applying this, here is a code to get rid of those: void Render(Surface dst, Surface src, Rectangle rect) { bool foundthis = false; for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (src[x, y].A == 255 && foundthis == false) { foundthis = true; for (int x3 = x; x3 < rect.Right; x3++) { ColorBgra col = src[x+1, y]; col.A = src[x3, y].A; dst[x3,y] = col; } } } foundthis = false; } } Quote ~~ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.