2d resize

Started by
3 comments, last by pr0teus 24 years, 1 month ago
I have a square image which I need to resize to another square image. Right now, I have nested for loops for the resize, something like this: for(int rows = 0; rows < (int)destDim; ++rows) { sampleX = 0; for(int cols < (int)destDim; ++cols) { newImage[rows][cols] = sourceImage[(int)sampleY][(int)sampleX]; sampleX += sampleRate; } sampleY += sampleRate; } Where sampleY and sampleX are the source dimensions / destination dimensions. Any help is appreciated. Right now, it seems to rotate the image 45 degrees and place the upper right part of the image in the lower left corner. The left edge seems to be alright, however.
Advertisement
Your obvious problem is that you are not taking into consideration the actual apmatrix infestation library. You see, in order to understand what the resize is doing you must cout<< at many points in the program to trouble shoot. After you have completed this endever, you may want to try inserting random if() statements to solve your problems. Last but certainly not least, you should learn how to finish an actual game once and for all, not just do the minimum, but actually complete a game to show you "actual programming skills" Benny.
R.A.C. Random Acts of Cynicism
quote:Original post by Camel6

Your obvious problem is that you are not taking into consideration the actual apmatrix infestation library. You see, in order to understand what the resize is doing you must cout<< at many points in the program to trouble shoot. After you have completed this endever, you may want to try inserting random if() statements to solve your problems. Last but certainly not least, you should learn how to finish an actual game once and for all, not just do the minimum, but actually complete a game to show you "actual programming skills" Benny.


Excuse me but I could have sworn that these message boards were here for the purpose of allowing people of any skill level to ask questions without having to worry about lamers like yourself trashing them just for the sake of gratifying there obviously swollen egos. Sorry but It really ticks me off when I see people just trying to get some help and having to put up with this kind of bullshit! You don''t get good without asking questions and you don''t start good either it takes work and effort and great places like Gamedev.net to help you on your journey. So please for the sake of everyone save your personal attacks for people that care about your opinion.

Sorry once again for getting on the soapbox but I felt that it needed saying.
[email=wytraven@kik.net]wytraven@kik.net[/email]There is nothing real outside our perception of reality. Is there?
If you have access to the dxsdk then you can perform a stretch blit, which is achieved simply by using the Blt method of a DirectDraw surface object and passing your source rectangle at the original size, and setting the destination rectangle to the size you want to stretch/compress too. Hope this is some help.
[email=wytraven@kik.net]wytraven@kik.net[/email]There is nothing real outside our perception of reality. Is there?
I know of the Blt function. This is for a DOS program, and I must use 2d arrays.

The resize isn''t really necessary, but I want some extra credit.

By the way, that first reply was from one of my friends hassling me for this. It was all in the sake of fun. I realize no one else knew this though, for I''m against such attacks.

Ben

This topic is closed to new replies.

Advertisement