|
I have tried that method, I am specifying the whole bitmap structure but if I make the height negative I get an error saying something like the height needs to be greater than 0 when you try to open the bitmap in an image editor.
Thanks
Dave
|
|
|
|
|
Are you just writing the buffer directly to the file? The BMP format internally stores the image data upside down (I recall that there was actually a reason for this, but I can't remember now).
Anyway, you since you know the number of rows and the size of each row, you can just allocate a temporary buffer the same size as your original buffer, then copy rows of data from the first buffer to the temporary buffer. Something like this:
int rows = 576;
int cols = 768;
DWORD* destbuf = (DWORD*)malloc(rows * cols * sizeof(DWORD));
for (int row = 0; row < rows; row++) {
memcpy(
destbuf + (row * cols),
pBuffer + ((rows - row - 1) * cols),
cols * sizeof(DWORD)
);
}
- Mike
|
|
|
|
|
Cheers Mike I'll give that a go today. Tried to use memcopy yesterday but kept gettin exception errors and bombing out into debug. Im learning so I dont have any expirience with the debugger I havent a clue what it all meant. I'll see how it goes.
Thanks
Dave
|
|
|
|
|
Steve S is right. Get your hands on the BITMAPINFOHEADER structure located in your buffer, then negate the biHeight value. From the MSDN:
biHeight
Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.
If biHeight is negative, indicating a top-down DIB, biCompression must be either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed.
[edit]For clarification, Michael is also right. His solution will work, it just depends on what you really want to do.[/edit]
Chris Richardson
|
|
|
|
|
Chris Richardson wrote:
Get your hands on the BITMAPINFOHEADER structure located in your buffer, then negate the biHeight value.
I have tried that method, I am specifying the whole BITMAPINFOHEADER structure myself but if I make the height negative I get an error saying something like the height needs to be greater than 0 when you try to open the bitmap in an image editor.
Thanks
Dave
|
|
|
|
|
Hello,
How can I open a browser without address bar ?? Which line argumets ??
[]'s
Cris.
|
|
|
|
|
IE supports the following command-line switches:
-new
-remote
-k
-nohome
-embedding
-channelband
-e
-v
I'm not sure which, if any, would affect the address bar.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Ok thanks, but where can I find any documentation about this ??
[]'s
Cris.
|
|
|
|
|
Try here for starters. Googling also works.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I have a CDialog class that spawns another CDialog class. This second CDialog spawns yet another CDialog class. From dlg #3 I sendmessage to dlg#2 using m_pParentWnd (in which I save the "this" passed in the create function when dlg #3 was created modelessly by #2) . But the code never steps into the handler in #2 which is supposed to respond to my message. What am I doing wrong or not doing?
Thanks
LRESULT CImageDisplay::OnUDMPlusMag(UINT nDummy1, UINT nDummy2)
{
m_zoomFactor += 10;
double zoom = m_zoom *m_zoomFactor;
m_THBImage.SetZoomFactor(zoom);
m_THBImage.Redraw();
return 0;
}
ON_COMMAND(UDM_PLUSMAG, OnUDMPlusMag)
afx_msg LRESULT OnUDMPlusMag(UINT nDummy1, UINT nDummy2);
BOOL CDlgSettings::Create(UINT nIDTemplate, CWnd* pParentWnd)
{
m_pParentWnd = pParentWnd;
return CDialog::Create(nIDTemplate, pParentWnd);
}
void CDlgSettings::OnBplus()
{
m_pParentWnd->SendMessage(UDM_PLUSMAG, 1,1);
}
|
|
|
|
|
You're sending the wrong message;
The entry in the message map expects a WM_COMMAND message, but you want to send a user-defined (or Registered) message, so it never hits where you want, because the WM_COMMAND didn't arrive.
Steve S
|
|
|
|
|
That was it! Many thanks.
|
|
|
|
|
Hi,
Iam new to the field of image processing. What iam looking for is a library preferably in C++, Java or even C# that has functions to manipulate bitmap images.
Anyone have any ideas?? i know there are lots of libraries out there but dummy me ... i havent been able to find any source code.
All you need is just a little patience ...
|
|
|
|
|
Have you looked here:
http://www.codeproject.com/bitmap/
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am having a problem with the StreamIn member function of the rich edit control. For some reason my callback function is not getting called. When I place a breakpoint inside my callback function and trace execution to the StreamIn function, I press f10 ( trace over ) and StreamIn returns with 0 bytes read and my callback never gets called! Does anyone have any ideas?
|
|
|
|
|
Post the declaration etc of your callback, and show the initialisation of the EDITSTREAM block, and that might give us a few more clues...
Steve S
|
|
|
|
|
my call back is declared like so :
DWORD CALLBACK StreamCallback( DWORD Cookie,LPBYTE lpBuff, LONG cb, LONG *pcb )
Here is the es and the call to StreamIn
EDITSTREAM es;
es.dwCookie = int(&FormatMessage);
es.dwError = 0;
es.pfnCallback = StreamCallback ;
this->StreamIn( SF_TEXT, es );
|
|
|
|
|
Do you mean (int)&FormatMessage, by any chance? Presumably FormatMessage is one of your variables, rather than the Win32 API function. The actual name will probably be munged to FormatMessageW or FormatMessageA, in any case, which is just an added obfuscation that shouldn't affect you.
Presumably your StreamCallback isn't a member function of a class?
It shouldn't be, unless it's also static.
Steve S
|
|
|
|
|
The callback function is not a member of a class. FormatMessage is a CString. Yeah, that probibly is not a great name for a variable i know. I still haven't figured out why the callback is not being called.
|
|
|
|
|
I have discovered that I can send any variables in the EDITSTREAM structure even and invalid function pointer and the StreamIn function still returns 0 what the hell.
|
|
|
|
|
Let me ask a different question then. When are you calling StreamIn...?
Steve S
|
|
|
|
|
My question is, if it's possible to change the style (dwStyle) and the extended style (dwExStyle) of a created window.
I am working on a window that is a normal OVERLAPPEDWINDOW but when I switch to fullscreen it should be a POPUP etc.
Do I have to Destroy and create a new window?
Thanks!
Constantin
|
|
|
|
|
Did you try ModifyStyle() and ModifyStyleEx()?
|
|
|
|
|
Oh! you see I am not very used to MFC and didn't find it myself
Guess that's what I searched. I'll try it...
Thanks!
Constantin
|
|
|
|
|
The following code is from an artical on "Catching the 'Enter'
Key in windows and controls" by Randy More.
UINT SMUPPGrid::OnGetDlgCode()
{
UINT result = CListCtrl::OnGetDlgCode();
result = result | DLGC_WANTALLKEYS;
return result;
}
The function, OnGetDlgCode(), generates a compiler error indicating that this is a protected function and is not accessible.
What would it take to make this function accessible?
Bob Broadway
bob.broadway@att.net
|
|
|
|