Changeset 21 in dev
- Timestamp:
- Dec 29, 2006, 12:25:04 AM (18 years ago)
- Location:
- ProjectEditor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ProjectEditor/IconEditor.cpp
r3 r21 275 275 } 276 276 i=GetFileSize(hFile,NULL); 277 buffer=(char *) GlobalAlloc(GMEM_FIXED,i+1);277 buffer=(char *)HeapAlloc(hHeap,0,i+1); 278 278 ReadFile(hFile,buffer,i,&dw,NULL); 279 279 CloseHandle(hFile); … … 283 283 pIconDir=(ICONDIR *)buffer; 284 284 IconNum=pIconDir->idCount; 285 bool FileOk = true; 285 286 for(i=0;i<IconNum;i++){ 286 287 pIconDirEntry=(ICONDIRENTRY *)(buffer+sizeof(ICONDIR)+sizeof(ICONDIRENTRY)*i); … … 290 291 291 292 dwBytesInRes[i]=pIconDirEntry->dwBytesInRes; 293 294 //対応チェック 295 BITMAPINFOHEADER *pBmpInfoHdr=(BITMAPINFOHEADER *)pImageBuffer[i]; 296 if( !(pBmpInfoHdr->biBitCount == 4 || pBmpInfoHdr->biBitCount == 8 ) ){ 297 //16色、256色以外の場合 298 //未対応 299 FileOk = false; 300 } 292 301 } 293 302 … … 295 304 lstrcat(str,str2); 296 305 mdic.szTitle=str; 306 307 HeapDefaultFree(buffer); 308 309 if( !FileOk ){ 310 for(i=0;i<IconNum;i++){ 311 HeapDefaultFree( pImageBuffer[i] ); 312 } 313 314 char msg[1024]; 315 sprintf( msg, "\"%s\"\n\n16色または256色以外の形式のファイルには対応していません。", filepath ); 316 MessageBox( hOwner, msg, "ActiveBasic", MB_OK | MB_ICONEXCLAMATION ); 317 return; 318 } 297 319 } 298 320 else{ -
ProjectEditor/IconEditor_Main.cpp
r3 r21 309 309 pBmpInfoHdr=(BITMAPINFOHEADER *)MdiInfo[WndNum].MdiIconEditInfo->pIconImage[MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum]; 310 310 311 if( !(pBmpInfoHdr->biBitCount == 4 || pBmpInfoHdr->biBitCount == 8 ) ){ 312 //16色、256色以外の場合 313 //未対応 314 return; 315 } 316 311 317 hPen=CreatePen(PS_SOLID,0,RGB(200,200,200)); 312 318 hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiIconEditInfo->memdc,hPen); … … 362 368 //////////////// 363 369 // 通常ピクセル 364 switch(pBmpInfoHdr->biBitCount){ 365 case 4: //16色 366 i2=*(pBuffer+i/2); 367 if(i%2==0) i2>>=4; 368 i2&=0x0F; 369 ColorRef=RGB(pRgbq[i2].rgbRed,pRgbq[i2].rgbGreen,pRgbq[i2].rgbBlue); 370 break; 371 case 8: //256色 372 i2=pBuffer[i]; 373 ColorRef=RGB(pRgbq[i2].rgbRed,pRgbq[i2].rgbGreen,pRgbq[i2].rgbBlue); 374 break; 375 } 370 if( pBmpInfoHdr->biBitCount == 4 ){ 371 //16色 372 i2=*(pBuffer+i/2); 373 if(i%2==0) i2>>=4; 374 i2&=0x0F; 375 ColorRef=RGB(pRgbq[i2].rgbRed,pRgbq[i2].rgbGreen,pRgbq[i2].rgbBlue); 376 } 377 else if( pBmpInfoHdr->biBitCount == 8 ){ 378 //256色 379 i2=pBuffer[i]; 380 ColorRef=RGB(pRgbq[i2].rgbRed,pRgbq[i2].rgbGreen,pRgbq[i2].rgbBlue); 381 break; 382 } 383 376 384 hBrush=CreateSolidBrush(ColorRef); 377 385 hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum].MdiIconEditInfo->memdc,hBrush);
Note:
See TracChangeset
for help on using the changeset viewer.