|
// --- file's property --- //
Mark Salsbery wrote: Are you sure you downloaded the right file?
I right-clicked the 16bit sample from the link and saved
it to my harddrive to test.
Yes, I check it by Read it in Hex, it's 16.
42 4D 42 40 00 00 00 00 00 00 42 00 00 00 28
00 00 00 7F 00 00 00 40 00 00 00 01 00 10 00
03 00 00 00 00 40 00 00 00 00 00 00 00 00 00
...
but, In my OS, the file property is still 32.
I think it's may be my OS's problem, XP-Professional Version 2002 Service Pack 2.
And since I works in japan, my OS is janpanese version of WindowsXP.
// --- CImage --- //
Others in MSDN forum advised me not to use CImage, because it's for display.
And I find that I can't get "the type of compression" by CImage class,
So, is it possible that Cimage class change the "BI_BITFIELDS compressed 16-bit bmp"
to "uncompressed 32-bit bmp" in CImage::load?
|
|
|
|
|
fitatc wrote: Others in MSDN forum advised me not to use CImage
CImage just wraps a DIBSection and uses GDI+ for loading
and saving images. If that's what you need it can be used
for anything DIBsection-related, not just for display.
fitatc wrote: is it possible that Cimage class change the "BI_BITFIELDS compressed 16-bit bmp"
to "uncompressed 32-bit bmp" in CImage::load?
It's possible, but I don't know why it would be changed.
Run it in the debugger and step into the CImage::Load() code.
I did, and it looks like it is possible (in
CImage::CreateFromGdiplusBitmap()) to be converted to a
32bpp bitmap but that code is bypassed.
This shouldn't be OS related - GDI+ didn't change for years
before Vista.
It could be the version of CImage you're using however.
What Visual Studio version are you using?
Step into the code - it doesn't change magically
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: It could be the version of CImage you're using however.
What Visual Studio version are you using?
My visual Studio version is: 2008, Version 9.0.21022.0 RTM.
I steped into the code, as your said, It seems like the point is in
Bitmap::Bitmap(
IN const WCHAR *filename,
IN BOOL useEmbeddedColorManagement
)
{
...
lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap);
}
but I am not very familiar with GDI+, so I determined to study it for my question.
Thanks very much for your help, and I know how I can deal with the question like this now.
|
|
|
|
|
fitatc wrote: Bitmap::Bitmap
What is this? I thought you were using CImage?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: What is this? I thought you were using CImage?
Yes, I just steped into the CImage::Load()
It's like below:
atlimage.h
inline HRESULT CImage::Load( LPCTSTR pszFileName ) throw()
{
if( !InitGDIPlus() )
{
return( E_FAIL );
}
Gdiplus::Bitmap bmSrc( (CT2W)pszFileName ); ---- ★
if( bmSrc.GetLastStatus() != Gdiplus::Ok )
{
return( E_FAIL );
}
return( CreateFromGdiplusBitmap( bmSrc ) );
}
I steped into ★, because all the BMP data it's used below is from here,
and I get:
inline
Bitmap::Bitmap(
IN const WCHAR *filename,
IN BOOL useEmbeddedColorManagement
)
{
GpBitmap *bitmap = NULL;
if(useEmbeddedColorManagement)
{
lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap);
}
else
{
lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap); --- ★★
}
SetNativeImage(bitmap);
}
★★:this is what I posted in last time, sorry for confusing message.
|
|
|
|
|
Oh it was Gdiplus::Bitmap
Anyway, CreateFromGdiplusBitmap() is the method you want to step into.
That's the one that may change the format to 32bpp, but it doesn't
for me.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Also, if after stepping into the CImage loader code
you find it does't do what you want, it's pretty easy to
load BMP files yourself - much easier than other file
formats with complicated compression.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am calling a PostMessage function froma worker thread and passing it a user defined window message. Since i have to update the control's which cannot be done as part of thread. Therefore I want to send a sturcutre along with the PsotMessage().
Is it Possible to pass a structure in PostMessage() and if Possible please tell how.
Thanks In Advance
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: Is it Possible to pass a structure in PostMessage()
yes
Dhiraj kumar Saini wrote: and if Possible please tell how.
Send:
Dynamically allocate memory your strucuture first
Fill structure
Pass structure
Read
When you receive the message, read type cast the parameter in the respective pointer
read the data
delete the pointer
struct DATA
{
int EventID;
CString ModuleName;
CString ThreatName;
} info;
info* ptr = new info;
ptr->EventID = Whatever;
ptr->ModuleName = Whatever;
ptr-> ThreatName = Whatever;
PostMessage(WM_MYMSG, reinterpret_cast<wparam> (ptr) , static_cast<lparam> 0);
info* ptr = reinterpret_cast<info*> wParam;
info obj;
obj.EvenID = ptr->EvenID;
obj.ModuleName = ptr->ModuleName;
obj.ThreatName = ptr->ThreatName;
delete ptr;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I have used the following code but it is giving eroor
Please tell whats the problem
VisitorDetails stVisitorPrDetails
m_vSiteVisitor[n].GetDetails(stVisitorDetails);
PostMessage(WM_GET_DATA,reinterpret_cast<wparam> (stVisitorPrDetails) , static_cast<lparam> 0);
and
LRESULT CMainDlg::OnGetData(WPARAM wParam,LPARAM lParam)
{
VisitorDetails stVisitorDetails;
stVisitorDetails = reinterpret_cast<visitordetails> wParam;
return 0;
}
the errorr are:
Error 25 error C2061: syntax error : identifier 'wparam' c:\documents and settings\shy\desktop\sourcecodes 8-09-08\source code 06dec2007\maindlg.cpp 525
Error 27 error C2061: syntax error : identifier 'wParam' c:\documents and settings\shy\desktop\sourcecodes 8-09-08\source code 06dec2007\maindlg.cpp 1927
Error 28 error C2146: syntax error : missing '(' before identifier 'wParam' c:\documents and settings\shy\desktop\sourcecodes 8-09-08\source code 06dec2007\maindlg.cpp 1927
Please Help
|
|
|
|
|
Dhiraj kumar Saini wrote: Error 25 error C2061: syntax error : identifier 'wparam' c:\documents and settings\shy\desktop\sourcecodes 8-09-08\source code 06dec2007\maindlg.cpp 525
Error 27 error C2061: syntax error : identifier 'wParam' c:\documents and settings\shy\desktop\sourcecodes 8-09-08\source code 06dec2007\maindlg.cpp 1927
Error 28 error C2146: syntax error : missing '(' before identifier 'wParam' c:\documents and settings\shy\desktop\sourcecodes 8-09-08\source code 06dec2007\maindlg.cpp 1927
In the above I see wparam , then wParam , i.e. it seems you have to choose one between the two different names for your variable...
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Dhiraj kumar Saini wrote: Is it Possible to pass a structure in PostMessage()
Yes.
Dhiraj kumar Saini wrote: if Possible please tell how
Pass a pointer to the structure as LPARAM. for instance:
static MyStruct ms;
UINT MyWorkerThread( LPVOID pParam )
{
ms.iProgress = 10;
PostMessage(hWnd, WM_MY_MESSAGE, (WPARAM)0, (LPARAM)&ms);
}
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanx u r genius .
It solved my problem
|
|
|
|
|
Dhiraj kumar Saini wrote: Thanx u
You're welcome.
Dhiraj kumar Saini wrote: u r genius
Well, I know that
Dhiraj kumar Saini wrote: It solved my problem
I'm glad it helped.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
Is it possible to use RotateTransform() after Graphics::DrawImage()?
Ex.
Graphics g(hMemDC);
for(){
for(){
.....
g.DrawImage();
}
}
g.RotateTransform();
Based from MSDN example RotateTransform is before DrawImage() function but I have tried the above code (6 months ago) and it works.
But now this code doesn't work anymore.
Image doesn't rotating anymore.
My code is for stitching tiles of an image to make it whole. When I place RotateTransform() before DrawImage() it produces black dash lines in between tiles.
It's been a solution to place RotateTrasform after DrawImage but now I can't make it work.
What seems to be the problem?
Do I have to add some more code?
Hope somebody can help me. Thanks.
|
|
|
|
|
Well, I guess DrawImage should follow RotateTransform and not the opposite. If you got undesidered lines, probably there's something wrong in your parameters.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for the reply.
Placing DrawImage after RotateTransform somewhat rotate my image tiles before stitching them. What I wanted is to stitch all first then rotate.
Is there any other way to do this.
|
|
|
|
|
Why dont you create a stitched bitmap first and then draw this bitmap on device context.
i mean
Graphics gr(bmpTemp)
.... Stitching code.
Graphics gr(hDC)
RatateTransform()...
DrawImage(bmpTemp)..
Does it make sense??
Regards,
Sandip.
|
|
|
|
|
Thanks for the reply.
I look at MSDN and I haven't found a constructor for bitmap.
Is there any?
|
|
|
|
|
check this
http://msdn.microsoft.com/en-us/library/ms535632(VS.85).aspx
|
|
|
|
|
I am working on a phonetic converter program. There are converter classes like "aConverter ","bConverter " etc which contains rules for converting english letters to equivalant text in other language.
In some cases fonts may have different formats. So I need to create different converters for it and plug with the application. I plan to supply all the converter details in a file and load the converter on runtime. So if I have specified "aConverter " in a file, how can I initialize it's instance? Each converter implements "IConverter " interface.
In C# I can use Activator.CreateInstance and cast to IConverter type. I am looking for a method to do this in standard C++ not MFC/C++ CLI. Or is there anyother changes which I can make in the existing design so that new converters can be plugged in?
|
|
|
|
|
Please elaborate: What exactly do you need that you can't find in standard C++ (possibly persistence?)?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: What exactly do you need that you can't find in standard C++ (possibly persistence?)?
I didn't get you. I am looking for some reflection kind of stuff.
|
|
|
|
|
Well, probably I had to use serialization instead of persistence, I meant saving/loading an object to/from a file. Is that what you need? On the other hand, as you probably know, reflection is a .NET feature not supported by standard C++ .
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you very much for your help.
CPallini wrote: I meant saving/loading an object to/from a file. Is that what you need?
NO. I just need to plug new converters to the application. All the converters implement IConverter interface.
CPallini wrote: reflection is a .NET feature not supported by standard C++.
I know. I used the term "reflection" here for better understanding. I need to compile this code in multiple platforms, that's why I am sticking with standard C++.
|
|
|
|