Changeset 4 for trunk/common_functions/img_funcs.c
- Timestamp:
- Jul 13, 2017, 5:17:57 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/common_functions/img_funcs.c
r2 r4 2 2 This file conatins functions for loading image files. 3 3 */ 4 4 5 #define INCL_PM 6 #define INCL_OS2MM 5 7 #define INCL_MMIOOS2 6 8 … … 18 20 /* This function loads a supported image file. */ 19 21 /* Every format for which MMOS2 has an IO procedure */ 20 /* may be used here. */ 22 /* may be used here. In contrast to */ 23 /* ImgLoadImageFile() a provided BMPINFOHEADER2 */ 24 /* structure is filled with data. */ 25 /* */ 21 26 /* */ 22 27 /* @@RETURNS */ … … 24 29 /* HBITMAP hBitmap */ 25 30 /* */ 26 /* HAndle to the bitmap of NULL. */ 31 /* Handle to the bitmap or NULL. */ 32 /* */ 33 /* @@PARAM */ 34 /* */ 35 /* PSZ pszFileName input */ 36 /* */ 37 /* Name of the image file to load. */ 38 /* */ 39 /* @@PARAM */ 40 /* */ 41 /* PBITMAPINFOHEADER2 pBMPInfoHeader2 in/out */ 42 /* */ 43 /* Pointer to a BITMAPINFOHEADER2 structure. */ 44 /* */ 45 /* */ 46 /* @@REMARKS */ 47 /* */ 48 /* The caller must free the bitmap handle after */ 49 /* use. */ 27 50 /* */ 28 51 /*!!*************************************************/ 29 HBITMAP ImgLoadImageFile ( PSZ pszFileName)52 HBITMAP ImgLoadImageFileAndHeader( PSZ pszFileName, PBITMAPINFOHEADER2 pBMPInfoHeader2) 30 53 { 31 54 HBITMAP hbm; 32 HBITMAP hbmTarget;33 55 MMIOINFO mmioinfo; 34 56 MMFORMATINFO mmFormatInfo; 35 57 HMMIO hmmio; 36 37 58 ULONG ulImageHeaderLength; 59 MMIMAGEHEADER mmImgHdr; 38 60 ULONG ulBytesRead; 39 61 ULONG dwNumRowBytes; … … 131 153 return (0L); 132 154 } 133 /* 134 memcpy(pBMPInfoHeader2, &mmImgHdr.mmXDIBHeader.BMPInfoHeader2, 135 sizeof(BITMAPINFOHEADER2)+256*sizeof(RGB2) ); 136 */ 155 137 156 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 157 *pBMPInfoHeader2=mmImgHdr.mmXDIBHeader.BMPInfoHeader2; 138 158 139 159 /* … … 226 246 NULL); 227 247 228 #if 0229 hbm = GpiCreateBitmap ( hps,230 pBMPInfoHeader2,231 0L,232 NULL,233 NULL);234 #endif235 236 248 if ( !hbm ) 237 249 { … … 250 262 return(0L); 251 263 } 252 /* 253 // *************************************************** 254 // Select the bitmap into the memory device context. 255 // ***************************************************/ 264 /**************************************************** 265 Select the bitmap into the memory device context. 266 ***************************************************/ 256 267 hbReturnCode = GpiSetBitmap ( hps, 257 268 hbm ); 258 /* 259 //*************************************************************** 260 // LOAD THE BITMAP DATA FROM THE FILE 261 // One line at a time, starting from the BOTTOM 262 //*************************************************************** */ 269 /*************************************************************** 270 LOAD THE BITMAP DATA FROM THE FILE 271 One line at a time, starting from the BOTTOM 272 ****************************************************************/ 263 273 264 274 for ( dwRowCount = 0; dwRowCount < dwHeight; dwRowCount++ ) … … 294 304 295 305 296 BOOL ImgGetBmpInfoHeader(PBITMAPINFOHEADER2 bmpih2, PSZ pszFileName /*, char* procName, ULONG ulLength*/) 306 /*!**************************************************/ 307 /* */ 308 /* @@DESC */ 309 /* */ 310 /* This function loads a supported image file. */ 311 /* Every format for which MMOS2 has an IO procedure */ 312 /* may be used here. */ 313 /* */ 314 /* @@PARAM */ 315 /* */ 316 /* PSZ pszFileName input */ 317 /* */ 318 /* Name of the image file to load. */ 319 /* */ 320 /* @@RETURNS */ 321 /* */ 322 /* HBITMAP hBitmap */ 323 /* */ 324 /* Handle to the bitmap of NULL. */ 325 /* */ 326 /*!!*************************************************/ 327 HBITMAP ImgLoadImageFile ( PSZ pszFileName ) 328 { 329 BITMAPINFOHEADER2 bmpih2; 330 331 return ImgLoadImageFileAndHeader ( pszFileName, &bmpih2 ); 332 } 333 334 335 336 /*!**************************************************/ 337 /* */ 338 /* @@DESC */ 339 /* */ 340 /* Build a BITMAPINFOHEADER2 for the given file. */ 341 /* */ 342 /* @@PARAM */ 343 /* */ 344 /* PSZ pszFileName input */ 345 /* */ 346 /* Name of the image file. */ 347 /* */ 348 /* @@PARAM */ 349 /* */ 350 /* PBITMAPINFOHEADER2 pBMPInfoHeader2 in/out */ 351 /* */ 352 /* Pointer to a BITMAPINFOHEADER2 structure. */ 353 /* */ 354 /* @@RETURNS */ 355 /* */ 356 /* TRUE on success, FALSE otherwise */ 357 /* */ 358 /*!!*************************************************/ 359 BOOL ImgGetBmpInfoHeader(PSZ pszFileName, PBITMAPINFOHEADER2 bmpih2) 297 360 { 298 361 MMIOINFO mmioinfo; … … 305 368 ULONG ulReturnCode; 306 369 ULONG ulBytesRead; 307 char *pName;308 370 309 // if(procName)310 // procName[0]=0;311 312 371 /* Check file size */ 313 372 if(SysQueryFileSize(pszFileName)==0)
Note:
See TracChangeset
for help on using the changeset viewer.