Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Japanese character Pin
Sameerkumar Namdeo8-Jul-07 23:05
Sameerkumar Namdeo8-Jul-07 23:05 
QuestionLoading bmp in button Pin
saisp8-Jul-07 19:49
saisp8-Jul-07 19:49 
AnswerRe: Loading bmp in button Pin
Hamid_RT8-Jul-07 20:43
Hamid_RT8-Jul-07 20:43 
GeneralRe: Loading bmp in button Pin
saisp8-Jul-07 21:14
saisp8-Jul-07 21:14 
GeneralRe: Loading bmp in button Pin
Hamid_RT8-Jul-07 21:27
Hamid_RT8-Jul-07 21:27 
GeneralRe: Loading bmp in button Pin
saisp8-Jul-07 23:45
saisp8-Jul-07 23:45 
QuestionRe: Loading bmp in button Pin
David Crow9-Jul-07 2:49
David Crow9-Jul-07 2:49 
QuestionHelp on saving bitmap to .bmp file [modified] Pin
Llasus8-Jul-07 19:08
Llasus8-Jul-07 19:08 
Hello and good day to all,
I am currently working on a project where I can patch together a number of bitmaps and make them as one. It also has options of resizing the bitmap before saving it by removing some bytes here and there. Because of the limitation in CreateCompatibleBitmap() on large files, what I do is I store the needed data on BITMAPINFOHEADER and BITMAPFILEHEADER and I also have a char * for saving the actual data of the bitmap.

Here is where the problem starts. I have a 3200 x 3200 and easily saves it on a bitmap, then I can also reload and resize and make it into half (1600 x 1600) then saves it and it works(I can see it in the explorer). However, when I resize it to a third of a size (1067 x 1067), the bitmap file (when opened in explorer) won't show and even load. But when I resize it to a fourth of the original size it shows. These problem also occurred on the one-sixth of the original.

	BmapFHeader.bfType	  = 'MB';<br />
	BmapFHeader.bfSize      = (gBitMap.width * gBitMap.height * 3) + 54;		<br />
	BmapFHeader.bfReserved1 = 0x00;<br />
	BmapFHeader.bfReserved2 = 0x00;<br />
	BmapFHeader.bfOffBits   = 54;<br />
<br />
	BmapIHeader.biSize	  = 40;<br />
	BmapIHeader.biWidth	  = gBitMap.width;<br />
	BmapIHeader.biHeight	  = gBitMap.height;<br />
	BmapIHeader.biPlanes	  = 1;				<br />
	BmapIHeader.biBitCount    = 24;	<br />
	BmapIHeader.biCompression = BI_RGB;<br />
	BmapIHeader.biSizeImage   = gBitMap.width * gBitMap.height * 3;<br />
	BmapIHeader.biXPelsPerMeter = 0x00;<br />
	BmapIHeader.biYPelsPerMeter = 0x00;<br />
	BmapIHeader.biClrUsed	    = 0x00;<br />
	BmapIHeader.biClrImportant  = 0x00;


Above is the BITMAPINFOHEADER and BITMAPFILEHEADER and I write it to the file, and afterwards I write the data. I double checked every parameter but all of them seems correct. Its just weird that it works on certain sizes while does not work on some. I am hoping that someone here might know the answer. Please help me out! Thank you very much!

Edit: Already solved! 24bitmaps that I am processing needs to have a row which is divisible by 4. Many thanks to Whitesky for the immediate attention and help, Naveen.R for the suggestions, and specially to Paresh Chitte for the great articles that solved my problem. Thanks also to the others for the time and effort!


-- modified at 3:15 Monday 9th July, 2007
AnswerRe: Help on saving bitmap to .bmp file Pin
Hamid_RT8-Jul-07 19:27
Hamid_RT8-Jul-07 19:27 
GeneralRe: Help on saving bitmap to .bmp file Pin
Llasus8-Jul-07 19:30
Llasus8-Jul-07 19:30 
GeneralRe: Help on saving bitmap to .bmp file Pin
Hamid_RT8-Jul-07 19:37
Hamid_RT8-Jul-07 19:37 
GeneralRe: Help on saving bitmap to .bmp file Pin
Llasus8-Jul-07 19:48
Llasus8-Jul-07 19:48 
GeneralRe: Help on saving bitmap to .bmp file Pin
Hamid_RT8-Jul-07 20:44
Hamid_RT8-Jul-07 20:44 
GeneralRe: Help on saving bitmap to .bmp file Pin
Llasus8-Jul-07 21:11
Llasus8-Jul-07 21:11 
AnswerRe: Help on saving bitmap to .bmp file Pin
Paresh Chitte8-Jul-07 19:39
Paresh Chitte8-Jul-07 19:39 
GeneralRe: Help on saving bitmap to .bmp file Pin
Llasus8-Jul-07 19:54
Llasus8-Jul-07 19:54 
GeneralRe: Help on saving bitmap to .bmp file Pin
Paresh Chitte8-Jul-07 20:18
Paresh Chitte8-Jul-07 20:18 
GeneralRe: Help on saving bitmap to .bmp file Pin
Llasus8-Jul-07 20:21
Llasus8-Jul-07 20:21 
GeneralRe: Help on saving bitmap to .bmp file Pin
Naveen8-Jul-07 20:34
Naveen8-Jul-07 20:34 
GeneralRe: Help on saving bitmap to .bmp file Pin
Llasus8-Jul-07 20:40
Llasus8-Jul-07 20:40 
QuestionHow do I access the pixels on the screen to read them? Pin
sbscb8-Jul-07 18:07
sbscb8-Jul-07 18:07 
AnswerRe: How do I access the pixels on the screen to read them? Pin
Hamid_RT8-Jul-07 19:15
Hamid_RT8-Jul-07 19:15 
AnswerRe: How do I access the pixels on the screen to read them? Pin
Llasus8-Jul-07 19:22
Llasus8-Jul-07 19:22 
GeneralRe: How do I access the pixels on the screen to read them? Pin
Perspx8-Jul-07 19:33
Perspx8-Jul-07 19:33 
GeneralRe: How do I access the pixels on the screen to read them? Pin
Llasus8-Jul-07 19:51
Llasus8-Jul-07 19:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.