|
Okay...
The images are fine.
Since the resulting bitmaps created by CImage are bottom-up oriented, the GetBits() method
is returning a pointer to the last row of data.
To adjust your pointer to the beginning of the buffer, something like this should work...
CImage image;
image.Load(_T("D:\\Source\\ImageTIF\\CMYK.tif"));
BYTE *pImageBits;
if (image.GetPitch() < 0)
pImageBits = (BYTE*)image.GetBits() + (image.GetPitch() * (image.GetHeight() - 1));
else
pImageBits = (BYTE*)image.GetBits();
...
And thanks for the images....One of them exposed a VERY old bug in my very old TIFF loader code!
Luckily I don't use it much anymore
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
well, the good news is, the < 0 formula is a big hit; however the bad news is, the value in pBits is still "ýýýÿýýýÿ...". There is some tiny stupid mistake im making somewhere, and I dont think the back of my desk can take much more kicking, or my boss can take much more of the obscenities coming from my cube.
when i try to look at the m_pBits member of image there is a memory address "0x64545(made up number)," and there is no data there either. obviously there has to be pixel information, is there anyway that it could be 0'd out or reset between load() and getbits()?
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
VonHagNDaz wrote: the bad news is, the value in pBits is still "ýýýÿýýýÿ...".
I'm seeing that as well on the CMYK.tif image...the background isn't bright white, it's RGBA
0xFD,0xFD,0xFD,0xFF. If I copy the pImageBits pointer from my sample code to a debug/memory
window, I have to scroll down a ways before the color changes - the bottom of that image is mostly
background and since the image is flipped vertically I expect that.
Using the TINY.tif image, if I copy the pImageBits pointer from my sample code to a debug/memory window, I see the first three pixels as "4c ae f2 ff ec 77 2f ff ec 77 2f ff..."
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
If you don't trust that the bits pointer is pointing to valid data, try this anywhere in your code
CImage image;
image.Load(_T("...\\CMYK.tif"));
BYTE *pImageBits;
if (image.GetPitch() < 0)
pImageBits = (BYTE*)image.GetBits() + (image.GetPitch() * (image.GetHeight() - 1));
else
pImageBits = (BYTE*)image.GetBits();
HDC hdc = ::GetDC(0);
image.Draw(hdc, 0, 0, image.GetWidth(), image.GetHeight());
::ReleaseDC(0, hdc);
Also remember for CMYK.tif, the bits pointer is pointing to an array of 3173868 bytes!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
alright, since the image appeared in the top left of the screen it means that i am getting valid data. if thats the case, then after wasting a good 5 - 6 hours of your time, i need to be looking into my image processing code to find out why its not altering the data as its supposed to.
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
Any image I get that breaks my TIFF loader code is worth it! I tried to make it as robust
as possible (it was way before GDI+ existed). These days I use GDI+
VonHagNDaz wrote: i need to be looking into my image processing code to find out why its not altering the data as its supposed to.
Remember the format in the array, taken as bytes, is (4 bytes each pixel) BGRA BGRA BGRA BGRA...
If your processing code is expecting CMYK or RGB there will be problems
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Forgot to mention....the resulting CImage pixel bits are 32-bit RGBA format in case your image
processing code isn't prepared to deal with that
Mark
-- modified at 14:52 Tuesday 29th May, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi everybody.
I´m trying to write in the Edit Box and its impossible to do it.
Selecting the edit box by clicking on it and then writing does not work. To write on it what I must do is reach the Edit Box by pressing tab key (check that proyect y uploaded in Megaupload to get an example of what is happening to me...)
Can somebody tell me what am I doing wrong?
http://www.megaupload.com/?d=K43YK4CM
Thanks
|
|
|
|
|
I have a clue.
When I set the focus on the edit box like this:
SendDlgItemMessage(IDC_EDIT,WM_SETFOCUS);
I cannot write. I took off that line and now I can write with no problem.
Anyway, I need the focus on that control when the dialog opens...
Lets follow...
|
|
|
|
|
garfield185 wrote: SendDlgItemMessage(IDC_EDIT,WM_SETFOCUS);
Have you tried SetFocus() instead?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
SetFocus does not work...
The only way to put the focus was that line, but if I use the SendDlgItemMessage I cannot write!! What a dilemma...
|
|
|
|
|
Hi All,
Can somebody tell me,how to replace a menu item with Image.
Thanks in advance.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
Did you search on the codeproject or did you see Menu section?
|
|
|
|
|
Hello All,
i have to make word addin so i am creating a word addin(shared addin) using MSVS 2003.
after creating this project, I am trying to add ATL Simple Object but it is unable to add this class and interface. i am unable to find the problem what is the problem while in MSVS 2005 everything is going fine.
but i have to work MSVS 2003 so please tell me what is the problem behind that?
thanks
bankey
|
|
|
|
|
My application is crashing when I click ctrl +F5.But when I click F5 & run the application it wont crashes.
Kindly let me know the reason behind this crash..
Urgent need...
Lavate Mallikarjun Avanna
|
|
|
|
|
Did you try and debug your application?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
in debug the application is working fine.But when i run using the ctrl +f5 it crashes.
|
|
|
|
|
Did you use of breakpoints on your program?
|
|
|
|
|
|
|
How to add a property sheet in Visual Studio 2005? I know how it is possible under VC6.
|
|
|
|
|
Add it to visual studio or in your application?
If adding to your application, it should be the same as it was in VC6 - A property sheet is a
Windows control, not a Visual Studio feature.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I want to change client area size of CFromView project in real time.
Anybody know how to do this?
Thanks
|
|
|
|
|
Client Area will change if you resize the window. you can do using SetWindowPos or MoveWindow
|
|
|
|
|
็SetWindowPos() need CWnd object of this dialog.
Please give me some idea for get this object.
|
|
|
|