|
How does one open a Bitmap image. I am working on the VC++ platform for my project
|
|
|
|
|
give more details about wat you already have please
have you search for some examples at first ?
|
|
|
|
|
what about LoadImage ?
with something like ?
HBITMAP hBitmap = (HBITMAP)::LoadImage(NULL, sFileName, IMAGE_BITMAP,
0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_CREATEDIBSECTION);
|
|
|
|
|
Yes, dats wat i wanted.
Sorry, couldnt specify details.
Need to load bitmaps, calculate pixels n colors...
Wat wud be the best model for colors, preferably, ARGB?
|
|
|
|
|
And see CImage class if you want to open other formats
|
|
|
|
|
could anyone plz tell me how can i intialized
unsigned short int test_array[256][256] to zero or empty
Thanks!
|
|
|
|
|
Brutal method:
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 256; j++) {
test_array[i][j] = 0;
}
}
wiser one:
::memset(test_array, 0, sizeof(unsigned short int)*256*256);
[edit]
-- modified at 12:08 Thursday 15th February, 2007
Better one:
unsigned short int test_array[256][256] = {0};
thanks David
[/edit]
|
|
|
|
|
toxcct wrote: wiser one:
::memset(test_array, 0, sizeof(int)*256*256);
Which would actually not be very wise as an int is twice as large as an unsigned short .
memset(test_array, 0, sizeof(test_array));
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i'm really confused, i read int at first, not unsigned short int
by the way, i prefer writing the explicit
sizeof(unsigned short int)*256*256 instead of
sizeof(test_array) because i find it more clear in the reader's mind.
of course, if the array change of type, my code must be adapted, not yours.
|
|
|
|
|
::memset(test_array, 0, sizeof(int)*256*256);
thanks but how can be done in C langauge.
|
|
|
|
|
firstly, check the code, it's been modified (with unsigned short int instead of int in the sizeof() )
secondly, the code is quite C. remove :: before the memset, and all the remaining is C code.
don't forget however to #include <stdlib.h>
|
|
|
|
|
unsigned short int test_array[256][256] = { 0 };
memset(test_array,0,sizeof(test_array)); If you need to clear the array sometime after it's definition.
Software Zen: delete this;
|
|
|
|
|
you didn't read the other posts in the thread, did you ?
here[^] is what i told David about this...
|
|
|
|
|
ikbahrian wrote: could anyone plz tell me how can i intialized
unsigned short int test_array[256][256] to zero or empty
Like:
unsigned short test_array[256][256] = {0};
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: unsigned short test_array[256][256] = {0};
does this set all the array cells to 0, or only the 1st one ? I have a doubt
|
|
|
|
|
toxcct wrote: does this set all the array cells to 0...
Yes, that's what the REP STOSD instruction is for.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
STOre String Doubleword.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
toxcct wrote: does this set all the array cells to 0, or only the 1st one ? I have a doubt
"If a class has a constructor, arrays of that class are initialized by a constructor. If there are
fewer items in the initializer list than elements in the array, the default constructor is used
for the remaining elements. If no default constructor is defined for the class, the initializer
list must be complete — that is, there must be one initializer for each element in the array."
But why doesn't this use the "default constructor" ...
unsigned short test;
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
yes, but we have no class here, only native type
|
|
|
|
|
Right - check my post again (I just appended it )
I see the behavior but I'd like to see it documented. Anyone know where I can find that?
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
toxcct wrote: does this set all the array cells to 0, or only the 1st one ? I have a doubt
It does set all array cells with 0, in this case. Actually, this is standard way to initialize array.
|
|
|
|
|
It sets the first element to 0 (because that's the value inside the braces). Then, since you're out of initializers, the remaining elements are automatically set to 0.
|
|
|
|
|
Hello!
Iam beginner of vc++, and trying small project in vc++ using MFC.
Plz can any one give me the guide lines for the project
Counting the number of pages the printer was printing .
This is my first message ,so if any mistake in the message
Plz avoid that.
Regards,
shakumar
shakumar
|
|
|
|
|
int i;
for (i = 0; I < nNbPagesToPrint; i++) {
std::cout << "Printing page " << (i+1) << std::endl;
PrintPage();
}
std::cout << "Nb Pages printed : " << i << std::endl;
|
|
|
|