|
|
Hi,
Usually we creates the bitmap info directly from BITMAPINFO structure. But you can derive another structure from it. Then you will have access to RGBQUAD values. For knowing how to derive a structure from BITMAPINFO see the below code.
struct DIBINFO : public BITMAPINFO
{
RGBQUAD arColors[255]; // Adds an extra 255 entries to palette
operator LPBITMAPINFO() { return (LPBITMAPINFO) this; }
operator LPBITMAPINFOHEADER() { return &bmiHeader; }
RGBQUAD* ColorTable() { return bmiColors; }
};
Now instead of creating a Bitmap Info object of BITMAPINFO structure create it using DIBINFO structure. It is just simple as,
DIBINFO m_bitmapInfo;
Now you can change the RGBQUAD palette by changing the values in the arColors of the bitmap. For example here i am changing the palette to a gray scale one by filling same values at Blue, Green and Red.
for(int i = 0; i < 255; i++)
{
m_bitmapInfo.arColors[i].rgbBlue = i;
m_bitmapInfo.arColors[i].rgbGreen = i;
m_bitmapInfo.arColors[i].rgbRed = i;
m_bitmapInfo.arColors[i].rgbReserved = i;
}
There is another reserved member. It may be used in some other cases as Alpha. Normaly when you tell the color of a pixel you will specify 4 values.
They are,
1. Value of Red.
2. Value of Green.
3. Value of Blue.
4. Value of Alpha.
The alpha can be considered as the transparency.
Now while creating a bitmap pass the bitmap info as m_bitmapInfo. It will do the trick.
Thanks and Regards,
Amal P.
|
|
|
|
|
"As another example if running program on MSDOS machine we want to include file msdos.h otherwise a default.h file. A macro SYSTEM is set (by OS) to type of system so check for this: "
#if SYSTEM == MSDOS
#include <msdos.h>
#else
#include ``default.h''
#endif
--------------------
but how the value of "MSDOS" is obtained??
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Rokiee wrote: but how the value of "MSDOS" is obtained??
Try this
printf("MSDOS = %d", MSDOS);
Hope this is what you meant...
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
sorry, i asked it wrong. i want to know like,
eg:
if(x==3)
{
//
}
else
{
}
here if only we know the value of 'x' we can check it right?? so i mean how do u get the value for "SYSTEM".? is it set somewhere out of the program??
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Rokiee wrote: but how the value of "MSDOS" is obtained??
you mean, how to set SYSTEM macro with MSDOS value ?
like this :
#define SYSTEM MSDOS
otherwise, if you want to actually test for the real Operating System to know if the program is running under DOS or not, you won't be able to do this at preprocessing time.
it is only at run time you will get the OS version and to one or one action...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
please refer my replies. above and below
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
nope, you're wrong.
please refer the original question
sorry, i thought i talked to somebody else
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 6:05 Friday 23rd December, 2005
|
|
|
|
|
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
|
at compile time , _MSDOS_ would be true("defined") ,if its run in DOS right??
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Rokiee wrote: _MSDOS_ would be true("defined") ,if its run in DOS right??
definitely not !
refer my other answers
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
so is it a way to talk to the compiler? the
like , #ifdef _MSDOS_ (if the system runs on DOS)
include....
??
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
i think either you don't undertand or you don't know what is the preprocessor.
the preprocessor creates a version of the file that is passed then to the compiler. but the compiler don't see exactly the file as you wrote it !!
lets take an example. if you have this :
#if defined(MY_MACRO)
#include "file1.h"
#else
#include "file2.h"
#endif
now, if you have MY_MACRO defined, the compiler will see :
#include "file1.h"
if not, it will see :
#include "file2.h"
but never the compiler sees the preprocessor directives.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
2 things to try to demonstrate (on more time ) that you're wrong :
on the link you provide, it tells that the macro is not defined by VisualC++ compiler :
__MSDOS__ Turbo C, Borland C, and DJGPP
the second thing is that, even if the compiler sets this macro, the program won't be able to determine while running, if it is launched from windows, or from a plain MS-DOS console. such a test must be done a runtime, not compile time, and even less a preprocessing time.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
The original poster asked to include a file depending on the environment. But now it seems that he wants to know the OS at runtime. So you are right.
this is this.
|
|
|
|
|
then whats the use of
#ifdef __GNUC__
##ifdef WIN32
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
i don't know for __GNUC__
but i think the WIN32 macro tells the compiler that the target of the program will be Windows 95 (or later).
now if you #define __MSDOS__ (or such a macro), even if the program is build to be run on DOS (command line), it doesn't forbid anyone to run it under Windows XP for example. isn't it what you want ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
atlast you have done the most difficult job- makeing me understand. thanks, but sorry to disturb all you people
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
no problem, it's a great pleasure when a thing that's quite hard to understand for someone, it finally understood thanks to my explanations...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
|
very nice examples
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
I am making an Application analyzer.
It involves analyzing menu structure of an application too.
For acrobat reader it doesn't return any text for a menu. I am getting the menu items correctly but no text. So tree nodes are empty. I guess it could be because it is "ownerdrawn" (not me ).
But For Visual studio 2003 GetMenu returns NULL.
For Other windows it's working fine. For eg: Yahoo messenger.
Any ideas why this's happening.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Help
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
m_BlueBrush ?? , nice
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|