|
Sorry for quering .I am reviewing my question again actually
I want to set the transparency of the bitmap i.e. from (0-255).
Trioum
|
|
|
|
|
How are you displaying your bitmap ? And what do you need to do exactly ? Do you only need to have some parts of your bitmap transparent ? If yes, take a look at TransparentBlt[^]
|
|
|
|
|
No transparent blt transparent some part. I want the whole image
Trioum
|
|
|
|
|
Why you can't use 32-bit ones?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Did you try with CImage::AlphaBlend ?
|
|
|
|
|
Do you want to actually alter the bitmap pixel data or
just draw the bitmap with adjustable transparency?
To draw with transparency, you can use AlphaBlend(). The
bitmap does NOT have to be 32-bit, but you need to initialize
the BLENDFUNCTION properly:
BLENDFUNCTION blendfunc;
blendfunc.BlendOp = AC_SRC_OVER;
blendfunc.BlendFlags = 0;
blendfunc.SourceConstantAlpha = 40;
blendfunc.AlphaFormat = 0;
To change the pixel data, load it as a DIBSection and loop through the pixel data
applying alpha to each pixel's data.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes I want that stuff you are right . but when I am using it
BLENDFUNCTION *blendfunc;
blendfunc.BlendOp = AC_SRC_OVER;
blendfunc.BlendFlags = 0;
blendfunc.SourceConstantAlpha = 40; // Set your transparency (0-255) here!blendfunc.AlphaFormat = 0; //Don't use AC_SRC_ALPHA for 24-bit images - there is NO source alpha data
AlphaBlend(m_DC,0,0,720,576,memDC,0,0,100,100,blendfunc);
where 100 100 is height and width of image
error fires call of non function
Trioum
|
|
|
|
|
blendfunc should NOT be a pointer.
BLENDFUNCTION blendfunc;
blendfunc.BlendOp = AC_SRC_OVER;
blendfunc.BlendFlags = 0;
blendfunc.SourceConstantAlpha = 40;
AlphaFormat = 0;
AlphaBlend(m_DC,0,0,720,576,memDC,0,0,100,100,blendfunc);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
On the AlphaBlend() line?
If so, you may need to define WINVER to something >= 0x0400.
This needs to be before any windows or MFC #included header
files.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can use of CImage class and use of SetPixelRGB.
|
|
|
|
|
Solve It .Actually I am using plan SDK .I cannot use CImage.
thanks Marks
Trioum
|
|
|
|
|
i have splitter control and there are some items in the control. now i have added a new menu item. created a dialog and the base class is CFormView class. now when i am trying to open this dialog with the menu item its giving me an assertion error. it comes to this line in CFormView.cpp
<br />
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))<br />
{<br />
ASSERT(FALSE);
PostNcDestroy();
return FALSE;<br />
}<br />
#endif //_DEBUG<br />
<br />
have given the right IDD for the dialog box. what can be the problem?<br />
<br />
|
|
|
|
|
Debug more into _AfxCheckDialogTemplate
Come online at:-
jubinc@skype
|
|
|
|
|
Please check the Dialog associated with the Resource ID preexist. If the Dialog is there, you shouldn't get any error.
|
|
|
|
|
Hi all,
I have a project with few functions. There is no dependencies on each other. I want to execute them on command line parameters. Just like this,
If I type "func 1" on command line, then the first function should be run. How can I approach it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
First hold the strings of all the function names that can be passed as command line. Upon receiving the command line, compare it with the available strings. Based on the result, call the corresponding function.
Come online at:-
jubinc@skype
|
|
|
|
|
A simple approach is choosing the function to call based on a numeric argument.
Suppose the application name is myapp.exe (I suppose you're writing a console application), you can type
myapp.exe 1
to make the application call func1 ,
myapp.exe 2
to make it call func2 and so on, provided your application main is structured a way similar to the following:
void main(int argc, char * argv[])
{
int n;
if (argc != 2)
{
printf("usage %s <number>\n", argv[0]);
return;
}
n = atoi(argv[1]);
switch(n)
{
case 1:
func1();
break;
case 2:
func2();
break;
default:
printf("invalid function number\n");
break;
}
}
</number>
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Thanks a lot for your replay. But few wired point with me here.
I work on console application and use VS.Net 2003 for all of this. So my first question is how should I give command line parameter.
Second one is, say this is my function.
void CAdd::addNumbers(void)
{
int iOne = 10;
int iTwo = 12;
int iSum = iOne + iTwo;
cout << iSum << endl;
}
How can I deal it with the following explanation. Thanks in advanced.
CPallini wrote: Suppose the application name is myapp.exe (I suppose you're writing a console application), you can type
myapp.exe 1
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: I work on console application and use VS.Net 2003 for all of this. So my first question is how should I give command line parameter.
Choose the menu item Project-> your_project_name Properties , then select the Configuration Properties->Debugging node (on the appeared window) and assign 1 to the Command Arguments item of the listbox on the right.
Eranga Thennakoon wrote: How can I deal it with the following explanation. Thanks in advanced.
CPallini wrote:
Suppose the application name is myapp.exe (I suppose you're writing a console application), you can type
myapp.exe 1
if your method is static then you can call directly it (CAdd::addNumbers() ), on the other hand, if it isn't static , then you have to create an instance of the class:
...
case 1:
{
CAdd objAdd;
objAdd.addNumbers();
}
break;
...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: if it isn't static, then you have to create an instance of the class:
Yes it is, all my members are public. So I use an instance there.
As you said set the arguments. But it not display any...
int _tmain(int argc, _TCHAR* argv[])
{
CAdd m_Add;
if(argc < 2)
{
cout << "Less" << endl;
return EXIT_FAILURE;
}
int n;
n = atoi(argv[1]);
switch(n)
{
case 1:
m_Add.addNumbers();
break;
case 2:
m_Add.diffNumbers();
break;
default:
cout << "Invalid argument" << endl;
break;
}
cin.get();
return 0;
}
I think this correct.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Did it compile (I mean is it a ANSI build)?
What can you see using the debugger?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: Did it compile (I mean is it a ANSI build)?
Yes it is.
CPallini wrote: What can you see using the debugger?
You mean in debug mode. It seems work fine. That's why I confused. Go through step by step there.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: You mean in debug mode. It seems work fine. That's why I confused. Go through step by step there.
What I mean is:
(1) put a break point on the following line
n = atoi(argv[1]);
(2) use the debugger to follow program execution step by step (F10 key) and see what happens (and when appropriate use F11 to step into functions).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Yep, that what I have done pal.
Different thing is that, all my members are public. It wont be a case use of instance, isn't it.
I appreciate your help all the time...
Eranga
|
|
|
|