Ah, I see. Good point.
Something like this, then:
// loop over all pixels
RGBApixel temp = *img(i1,j1);
*img(i1,j1) = *img(i2,j2);
*img(i2,j2) = temp;
// or like this
// loop over all pixels
BYTE temp = img(i1,j1)->Red;
img(i1,j1)->Red = img(i2,j2)->Red;
img(i2,j2)->Red = temp;
// repeat for green, blue, alpha
The latter is more...
User Profile
Collapse
-
Hi, Bryant.
In the code above, you are overwriting the pixels of img as you go, which means that you will lose half the image before you finish.
Instead, make a second, blank image, say:
BMP blank;
blank.SetSize( img.TellWidth() , img.TellHeight( ) );
Then, use your same code, only with "img" as the source and "blank" as the destination.
As for...Leave a comment:
-
PDF files have a very specific format, which is documented by Adobe in rather lengthy specs. To read an arbitrary PDF file, you'll need to implement a lot of features of the standard.
DOC files are worse: they are (to some extent) a binary dump of MS Word's memory, +/- some formatting. MS does not document the format in any kind of public way, and even their "Open"XML format standard has things like "do this feature...Leave a comment:
-
How did things ever turn out for you on this? Steven McDougall told me you found a solution. Thanks -- Paul...Leave a comment:
-
-
No problem, dr. s.
While most of the code uses C, EasyBMP is implemented as a few C++ classes, particularly the BMP class. (The object-oriented nature of C++ makes it much easier to implement the read/write functions, etc.) Thanks -- Paul...Leave a comment:
-
You might also consider using nedit directly from the cygwin shell. (If you also run x.) -- PaulLeave a comment:
-
Once you write the file headers of the image, you could overwrite the pixel data with the text. On a standard, 24 bit per pixel image, red, green, and blue are 1 byte each, i.e., 3 characters.
If you decide to use C++ instead of C, you can use my open source / cross-platform EasyBMP C++ bitmap library. Using that, it's very easy.
Code:#include "EasyBMP.h" // ... // assume
Leave a comment:
-
Do'h!
Still wasn't fast enough. Darn those stringent limits! :) Here it is for real. ;) -- Paul...Leave a comment:
-
I didn't get the image uploaded in time. Here's a (highly degraded) version, to fit in the upload size limits. -- PaulLeave a comment:
-
I wrote some open source code to visualize 2D arrays. Have a look at the EasyBMP project, and take a look at the DataPlotter program.
IIRC, I need to update that program, so let me know if you encounter problems. But a pre-compiled version is included.
Also, here's a very simple way to visualize a 2D array in grayscale:
Code:#include "EasyBMP.h" // ... // suppose you
Leave a comment:
-
Hello, and thank you for your post.
Are you looking for feedback? I'm not entirely sure what you'd like. But it looks like a fun program. (And I scanned it for viruses, folks, so no problems there. ;)) -- PaulLeave a comment:
-
Good question.
On the one hand, the istream pointers probably wouldn't take _that_ much memory, but on the other hand, I agree that it's unsatisfactory that you can't take your approach. (Which I feel is more elegant.)
Are you sure this isn't a compiler bug? Have you tried another compiler?
Also, I'd recommend trying a smaller code snippet until you can track something down that works. e.g.,
...Leave a comment:
-
I don't use the TurboC++ compiler, but you could just open the C++ files in any text editor and print them from there. (I take it that you mean to print the source code.) -- PaulLeave a comment:
-
Hmm,
In part, I think you need to interact with the operating system to get that kind of information. In windows, that means win32 calls. TurboC++ may have specific functions to help with that, but because it's not standard C++, I can't be of much help to you on that end. However, I'd recommend digging around MS's site for win32 API calls to get directory listings.
Good luck -- PaulLeave a comment:
-
Best advice I've seen all day! (And way better than mine!) :) -- Paul...Leave a comment:
-
I'm not sure what you meant by this.
At any rate, how did it turn out? -- Paul...Leave a comment:
-
Well, if you look at the BMP object in EasyBMP.cpp in my EasyBMP C++ bitmap library, you'll find that the pixels are a 2-D array of ebmpBYTE structs:
Code:BMP { private: ebmpBYTE** Pixels; // ... };
Leave a comment:
-
Not a problem. :)
Well, there's not much to tell, as it was designed to be cross platform. Roughly speaking:
1) Copy the EasyBMP*.h and EasyBMP.cpp to the project directory.
2) Include EasyBMP.h in your project:
Code:/* ... */ #include "EasyBMP.h" /* ... */
Code:g+[b][/b]+ -o
Leave a comment:
-
I don't use DirectX, but I think the idea can be summarized as follows:
1) Determine when a mouse click event occurs.
2) Get the screen coordinates of the mouse cursor position (in pixels) when that happens.
3) Translate the pixel coordinates into the coordinates of your game. For instance, if
screen is 640 x 480
game coordinates are 0 <= x <= 4 , 0 <= y <= 3,
mouse coordinates...Leave a comment:
No activity results to display
Show More
Leave a comment: