1 //  ----------------------------------------------------------------------------
2 //  MODULE    : ImageInfoIO.cpp
3 //  LANGUAGE  : C++
4 //  CREATOR   : Philippe BOSSUT
5 //  MODIFIOR  : Yue Zhang
6 //  DATE    : Thursday, February 22, 1996
7 //  DESCRIPTION : This file contains functions implementing FlashPixIO functions
8 //          in FPXBaselineIO.h
9 //  COMMENTS  : Functions in the file support read and write 9 property groups
10 //          in Image Info Property set
11 //
12 //      SCCSID          : @(#)imginfio.cpp  1.6 13:18:07 02 Jun 1997
13 //  ----------------------------------------------------------------------------
14 //  Copyright (c) 1999 Digital Imaging Group, Inc.
15 //  For conditions of distribution and use, see copyright notice
16 //  in Flashpix.h
17 //  ----------------------------------------------------------------------------
18 
19 //  ----------------------------------------------------------------------------
20   #include "imginfio.h"
21 //  ----------------------------------------------------------------------------
22 
23 //  Includes
24 //  --------
25 
26 #ifndef OLECommun_h
27   #include "olecomm.h"
28 #endif
29 #ifndef OLECore_h
30   #include "olecore.h"
31 #endif
32 #ifndef OLEProperties_h
33   #include  "oleprop.h"
34 #endif
35 
36 #ifndef FileFlashPixIO_h
37   #include "f_fpxio.h"
38 #endif
39 #ifndef FPXImageView_h
40   #include "fpximgvw.h"
41 #endif
42 #ifndef FlashPixFormat_h
43   #include "fpxformt.h"
44 #endif
45 #ifndef FlashPixUtils_h
46   #include "fpxutils.h"
47 #endif
48 
49 //  Constants
50 //  ---------
51 
52 //  Variables
53 //  ---------
54 
55 //  ----------------------------------------------------------------------------
56 //  Internal Functions
57 //  ----------------------------------------------------------------------------
58 
59 //  ----------------------------------------------------------------------------
60 //  Member Functions
61 //  ----------------------------------------------------------------------------
62 
63 //  ----------------------------------------------------------------------------
64 //  External Functions
65 //  This is the interface of the Baseline FlashPix IO Toolkit
66 //  ----------------------------------------------------------------------------
67 
68 //  ----------------------------------------------------------------------------
69 //  Image Info Property Set (a.k.a. Non-Image data): File Source Group
70 //  ----------------------------------------------------------------------------
71 
FPX_SetSourceGroup(FPXImageHandle * theFPX,FPXFileSourceGroup * theSourceGroup)72 FPXStatus FPX_SetSourceGroup (
73         FPXImageHandle*     theFPX,
74           FPXFileSourceGroup* theSourceGroup)
75 {
76   FPXStatus status = FPX_OK;
77   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
78   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
79 
80   if (filePtr) {
81     OLEProperty* aProp;
82 
83     if (theSourceGroup->file_source_valid)
84       if (filePtr->SetImageInfoProperty (PID_FileSource, TYP_FileSource, &aProp))
85         *aProp = (int32_t)(theSourceGroup->file_source);
86 
87     if (theSourceGroup->scene_type_valid)
88       if (filePtr->SetImageInfoProperty (PID_SceneType, TYP_SceneType, &aProp))
89         *aProp = (int32_t)(theSourceGroup->scene_type);
90 
91     if (theSourceGroup->creation_path_valid)
92       if (filePtr->SetImageInfoProperty (PID_CreationPath, TYP_CreationPath, &aProp))
93         *aProp = (FPXLongArray)theSourceGroup->creation_path;
94 
95     if (theSourceGroup->name_man_release_valid)
96       if (filePtr->SetImageInfoProperty (PID_SoftwareName, TYP_SoftwareName, &aProp))
97         *aProp = (FPXWideStr)theSourceGroup->name_man_release;
98 
99     if (theSourceGroup->user_defined_id_valid)
100       if (filePtr->SetImageInfoProperty (PID_UserDefinedID, TYP_UserDefinedID, &aProp))
101         *aProp = (FPXWideStr)theSourceGroup->user_defined_id;
102 
103     if (theSourceGroup->original_sharpness_approximation_valid)
104       if (filePtr->SetImageInfoProperty (PID_Sharpness, TYP_Sharpness, &aProp))
105         *aProp = (float)(theSourceGroup->original_sharpness_approximation);
106 
107     filePtr->Commit();
108   } else
109     status = FPX_INVALID_FPX_HANDLE;
110 
111   return status;
112 }
113 
FPX_GetSourceGroup(FPXImageHandle * theFPX,FPXFileSourceGroup * theSourceGroup)114 FPXStatus FPX_GetSourceGroup (
115         FPXImageHandle*     theFPX,
116         FPXFileSourceGroup* theSourceGroup)
117 {
118   FPXStatus status = FPX_OK;
119   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
120   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
121 
122   if (filePtr) {
123     OLEProperty* aProp;
124 
125     if (filePtr->GetImageInfoProperty (PID_FileSource, &aProp)) {
126       theSourceGroup->file_source = (FPXSource)((int32_t)(*aProp));
127       if (theSourceGroup->file_source > FPX_COMPUTER_GRAPHICS)
128         theSourceGroup->file_source = FPX_UNIDENTIFIED_SOURCE;
129       theSourceGroup->file_source_valid = true;
130     } else
131       theSourceGroup->file_source_valid = false;
132 
133     if (filePtr->GetImageInfoProperty (PID_SceneType, &aProp)) {
134       theSourceGroup->scene_type = (FPXScene)((int32_t)(*aProp));
135       if (theSourceGroup->scene_type > FPX_DIGITAL_SCENE_GENERATION)
136         theSourceGroup->scene_type = FPX_UNIDENTIFIED_SCENE;
137       theSourceGroup->scene_type_valid = true;
138     } else
139       theSourceGroup->scene_type_valid = false;
140 
141     if (filePtr->GetImageInfoProperty (PID_CreationPath, &aProp)) {
142       theSourceGroup->creation_path = (FPXLongArray)(*aProp);
143       theSourceGroup->creation_path_valid = true;
144     } else
145       theSourceGroup->creation_path_valid = false;
146 
147     if (filePtr->GetImageInfoProperty (PID_SoftwareName, &aProp)) {
148       theSourceGroup->name_man_release = (FPXWideStr)(*aProp);
149       theSourceGroup->name_man_release_valid = true;
150     } else
151       theSourceGroup->name_man_release_valid = false;
152 
153     if (filePtr->GetImageInfoProperty (PID_UserDefinedID, &aProp)) {
154       theSourceGroup->user_defined_id = (FPXWideStr)(*aProp);
155       theSourceGroup->user_defined_id_valid = true;
156     } else
157       theSourceGroup->user_defined_id_valid = false;
158 
159     if (filePtr->GetImageInfoProperty (PID_Sharpness, &aProp)) {
160       theSourceGroup->original_sharpness_approximation = (float)(*aProp);
161       theSourceGroup->original_sharpness_approximation_valid = true;
162     } else
163       theSourceGroup->original_sharpness_approximation_valid = false;
164 
165 
166   } else
167     status = FPX_INVALID_FPX_HANDLE;
168 
169   return status;
170 }
171 
172 //  ----------------------------------------------------------------------------
173 //  Image Info Property Set (a.k.a. Non-Image data): Intellectual Property Group
174 //  ----------------------------------------------------------------------------
175 
FPX_SetIntellectualPropGroup(FPXImageHandle * theFPX,FPXIntellectualPropertyGroup * thePropGroup)176 FPXStatus FPX_SetIntellectualPropGroup (
177         FPXImageHandle*     theFPX,
178               FPXIntellectualPropertyGroup*  thePropGroup)
179 {
180   FPXStatus status = FPX_OK;
181   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
182   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
183 
184   if (filePtr) {
185     OLEProperty* aProp;
186 
187     if (thePropGroup->copyright_valid)
188       if (filePtr->SetImageInfoProperty (PID_Copyright, TYP_Copyright, &aProp))
189         *aProp = (FPXWideStr)(thePropGroup->copyright);
190 
191     if (thePropGroup->legal_broker_for_orig_image_valid)
192       if (filePtr->SetImageInfoProperty (PID_OriginalBroker, TYP_OriginalBroker, &aProp))
193         *aProp = (FPXWideStr)(thePropGroup->legal_broker_for_orig_image);
194 
195     if (thePropGroup->legal_broker_for_digital_image_valid)
196       if (filePtr->SetImageInfoProperty (PID_DigitalBroker, TYP_DigitalBroker, &aProp))
197         *aProp = (FPXWideStr)(thePropGroup->legal_broker_for_digital_image);
198 
199     if (thePropGroup->authorship_valid)
200       if (filePtr->SetImageInfoProperty (PID_Authorship, TYP_Authorship, &aProp))
201         *aProp = (FPXWideStr)(thePropGroup->authorship);
202 
203     if (thePropGroup->intellectual_prop_notes_valid)
204       if (filePtr->SetImageInfoProperty (PID_PropertyNotes, TYP_PropertyNotes, &aProp))
205         *aProp = (FPXWideStr)(thePropGroup->intellectual_prop_notes);
206 
207     filePtr->Commit();
208   } else
209     status = FPX_INVALID_FPX_HANDLE;
210 
211   return status;
212 }
213 
FPX_GetIntellectualPropGroup(FPXImageHandle * theFPX,FPXIntellectualPropertyGroup * thePropGroup)214 FPXStatus FPX_GetIntellectualPropGroup (
215         FPXImageHandle*     theFPX,
216         FPXIntellectualPropertyGroup*     thePropGroup)
217 {
218   FPXStatus status = FPX_OK;
219   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
220   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
221 
222   if (filePtr) {
223     OLEProperty* aProp;
224 
225     if (filePtr->GetImageInfoProperty (PID_Copyright, &aProp)) {
226       thePropGroup->copyright = (FPXWideStr)(*aProp);
227       thePropGroup->copyright_valid = true;
228     } else
229       thePropGroup->copyright_valid = false;
230 
231     if (filePtr->GetImageInfoProperty (PID_OriginalBroker, &aProp)) {
232       thePropGroup->legal_broker_for_orig_image = (FPXWideStr)(*aProp);
233       thePropGroup->legal_broker_for_orig_image_valid = true;
234     } else
235       thePropGroup->legal_broker_for_orig_image_valid = false;
236 
237     if (filePtr->GetImageInfoProperty (PID_DigitalBroker, &aProp)) {
238       thePropGroup->legal_broker_for_digital_image = (FPXWideStr)(*aProp);
239       thePropGroup->legal_broker_for_digital_image_valid = true;
240     } else
241       thePropGroup->legal_broker_for_digital_image_valid = false;
242 
243     if (filePtr->GetImageInfoProperty (PID_Authorship, &aProp)) {
244       thePropGroup->authorship = (FPXWideStr)(*aProp);
245       thePropGroup->authorship_valid = true;
246     } else
247       thePropGroup->authorship_valid = false;
248 
249     if (filePtr->GetImageInfoProperty (PID_PropertyNotes, &aProp)) {
250       thePropGroup->intellectual_prop_notes = (FPXWideStr)(*aProp);
251       thePropGroup->intellectual_prop_notes_valid = true;
252     } else
253       thePropGroup->intellectual_prop_notes_valid = false;
254 
255 
256   } else
257     status = FPX_INVALID_FPX_HANDLE;
258 
259   return status;
260 }
261 
262 //  ----------------------------------------------------------------------------
263 //  Image Info Property Set (a.k.a. Non-Image data): Content Description Group
264 //  ----------------------------------------------------------------------------
265 
FPX_SetContentDescriptionGroup(FPXImageHandle * theFPX,FPXContentDescriptionGroup * theContentGroup)266 FPXStatus FPX_SetContentDescriptionGroup (
267         FPXImageHandle*     theFPX,
268               FPXContentDescriptionGroup*    theContentGroup)
269 {
270   FPXStatus status = FPX_OK;
271   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
272   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
273 
274   if (filePtr) {
275     OLEProperty* aProp;
276 
277     if (theContentGroup->test_target_in_the_image_valid)
278       if (filePtr->SetImageInfoProperty (PID_TestTargetType, TYP_TestTargetType, &aProp))
279         *aProp = theContentGroup->test_target_in_the_image;
280 
281     if (theContentGroup->group_caption_valid)
282       if (filePtr->SetImageInfoProperty (PID_GroupCaption, TYP_GroupCaption, &aProp))
283         *aProp = (FPXWideStr)(theContentGroup->group_caption);
284 
285     if (theContentGroup->caption_text_valid)
286       if (filePtr->SetImageInfoProperty (PID_CaptionText, TYP_CaptionText, &aProp))
287         *aProp = (FPXWideStr)(theContentGroup->caption_text);
288 
289     if (theContentGroup->people_in_the_image_valid)
290       if (filePtr->SetImageInfoProperty (PID_PeopleInTheImage, TYP_PeopleInTheImage, &aProp))
291         *aProp = (FPXWideStrArray)(theContentGroup->people_in_the_image);
292 
293     if (theContentGroup->things_in_image_valid)
294       if (filePtr->SetImageInfoProperty (PID_ThingsInTheImage, TYP_ThingsInTheImage, &aProp))
295         *aProp = (FPXWideStrArray)(theContentGroup->things_in_image);
296 
297     if (theContentGroup->date_of_original_image_valid)
298       if (filePtr->SetImageInfoProperty (PID_DateOfTheOriginal, TYP_DateOfTheOriginal, &aProp))
299         *aProp = (FILETIME)(theContentGroup->date_of_original_image);
300 
301     if (theContentGroup->events_in_the_image_valid)
302       if (filePtr->SetImageInfoProperty (PID_EventsInTheImage, TYP_EventsInTheImage, &aProp))
303         *aProp = (FPXWideStrArray)(theContentGroup->events_in_the_image);
304 
305     if (theContentGroup->places_in_the_valid)
306       if (filePtr->SetImageInfoProperty (PID_PlacesInTheImage, TYP_PlacesInTheImage, &aProp))
307         *aProp = (FPXWideStrArray)(theContentGroup->places_in_the);
308 
309     if (theContentGroup->content_description_notes_valid)
310       if (filePtr->SetImageInfoProperty (PID_DescriptionNotes, TYP_DescriptionNotes, &aProp))
311         *aProp = (FPXWideStr)(theContentGroup->content_description_notes);
312 
313     filePtr->Commit();
314   } else
315     status = FPX_INVALID_FPX_HANDLE;
316 
317   return status;
318 }
319 
FPX_GetContentDescriptionGroup(FPXImageHandle * theFPX,FPXContentDescriptionGroup * theContentGroup)320 FPXStatus FPX_GetContentDescriptionGroup (
321         FPXImageHandle*     theFPX,
322               FPXContentDescriptionGroup*    theContentGroup)
323 {
324   FPXStatus status = FPX_OK;
325   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
326   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
327 
328   if (filePtr) {
329     OLEProperty* aProp;
330 
331     if (filePtr->GetImageInfoProperty (PID_TestTargetType, &aProp)) {
332       theContentGroup->test_target_in_the_image = *aProp;
333       theContentGroup->test_target_in_the_image_valid = true;
334     } else
335       theContentGroup->test_target_in_the_image_valid = false;
336 
337     if (filePtr->GetImageInfoProperty (PID_GroupCaption, &aProp)) {
338       theContentGroup->group_caption = (FPXWideStr)(*aProp);
339       theContentGroup->group_caption_valid = true;
340     } else
341       theContentGroup->group_caption_valid = false;
342 
343     if (filePtr->GetImageInfoProperty (PID_CaptionText, &aProp)) {
344       theContentGroup->caption_text = (FPXWideStr)(*aProp);
345       theContentGroup->caption_text_valid = true;
346     } else
347       theContentGroup->caption_text_valid = false;
348 
349     if (filePtr->GetImageInfoProperty (PID_PeopleInTheImage, &aProp)) {
350       theContentGroup->people_in_the_image = (FPXWideStrArray)(*aProp);
351       theContentGroup->people_in_the_image_valid = true;
352     } else
353       theContentGroup->people_in_the_image_valid = false;
354 
355     if (filePtr->GetImageInfoProperty (PID_ThingsInTheImage, &aProp)) {
356       theContentGroup->things_in_image = (FPXWideStrArray)(*aProp);
357       theContentGroup->things_in_image_valid = true;
358     } else
359       theContentGroup->things_in_image_valid = false;
360 
361     if (filePtr->GetImageInfoProperty (PID_DateOfTheOriginal, &aProp)) {
362       theContentGroup->date_of_original_image = (FILETIME)(*aProp);
363       theContentGroup->date_of_original_image_valid = true;
364     } else
365       theContentGroup->date_of_original_image_valid = false;
366 
367     if (filePtr->GetImageInfoProperty (PID_EventsInTheImage, &aProp)) {
368       theContentGroup->events_in_the_image = (FPXWideStrArray)(*aProp);
369       theContentGroup->events_in_the_image_valid = true;
370     } else
371       theContentGroup->events_in_the_image_valid = false;
372 
373     if (filePtr->GetImageInfoProperty (PID_PlacesInTheImage, &aProp)) {
374       theContentGroup->places_in_the = (FPXWideStrArray)(*aProp);
375       theContentGroup->places_in_the_valid = true;
376     } else
377       theContentGroup->places_in_the_valid = false;
378 
379     if (filePtr->GetImageInfoProperty (PID_DescriptionNotes, &aProp)) {
380       theContentGroup->content_description_notes = (FPXWideStr)(*aProp);
381       theContentGroup->content_description_notes_valid = true;
382     } else
383       theContentGroup->content_description_notes_valid = false;
384 
385   } else
386     status = FPX_INVALID_FPX_HANDLE;
387 
388   return status;
389 }
390 
391 //  ----------------------------------------------------------------------------
392 //  Image Info Property Set (a.k.a. Non-Image data): Camera Information Group
393 //  ----------------------------------------------------------------------------
394 
FPX_SetCameraInformationGroup(FPXImageHandle * theFPX,FPXCameraInformationGroup * theCameraGroup)395 FPXStatus FPX_SetCameraInformationGroup (
396         FPXImageHandle*               theFPX,
397               FPXCameraInformationGroup*    theCameraGroup)
398 {
399   FPXStatus status = FPX_OK;
400   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
401   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
402 
403   if (filePtr) {
404     OLEProperty* aProp;
405 
406     if (theCameraGroup->camera_manufacturer_name_valid)
407       if (filePtr->SetImageInfoProperty (PID_CameraManufacturer, TYP_CameraManufacturer, &aProp))
408         *aProp = (FPXWideStr)(theCameraGroup->camera_manufacturer_name);
409 
410     if (theCameraGroup->camera_model_name_valid)
411       if (filePtr->SetImageInfoProperty (PID_CameraModel, TYP_CameraModel, &aProp))
412         *aProp = (FPXWideStr)(theCameraGroup->camera_model_name);
413 
414     if (theCameraGroup->camera_serial_number_valid)
415       if (filePtr->SetImageInfoProperty (PID_CameraSerialNumber, TYP_CameraSerialNumber, &aProp))
416         *aProp = (FPXWideStr)(theCameraGroup->camera_serial_number);
417 
418     filePtr->Commit();
419   } else
420     status = FPX_INVALID_FPX_HANDLE;
421 
422   return status;
423 }
424 
FPX_GetCameraInformationGroup(FPXImageHandle * theFPX,FPXCameraInformationGroup * theCameraGroup)425 FPXStatus FPX_GetCameraInformationGroup (
426         FPXImageHandle*               theFPX,
427               FPXCameraInformationGroup*    theCameraGroup)
428 {
429   FPXStatus status = FPX_OK;
430   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
431   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
432 
433   if (filePtr) {
434     OLEProperty* aProp;
435 
436     if (filePtr->GetImageInfoProperty (PID_CameraManufacturer, &aProp)) {
437       theCameraGroup->camera_manufacturer_name = (FPXWideStr)(*aProp);
438       theCameraGroup->camera_manufacturer_name_valid = true;
439     } else
440       theCameraGroup->camera_manufacturer_name_valid = false;
441 
442     if (filePtr->GetImageInfoProperty (PID_CameraModel, &aProp)) {
443       theCameraGroup->camera_model_name = (FPXWideStr)(*aProp);
444       theCameraGroup->camera_model_name_valid = true;
445     } else
446       theCameraGroup->camera_model_name_valid = false;
447 
448     if (filePtr->GetImageInfoProperty (PID_CameraSerialNumber, &aProp)) {
449       theCameraGroup->camera_serial_number = (FPXWideStr)(*aProp);
450       theCameraGroup->camera_serial_number_valid = true;
451     } else
452       theCameraGroup->camera_serial_number_valid = false;
453 
454   } else
455     status = FPX_INVALID_FPX_HANDLE;
456 
457   return status;
458 }
459 
460 //  ------------------------------------------------------------------------------------
461 //  Image Info Property Set (a.k.a. Non-Image data): Per Picture Camera Settings Group
462 //  ------------------------------------------------------------------------------------
463 
FPX_SetPerPictureGroup(FPXImageHandle * theFPX,FPXPerPictureCameraSettingsGroup * thePerPictureGroup)464 FPXStatus FPX_SetPerPictureGroup (
465         FPXImageHandle*                      theFPX,
466               FPXPerPictureCameraSettingsGroup*    thePerPictureGroup)
467 {
468   FPXStatus status = FPX_OK;
469   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
470   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
471 
472   if (filePtr) {
473     OLEProperty* aProp;
474 
475     // capture_date is not consistent with TYP_CaptureDate
476     if (thePerPictureGroup->capture_date_valid)
477       if (filePtr->SetImageInfoProperty (PID_CaptureDate, TYP_CaptureDate, &aProp))
478         *aProp = (FILETIME)(thePerPictureGroup->capture_date);
479 
480     if (thePerPictureGroup->exposure_time_valid)
481       if (filePtr->SetImageInfoProperty (PID_ExposureTime, TYP_ExposureTime, &aProp))
482         *aProp = (float)(thePerPictureGroup->exposure_time);
483 
484     if (thePerPictureGroup->f_number_valid)
485       if (filePtr->SetImageInfoProperty (PID_F_Number, TYP_F_Number, &aProp))
486         *aProp = (float)(thePerPictureGroup->f_number);
487 
488     if (thePerPictureGroup->exposure_program_valid)
489       if (filePtr->SetImageInfoProperty (PID_ExposureProgram, TYP_ExposureProgram, &aProp))
490         *aProp = (uint32_t)(FPXExposureProgram)(thePerPictureGroup->exposure_program);
491 
492     if (thePerPictureGroup->brightness_value_valid)
493       if (filePtr->SetImageInfoProperty (PID_BrightnessValue, TYP_BrightnessValue, &aProp))
494         *aProp = (FPXRealArray)(thePerPictureGroup->brightness_value);
495 
496     if (thePerPictureGroup->exposure_bias_value_valid)
497       if (filePtr->SetImageInfoProperty (PID_ExposureBiasValue, TYP_ExposureBiasValue, &aProp))
498         *aProp = (float)(thePerPictureGroup->exposure_bias_value);
499 
500     if (thePerPictureGroup->subject_distance_valid)
501       if (filePtr->SetImageInfoProperty (PID_SubjectDistance, TYP_SubjectDistance, &aProp))
502         *aProp = (FPXRealArray)(thePerPictureGroup->subject_distance);
503 
504     if (thePerPictureGroup->metering_mode_valid)
505       if (filePtr->SetImageInfoProperty (PID_MeteringMode, TYP_MeteringMode, &aProp))
506         *aProp = (uint32_t)(FPXMeteringMode)(thePerPictureGroup->metering_mode);
507 
508     if (thePerPictureGroup->scene_illuminant_valid)
509       if (filePtr->SetImageInfoProperty (PID_SceneIlluminant, TYP_SceneIlluminant, &aProp))
510         *aProp = (uint32_t)(FPXSceneIlluminant)(thePerPictureGroup->scene_illuminant);
511 
512     if (thePerPictureGroup->focal_length_valid)
513       if (filePtr->SetImageInfoProperty (PID_FocalLength, TYP_FocalLength, &aProp))
514         *aProp = (float)(thePerPictureGroup->focal_length);
515 
516     if (thePerPictureGroup->maximum_aperature_value_valid)
517       if (filePtr->SetImageInfoProperty (PID_ApertureValue, TYP_ApertureValue, &aProp))
518         *aProp = (float)(thePerPictureGroup->maximum_aperature_value);
519 
520     if (thePerPictureGroup->flash_valid)
521       if (filePtr->SetImageInfoProperty (PID_Flash, TYP_Flash, &aProp))
522         *aProp = (uint32_t)(FPXFlash)(thePerPictureGroup->flash);
523 
524     if (thePerPictureGroup->flash_energy_valid)
525       if (filePtr->SetImageInfoProperty (PID_FlashEnergy, TYP_FlashEnergy, &aProp))
526         *aProp = (float)(thePerPictureGroup->flash_energy);
527 
528     if (thePerPictureGroup->flash_return_valid)
529       if (filePtr->SetImageInfoProperty (PID_FlashReturn, TYP_FlashReturn, &aProp))
530         *aProp = (uint32_t)(FPXFlashReturn)(thePerPictureGroup->flash_return);
531 
532     if (thePerPictureGroup->back_light_valid)
533       if (filePtr->SetImageInfoProperty (PID_BackLight, TYP_BackLight, &aProp))
534         *aProp = (uint32_t)(FPXBackLight)(thePerPictureGroup->back_light);
535 
536     if (thePerPictureGroup->subject_location_valid)
537       if (filePtr->SetImageInfoProperty (PID_SubjectLocation, TYP_SubjectLocation, &aProp))
538         *aProp = (FPXRealArray)(thePerPictureGroup->subject_location);
539 
540     if (thePerPictureGroup->exposure_index_valid)
541       if (filePtr->SetImageInfoProperty (PID_ExposureIndex, TYP_ExposureIndex, &aProp))
542         *aProp = (float)(thePerPictureGroup->exposure_index);
543 
544     if (thePerPictureGroup->special_effects_optical_filter_valid)
545       if (filePtr->SetImageInfoProperty (PID_OpticalFilter, TYP_OpticalFilter, &aProp))
546         *aProp = (FPXLongArray)(thePerPictureGroup->special_effects_optical_filter);
547 
548 
549     if (thePerPictureGroup->per_picture_notes_valid)
550       if (filePtr->SetImageInfoProperty (PID_PerPictureNotes, TYP_PerPictureNotes, &aProp))
551         *aProp = (FPXWideStr)(thePerPictureGroup->per_picture_notes);
552 
553     filePtr->Commit();
554   } else
555     status = FPX_INVALID_FPX_HANDLE;
556 
557   return status;
558 }
559 
FPX_GetPerPictureGroup(FPXImageHandle * theFPX,FPXPerPictureCameraSettingsGroup * thePerPictureGroup)560 FPXStatus FPX_GetPerPictureGroup (
561         FPXImageHandle*                      theFPX,
562               FPXPerPictureCameraSettingsGroup*    thePerPictureGroup)
563 {
564   FPXStatus status = FPX_OK;
565   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
566   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
567 
568   if (filePtr) {
569     OLEProperty* aProp;
570 
571     // capture_date may not be FPXStr
572     if (filePtr->GetImageInfoProperty (PID_CaptureDate, &aProp)) {
573       thePerPictureGroup->capture_date = (FILETIME)(*aProp);
574       thePerPictureGroup->capture_date_valid = true;
575     } else
576       thePerPictureGroup->capture_date_valid = false;
577 
578     if (filePtr->GetImageInfoProperty (PID_ExposureTime, &aProp)) {
579       thePerPictureGroup->exposure_time = (float)(*aProp);
580       thePerPictureGroup->exposure_time_valid = true;
581     } else
582       thePerPictureGroup->exposure_time_valid = false;
583 
584     if (filePtr->GetImageInfoProperty (PID_F_Number, &aProp)) {
585       thePerPictureGroup->f_number = (float)(*aProp);
586       thePerPictureGroup->f_number_valid = true;
587     } else
588       thePerPictureGroup->f_number_valid = false;
589 
590     if (filePtr->GetImageInfoProperty (PID_ExposureProgram, &aProp)) {
591       thePerPictureGroup->exposure_program = (FPXExposureProgram)(uint32_t)(*aProp);
592       if (thePerPictureGroup->exposure_program > FPX_LANDSCAPE_MODE)
593         thePerPictureGroup->exposure_program = FPX_UNIDENTIFIED_EXPOSURE_PROGRAM;
594       thePerPictureGroup->exposure_program_valid = true;
595     } else
596       thePerPictureGroup->exposure_program_valid = false;
597 
598     if (filePtr->GetImageInfoProperty (PID_BrightnessValue, &aProp)) {
599       thePerPictureGroup->brightness_value = (FPXRealArray)(*aProp);
600       thePerPictureGroup->brightness_value_valid = true;
601     } else
602       thePerPictureGroup->brightness_value_valid = false;
603 
604     if (filePtr->GetImageInfoProperty (PID_ExposureBiasValue, &aProp)) {
605       thePerPictureGroup->exposure_bias_value = (float)(*aProp);
606       thePerPictureGroup->exposure_bias_value_valid = true;
607     } else
608       thePerPictureGroup->exposure_bias_value_valid = false;
609 
610     if (filePtr->GetImageInfoProperty (PID_SubjectDistance, &aProp)) {
611       thePerPictureGroup->subject_distance = (FPXRealArray)(*aProp);
612       thePerPictureGroup->subject_distance_valid = true;
613     } else
614       thePerPictureGroup->subject_distance_valid = false;
615 
616     if (filePtr->GetImageInfoProperty (PID_MeteringMode, &aProp)) {
617       thePerPictureGroup->metering_mode = (FPXMeteringMode)(uint32_t)(*aProp);
618       if (thePerPictureGroup->metering_mode > FPX_MULTI_SPOT)
619         thePerPictureGroup->metering_mode = FPX_UNIDENTIFED_METERING_MODE;
620       thePerPictureGroup->metering_mode_valid = true;
621     } else
622       thePerPictureGroup->metering_mode_valid = false;
623 
624     if (filePtr->GetImageInfoProperty (PID_SceneIlluminant, &aProp)) {
625       thePerPictureGroup->scene_illuminant = (FPXSceneIlluminant)(uint32_t)(*aProp);
626       if (thePerPictureGroup->scene_illuminant > FPX_D75_ILLUMINANT)
627         thePerPictureGroup->scene_illuminant = FPX_UNIDENTIFIED_SCENE_ILLUMINANT;
628       thePerPictureGroup->scene_illuminant_valid = true;
629     } else
630       thePerPictureGroup->scene_illuminant_valid = false;
631 
632     if (filePtr->GetImageInfoProperty (PID_FocalLength, &aProp)) {
633       thePerPictureGroup->focal_length = (float)(*aProp);
634       thePerPictureGroup->focal_length_valid = true;
635     } else
636       thePerPictureGroup->focal_length_valid = false;
637 
638     if (filePtr->GetImageInfoProperty (PID_ApertureValue, &aProp)) {
639       thePerPictureGroup->maximum_aperature_value = (float)(*aProp);
640       thePerPictureGroup->maximum_aperature_value_valid = true;
641     } else
642       thePerPictureGroup->maximum_aperature_value_valid = false;
643 
644     if (filePtr->GetImageInfoProperty (PID_Flash, &aProp)) {
645       thePerPictureGroup->flash = (FPXFlash)(uint32_t)(*aProp);
646       if (thePerPictureGroup->flash > FPX_FLASH_USED)
647         thePerPictureGroup->flash = FPX_FLASH_USE_UNKNOWN;
648       thePerPictureGroup->flash_valid = true;
649     } else
650       thePerPictureGroup->flash_valid = false;
651 
652     if (filePtr->GetImageInfoProperty (PID_FlashEnergy, &aProp)) {
653       thePerPictureGroup->flash_energy = (float)(*aProp);
654       thePerPictureGroup->flash_energy_valid = true;
655     } else
656       thePerPictureGroup->flash_energy_valid = false;
657 
658     if (filePtr->GetImageInfoProperty (PID_FlashReturn, &aProp)) {
659       thePerPictureGroup->flash_return = (FPXFlashReturn)(uint32_t)(*aProp);
660       if (thePerPictureGroup->flash_return > FPX_SUBJECT_INSIDE_FLASH_RANGE)
661         thePerPictureGroup->flash_return = FPX_NOT_A_CAMERA_FEATURE_FLASH_RETURN;
662       thePerPictureGroup->flash_return_valid = true;
663     } else
664       thePerPictureGroup->flash_return_valid = false;
665 
666     if (filePtr->GetImageInfoProperty (PID_BackLight, &aProp)) {
667       thePerPictureGroup->back_light = (FPXBackLight)(uint32_t)(*aProp);
668       if (thePerPictureGroup->back_light > FPX_BACK_LIT2)
669         thePerPictureGroup->back_light = FPX_NOT_A_CAMERA_FEATURE_BACKLIGHT;
670       thePerPictureGroup->back_light_valid = true;
671     } else
672       thePerPictureGroup->back_light_valid = false;
673 
674     if (filePtr->GetImageInfoProperty (PID_SubjectLocation, &aProp)) {
675       thePerPictureGroup->subject_location = (FPXRealArray)(*aProp);
676       thePerPictureGroup->subject_location_valid = true;
677     } else
678       thePerPictureGroup->subject_location_valid = false;
679 
680     if (filePtr->GetImageInfoProperty (PID_ExposureIndex, &aProp)) {
681       thePerPictureGroup->exposure_index = (float)(*aProp);
682       thePerPictureGroup->exposure_index_valid = true;
683     } else
684       thePerPictureGroup->exposure_index_valid = false;
685 
686     if (filePtr->GetImageInfoProperty (PID_OpticalFilter, &aProp)) {
687       thePerPictureGroup->special_effects_optical_filter = (FPXLongArray)(*aProp);
688       thePerPictureGroup->special_effects_optical_filter_valid = true;
689     } else
690       thePerPictureGroup->special_effects_optical_filter_valid = false;
691 
692     if (filePtr->GetImageInfoProperty (PID_PerPictureNotes, &aProp)) {
693       thePerPictureGroup->per_picture_notes = (FPXWideStr)(*aProp);
694       thePerPictureGroup->per_picture_notes_valid = true;
695     } else
696       thePerPictureGroup->per_picture_notes_valid = false;
697 
698   } else
699     status = FPX_INVALID_FPX_HANDLE;
700 
701   return status;
702 }
703 
704 //  ------------------------------------------------------------------------------------
705 //  Image Info Property Set (a.k.a. Non-Image data): Digital Camera Characterization Group
706 //  ------------------------------------------------------------------------------------
707 
FPX_SetDigitalCameraGroup(FPXImageHandle * theFPX,FPXDigitalCameraCharacterizationGroup * theDigitalCameraGroup)708 FPXStatus FPX_SetDigitalCameraGroup (
709         FPXImageHandle*                        theFPX,
710               FPXDigitalCameraCharacterizationGroup* theDigitalCameraGroup)
711 {
712   FPXStatus status = FPX_OK;
713   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
714   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
715 
716   if (filePtr) {
717     OLEProperty* aProp;
718 
719     if (theDigitalCameraGroup->sensing_method_valid)
720       if (filePtr->SetImageInfoProperty (PID_SensingMethod, TYP_SensingMethod, &aProp))
721         *aProp = (uint32_t)(FPXSensingMethod)(theDigitalCameraGroup->sensing_method);
722 
723     if (theDigitalCameraGroup->focal_plane_x_resolution_valid)
724       if (filePtr->SetImageInfoProperty (PID_FocalXResolution, TYP_FocalXResolution, &aProp))
725         *aProp = (float)(theDigitalCameraGroup->focal_plane_x_resolution);
726 
727     if (theDigitalCameraGroup->focal_plane_y_resolution_valid)
728       if (filePtr->SetImageInfoProperty (PID_FocalYResolution, TYP_FocalYResolution, &aProp))
729         *aProp = (float)(theDigitalCameraGroup->focal_plane_y_resolution);
730 
731     if (theDigitalCameraGroup->focal_plane_resolution_unit_valid)
732       if (filePtr->SetImageInfoProperty (PID_FocalResolutionUnit, TYP_FocalResolutionUnit, &aProp))
733         *aProp = (uint32_t)(FPXResolutionUnit)(theDigitalCameraGroup->focal_plane_resolution_unit);
734 
735     // PTCH_DCG - reinstated Spatial Frequency Response using OLEPROP.CPP conversions
736     if (theDigitalCameraGroup->spacial_frequency_valid)
737       if (filePtr->SetImageInfoProperty (PID_SpatialFrequencyResponse, TYP_SpatialFrequencyResponse, &aProp))
738     {
739         VECTOR *vec = FPXSpacialFrequencyResponseBlockToVector( theDigitalCameraGroup->spacial_frequency);
740         *aProp = vec;
741     }
742 
743     // PTCH_DCG - reinstated cfa_pattern using OLEPROP.CPP conversions
744     if (theDigitalCameraGroup->cfa_pattern_valid)
745       if (filePtr->SetImageInfoProperty (PID_CFAPattern, TYP_CFAPattern, &aProp))
746     {
747         VECTOR *vec = FPXCFA_PatternBlockToVector( theDigitalCameraGroup->cfa_pattern);
748         *aProp = vec;
749     }
750 
751     if (theDigitalCameraGroup->spectral_sensitivity_valid)
752       if (filePtr->SetImageInfoProperty (PID_SpectralSensitivity, TYP_SpectralSensitivity, &aProp))
753         *aProp = (FPXWideStr)(theDigitalCameraGroup->spectral_sensitivity);
754 
755     if (theDigitalCameraGroup->iso_speed_ratings_valid)
756       if (filePtr->SetImageInfoProperty (PID_ISOSpeedRatings, TYP_ISOSpeedRatings, &aProp))
757         *aProp = (FPXShortArray)(theDigitalCameraGroup->iso_speed_ratings);
758 
759     // PTCH_DCG - reinstated oecf using OLEPROP.CPP conversions
760     if (theDigitalCameraGroup->oecf_valid)
761       if (filePtr->SetImageInfoProperty (PID_OECF, TYP_OECF, &aProp)) {
762         VECTOR *vec = FPXOECF_BlockToVector( theDigitalCameraGroup->oecf);
763         *aProp = vec;
764       }
765     filePtr->Commit();
766   } else
767     status = FPX_INVALID_FPX_HANDLE;
768 
769   return status;
770 }
771 
FPX_GetDigitalCameraGroup(FPXImageHandle * theFPX,FPXDigitalCameraCharacterizationGroup * theDigitalCameraGroup)772 FPXStatus FPX_GetDigitalCameraGroup (
773         FPXImageHandle*                        theFPX,
774               FPXDigitalCameraCharacterizationGroup* theDigitalCameraGroup)
775 {
776   FPXStatus status = FPX_OK;
777   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
778   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
779 
780   if (filePtr) {
781     OLEProperty* aProp;
782 
783     if (filePtr->GetImageInfoProperty (PID_SensingMethod, &aProp)) {
784       theDigitalCameraGroup->sensing_method = (FPXSensingMethod)(uint32_t)(*aProp);
785       if (theDigitalCameraGroup->sensing_method > FPX_COLOR_SEQUENCIAL_LINEAR_SENSOR)
786         theDigitalCameraGroup->sensing_method = FPX_UNDEFINED;
787       theDigitalCameraGroup->sensing_method_valid = true;
788     } else
789       theDigitalCameraGroup->sensing_method_valid = false;
790 
791     if (filePtr->GetImageInfoProperty (PID_FocalXResolution, &aProp)) {
792       theDigitalCameraGroup->focal_plane_x_resolution = (float)(*aProp);
793       theDigitalCameraGroup->focal_plane_x_resolution_valid = true;
794     } else
795       theDigitalCameraGroup->focal_plane_x_resolution_valid = false;
796 
797     if (filePtr->GetImageInfoProperty (PID_FocalYResolution, &aProp)) {
798       theDigitalCameraGroup->focal_plane_y_resolution = (float)(*aProp);
799       theDigitalCameraGroup->focal_plane_y_resolution_valid = true;
800     } else
801       theDigitalCameraGroup->focal_plane_y_resolution_valid = false;
802 
803     if (filePtr->GetImageInfoProperty (PID_FocalResolutionUnit, &aProp)) {
804       theDigitalCameraGroup->focal_plane_resolution_unit = (FPXResolutionUnit)(uint32_t)(*aProp);
805       theDigitalCameraGroup->focal_plane_resolution_unit_valid = true;
806     } else
807       theDigitalCameraGroup->focal_plane_resolution_unit_valid = false;
808 
809     // PTCH_DCG - reinstated Spatial Frequency Response using OLEPROP.CPP conversions
810     if (filePtr->GetImageInfoProperty (PID_SpatialFrequencyResponse, &aProp)) {
811       theDigitalCameraGroup->spacial_frequency = (FPXSpacialFrequencyResponseBlock)(*aProp);
812       theDigitalCameraGroup->spacial_frequency_valid = true;
813     } else
814       theDigitalCameraGroup->spacial_frequency_valid = false;
815 
816     // PTCH_DCG - reinstated cfa_pattern
817     if (filePtr->GetImageInfoProperty (PID_CFAPattern, &aProp)) {
818       theDigitalCameraGroup->cfa_pattern = (FPXCFA_PatternBlock)(*aProp);
819       theDigitalCameraGroup->cfa_pattern_valid = true;
820     } else
821       theDigitalCameraGroup->cfa_pattern_valid = false;
822 
823 
824     if (filePtr->GetImageInfoProperty (PID_SpectralSensitivity, &aProp)) {
825       theDigitalCameraGroup->spectral_sensitivity = (FPXWideStr)(*aProp);
826       theDigitalCameraGroup->spectral_sensitivity_valid = true;
827     } else
828       theDigitalCameraGroup->spectral_sensitivity_valid = false;
829 
830     if (filePtr->GetImageInfoProperty (PID_ISOSpeedRatings, &aProp)) {
831       theDigitalCameraGroup->iso_speed_ratings = (FPXShortArray)(*aProp);
832       theDigitalCameraGroup->iso_speed_ratings_valid = true;
833     } else
834       theDigitalCameraGroup->iso_speed_ratings_valid = false;
835 
836     // PTCH_DCG - reinstated oecf using OLEPROP.CPP conversion
837     if (filePtr->GetImageInfoProperty (PID_OECF, &aProp)) {
838       theDigitalCameraGroup->oecf = (FPXOECF_Block)(*aProp);
839       theDigitalCameraGroup->oecf_valid = true;
840 
841     } else
842       theDigitalCameraGroup->oecf_valid = false;
843 
844   } else
845     status = FPX_INVALID_FPX_HANDLE;
846 
847   return status;
848 }
849 
850 //  ------------------------------------------------------------------------------------
851 //  Image Info Property Set (a.k.a. Non-Image data):  Film Description Group
852 //  ------------------------------------------------------------------------------------
853 
FPX_SetFilmDescriptionGroup(FPXImageHandle * theFPX,FPXFilmDescriptionGroup * theFilmGroup)854 FPXStatus FPX_SetFilmDescriptionGroup (
855         FPXImageHandle*          theFPX,
856               FPXFilmDescriptionGroup* theFilmGroup)
857 {
858   FPXStatus status = FPX_OK;
859   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
860   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
861 
862   if (filePtr) {
863     OLEProperty* aProp;
864 
865     if (theFilmGroup->film_brand_valid)
866       if (filePtr->SetImageInfoProperty (PID_FilmBrand, TYP_FilmBrand, &aProp))
867         *aProp = (FPXWideStr)(theFilmGroup->film_brand);
868 
869     if (theFilmGroup->film_category_valid)
870       if (filePtr->SetImageInfoProperty (PID_FilmCategory, TYP_FilmCategory, &aProp))
871         *aProp = (uint32_t)(FPXFilmCategory)(theFilmGroup->film_category);
872 
873     if (theFilmGroup->film_size_valid)
874       if (filePtr->SetImageInfoProperty (PID_FilmSize, TYP_FilmSize, &aProp)) {
875 
876         VECTOR vec;
877         vec.cElements = 3;
878         vec.pvar = new VARIANT[vec.cElements];
879 
880         V_VT(&vec.pvar[0]) = VT_R4;
881         V_R4(&vec.pvar[0]) = theFilmGroup->film_size_x;
882         V_VT(&vec.pvar[1]) = VT_R4;
883         V_R4(&vec.pvar[1]) = theFilmGroup->film_size_y;
884         V_VT(&vec.pvar[2]) = VT_UI2;
885         V_I2(&vec.pvar[2]) = (unsigned short)theFilmGroup->film_size_unit;
886 
887         *aProp = &vec;
888       }
889 
890     if (theFilmGroup->film_roll_number_valid)
891       if (filePtr->SetImageInfoProperty (PID_FilmRollNumber, TYP_FilmRollNumber, &aProp))
892         *aProp = theFilmGroup->film_roll_number;
893 
894     if (theFilmGroup->film_frame_number_valid)
895       if (filePtr->SetImageInfoProperty (PID_FilmFrameNumber, TYP_FilmFrameNumber, &aProp))
896         *aProp = theFilmGroup->film_frame_number;
897 
898     filePtr->Commit();
899   } else
900     status = FPX_INVALID_FPX_HANDLE;
901 
902   return status;
903 }
904 
FPX_GetFilmDescriptionGroup(FPXImageHandle * theFPX,FPXFilmDescriptionGroup * theFilmGroup)905 FPXStatus FPX_GetFilmDescriptionGroup (
906         FPXImageHandle*          theFPX,
907               FPXFilmDescriptionGroup* theFilmGroup)
908 {
909   FPXStatus status = FPX_OK;
910   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
911   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
912 
913   if (filePtr) {
914     OLEProperty* aProp;
915 
916     if (filePtr->GetImageInfoProperty (PID_FilmBrand, &aProp)) {
917       theFilmGroup->film_brand = (FPXWideStr)(*aProp);
918       theFilmGroup->film_brand_valid = true;
919     } else
920       theFilmGroup->film_brand_valid = false;
921 
922     if (filePtr->GetImageInfoProperty (PID_FilmCategory, &aProp)) {
923       theFilmGroup->film_category = (FPXFilmCategory)(uint32_t)(*aProp);
924       if (theFilmGroup->film_category > FPX_INTERNEGATIVE_COLOR)
925         theFilmGroup->film_category = FPX_UNIDENTIFIED;
926       theFilmGroup->film_category_valid = true;
927     } else
928       theFilmGroup->film_category_valid = false;
929 
930     if (filePtr->GetImageInfoProperty (PID_FilmSize, &aProp)) {
931       VECTOR * pvec = (VECTOR *)(*aProp);
932       theFilmGroup->film_size_x   = V_R4(&pvec->pvar[0]);
933       theFilmGroup->film_size_y   = V_R4(&pvec->pvar[1]);
934       theFilmGroup->film_size_unit= (FPXResolutionUnit)V_I2(&pvec->pvar[2]);
935       theFilmGroup->film_size_valid = true;
936     } else
937       theFilmGroup->film_size_valid = false;
938 
939     if (filePtr->GetImageInfoProperty (PID_FilmRollNumber, &aProp)) {
940       theFilmGroup->film_roll_number = *aProp;
941       theFilmGroup->film_roll_number_valid = true;
942     } else
943       theFilmGroup->film_roll_number_valid = false;
944 
945     if (filePtr->GetImageInfoProperty (PID_FilmFrameNumber, &aProp)) {
946       theFilmGroup->film_frame_number = *aProp;
947       theFilmGroup->film_frame_number_valid = true;
948     } else
949       theFilmGroup->film_frame_number_valid = false;
950 
951   } else
952     status = FPX_INVALID_FPX_HANDLE;
953 
954   return status;
955 }
956 
957 //  ------------------------------------------------------------------------------------
958 //  Image Info Property Set (a.k.a. Non-Image data):  Original Document Scan Description Group
959 //  ------------------------------------------------------------------------------------
960 
FPX_SetOriginalDocDescriptionGroup(FPXImageHandle * theFPX,FPXOriginalDocumentScanDescriptionGroup * theDocGroup)961 FPXStatus FPX_SetOriginalDocDescriptionGroup (
962         FPXImageHandle*                          theFPX,
963               FPXOriginalDocumentScanDescriptionGroup* theDocGroup)
964 {
965   FPXStatus status = FPX_OK;
966   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
967   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
968 
969   if (filePtr) {
970     OLEProperty* aProp;
971 
972     if (theDocGroup->original_scanned_image_size_valid)
973       if (filePtr->SetImageInfoProperty (PID_ScannedImageSize, TYP_ScannedImageSize, &aProp)) {
974         VECTOR vec;
975         vec.cElements = 3;
976         vec.pvar = new VARIANT[vec.cElements];
977 
978         V_VT(&vec.pvar[0]) = VT_R4;
979         V_R4(&vec.pvar[0]) = theDocGroup->original_scanned_image_size.original_size_x;
980         V_VT(&vec.pvar[1]) = VT_R4;
981         V_R4(&vec.pvar[1]) = theDocGroup->original_scanned_image_size.original_size_y;
982         V_VT(&vec.pvar[2]) = VT_UI2;
983         V_I2(&vec.pvar[2]) = (unsigned short)theDocGroup->original_scanned_image_size.original_size_unit;
984 
985         *aProp = &vec;
986       }
987 
988     if (theDocGroup->original_document_size_valid)
989       if (filePtr->SetImageInfoProperty (PID_DocumentSize, TYP_DocumentSize, &aProp)) {
990         VECTOR vec;
991         vec.cElements = 3;
992         vec.pvar = new VARIANT[vec.cElements];
993 
994         V_VT(&vec.pvar[0]) = VT_R4;
995         V_R4(&vec.pvar[0]) = theDocGroup->original_document_size.original_size_x;
996         V_VT(&vec.pvar[1]) = VT_R4;
997         V_R4(&vec.pvar[1]) = theDocGroup->original_document_size.original_size_y;
998         V_VT(&vec.pvar[2]) = VT_UI2;
999         V_I2(&vec.pvar[2]) = (unsigned short)theDocGroup->original_document_size.original_size_unit;
1000 
1001         *aProp = &vec;
1002       }
1003 
1004     if (theDocGroup->original_medium_valid)
1005       if (filePtr->SetImageInfoProperty (PID_OriginalMedium, TYP_OriginalMedium, &aProp))
1006         *aProp = (uint32_t)(FPXOriginalMedium)(theDocGroup->original_medium);
1007 
1008     if (theDocGroup->type_of_reflection_original_valid)
1009       if (filePtr->SetImageInfoProperty (PID_TypeOfOriginal, TYP_TypeOfOriginal, &aProp))
1010         *aProp = (uint32_t)(FPXTypeOfReflectionOriginal)(theDocGroup->type_of_reflection_original);
1011 
1012     filePtr->Commit();
1013   } else
1014     status = FPX_INVALID_FPX_HANDLE;
1015 
1016   return status;
1017 }
1018 
FPX_GetOriginalDocDescriptionGroup(FPXImageHandle * theFPX,FPXOriginalDocumentScanDescriptionGroup * theDocGroup)1019 FPXStatus FPX_GetOriginalDocDescriptionGroup (
1020         FPXImageHandle*                          theFPX,
1021               FPXOriginalDocumentScanDescriptionGroup* theDocGroup)
1022 {
1023   FPXStatus status = FPX_OK;
1024   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
1025   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
1026 
1027   if (filePtr) {
1028     OLEProperty* aProp;
1029 
1030     if (filePtr->GetImageInfoProperty (PID_ScannedImageSize, &aProp)) {
1031       VECTOR * pvec = (VECTOR *)(*aProp);
1032       theDocGroup->original_scanned_image_size.original_size_x = V_R4(&pvec->pvar[0]);
1033       theDocGroup->original_scanned_image_size.original_size_y = V_R4(&pvec->pvar[1]);
1034       theDocGroup->original_scanned_image_size.original_size_unit =
1035                           (FPXResolutionUnit)V_I2(&pvec->pvar[2]);
1036       theDocGroup->original_scanned_image_size_valid = true;
1037     } else
1038       theDocGroup->original_scanned_image_size_valid = false;
1039 
1040     if (filePtr->GetImageInfoProperty (PID_DocumentSize, &aProp)) {
1041       VECTOR * pvec = (VECTOR *)(*aProp);
1042       theDocGroup->original_document_size.original_size_x = V_R4(&pvec->pvar[0]);
1043       theDocGroup->original_document_size.original_size_y = V_R4(&pvec->pvar[1]);
1044       theDocGroup->original_document_size.original_size_unit =
1045                           (FPXResolutionUnit)V_I2(&pvec->pvar[2]);
1046       theDocGroup->original_document_size_valid = true;
1047     } else
1048       theDocGroup->original_document_size_valid = false;
1049 
1050     if (filePtr->GetImageInfoProperty (PID_OriginalMedium, &aProp)) {
1051       theDocGroup->original_medium = (FPXOriginalMedium)(uint32_t)(*aProp);
1052       if (theDocGroup->original_medium > FPX_LINE_ART)
1053         theDocGroup->original_medium = FPX_UNIDENTIFIED_ORIGINAL_MEDIUM;
1054       theDocGroup->original_medium_valid = true;
1055     } else
1056       theDocGroup->original_medium_valid = false;
1057 
1058     if (filePtr->GetImageInfoProperty (PID_TypeOfOriginal, &aProp)) {
1059       theDocGroup->type_of_reflection_original = (FPXTypeOfReflectionOriginal)(uint32_t)(*aProp);
1060       if (theDocGroup->type_of_reflection_original > FPX_COLOR_DOCUMENT)
1061         theDocGroup->type_of_reflection_original = FPX_UNIDENTIFIED_TYPE_OF_REFLECTION_ORIGINAL;
1062       theDocGroup->type_of_reflection_original_valid = true;
1063     } else
1064       theDocGroup->type_of_reflection_original_valid = false;
1065 
1066   } else
1067     status = FPX_INVALID_FPX_HANDLE;
1068 
1069   return status;
1070 }
1071 
1072 //  ------------------------------------------------------------------------------------
1073 //  Image Info Property Set (a.k.a. Non-Image data):  Scan Device Property Group
1074 //  ------------------------------------------------------------------------------------
1075 
FPX_SetScanDevicePropertyGroup(FPXImageHandle * theFPX,FPXScanDevicePropertyGroup * theScanGroup)1076 FPXStatus FPX_SetScanDevicePropertyGroup (
1077         FPXImageHandle*             theFPX,
1078               FPXScanDevicePropertyGroup* theScanGroup)
1079 {
1080   FPXStatus status = FPX_OK;
1081   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
1082   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
1083 
1084   if (filePtr) {
1085     OLEProperty* aProp;
1086 
1087     if (theScanGroup->scanner_manufacturer_name_valid)
1088       if (filePtr->SetImageInfoProperty (PID_ScannerManufacturer, TYP_ScannerManufacturer, &aProp))
1089         *aProp = (FPXWideStr)(theScanGroup->scanner_manufacturer_name);
1090 
1091     if (theScanGroup->scanner_model_name_valid)
1092       if (filePtr->SetImageInfoProperty (PID_ScannerModel, TYP_ScannerModel, &aProp))
1093         *aProp = (FPXWideStr)(theScanGroup->scanner_model_name);
1094 
1095     if (theScanGroup->scanner_serial_number_valid)
1096       if (filePtr->SetImageInfoProperty (PID_ScannerSerialNumber, TYP_ScannerSerialNumber, &aProp))
1097         *aProp = (FPXWideStr)(theScanGroup->scanner_serial_number);
1098 
1099     if (theScanGroup->scan_software_valid)
1100       if (filePtr->SetImageInfoProperty (PID_ScanSoftware, TYP_ScanSoftware, &aProp))
1101         *aProp = (FPXWideStr)(theScanGroup->scan_software);
1102 
1103     if (theScanGroup->scan_software_revision_date_valid)
1104       if (filePtr->SetImageInfoProperty (PID_ScanSoftRevDate, TYP_ScanSoftRevDate, &aProp))
1105         *aProp = (DATE)(theScanGroup->scan_software_revision_date);
1106 
1107     if (theScanGroup->service_bureau_org_name_valid)
1108       if (filePtr->SetImageInfoProperty (PID_ServiceBureau, TYP_ServiceBureau, &aProp))
1109         *aProp = (FPXWideStr)(theScanGroup->service_bureau_org_name);
1110 
1111     if (theScanGroup->scan_operator_id_valid)
1112       if (filePtr->SetImageInfoProperty (PID_ScanOperatorID, TYP_ScanOperatorID, &aProp))
1113         *aProp = (FPXWideStr)(theScanGroup->scan_operator_id);
1114 
1115     if (theScanGroup->scan_date_valid)
1116       if (filePtr->SetImageInfoProperty (PID_ScanDate, TYP_ScanDate, &aProp))
1117         *aProp = (FILETIME)(theScanGroup->scan_date);
1118 
1119     if (theScanGroup->last_modified_date_valid)
1120       if (filePtr->SetImageInfoProperty (PID_LastModifiedDate, TYP_LastModifiedDate, &aProp))
1121         *aProp = (FILETIME)(theScanGroup->last_modified_date);
1122 
1123     if (theScanGroup->scanner_pixel_size_valid)
1124       if (filePtr->SetImageInfoProperty (PID_ScannerPixelSize, TYP_ScannerPixelSize, &aProp))
1125         *aProp = (float)(theScanGroup->scanner_pixel_size);
1126 
1127     filePtr->Commit();
1128   } else
1129     status = FPX_INVALID_FPX_HANDLE;
1130 
1131   return status;
1132 }
1133 
FPX_GetScanDevicePropertyGroup(FPXImageHandle * theFPX,FPXScanDevicePropertyGroup * theScanGroup)1134 FPXStatus FPX_GetScanDevicePropertyGroup (
1135         FPXImageHandle*             theFPX,
1136               FPXScanDevicePropertyGroup* theScanGroup)
1137 {
1138   FPXStatus status = FPX_OK;
1139   PHierarchicalImage* image =  (PHierarchicalImage*)(theFPX->GetImage());
1140   PFlashPixFile* filePtr = (PFlashPixFile*)(image->GetCurrentFile());
1141 
1142   if (filePtr) {
1143     OLEProperty* aProp;
1144 
1145     if (filePtr->GetImageInfoProperty (PID_ScannerManufacturer, &aProp)) {
1146       theScanGroup->scanner_manufacturer_name = (FPXWideStr)(*aProp);
1147       theScanGroup->scanner_manufacturer_name_valid = true;
1148     } else
1149       theScanGroup->scanner_manufacturer_name_valid = false;
1150 
1151     if (filePtr->GetImageInfoProperty (PID_ScannerModel, &aProp)) {
1152       theScanGroup->scanner_model_name = (FPXWideStr)(*aProp);
1153       theScanGroup->scanner_model_name_valid = true;
1154     } else
1155       theScanGroup->scanner_model_name_valid = false;
1156 
1157     if (filePtr->GetImageInfoProperty (PID_ScannerSerialNumber, &aProp)) {
1158       theScanGroup->scanner_serial_number = (FPXWideStr)(*aProp);
1159       theScanGroup->scanner_serial_number_valid = true;
1160     } else
1161       theScanGroup->scanner_serial_number_valid = false;
1162 
1163     if (filePtr->GetImageInfoProperty (PID_ScanSoftware, &aProp)) {
1164       theScanGroup->scan_software = (FPXWideStr)(*aProp);
1165       theScanGroup->scan_software_valid = true;
1166     } else
1167       theScanGroup->scan_software_valid = false;
1168 
1169     if (filePtr->GetImageInfoProperty (PID_ScanSoftRevDate, &aProp)) {
1170       theScanGroup->scan_software_revision_date = (DATE)(*aProp);
1171       theScanGroup->scan_software_revision_date_valid = true;
1172     } else
1173       theScanGroup->scan_software_revision_date_valid = false;
1174 
1175     if (filePtr->GetImageInfoProperty (PID_ServiceBureau, &aProp)) {
1176       theScanGroup->service_bureau_org_name = (FPXWideStr)(*aProp);
1177       theScanGroup->service_bureau_org_name_valid = true;
1178     } else
1179       theScanGroup->service_bureau_org_name_valid = false;
1180 
1181     if (filePtr->GetImageInfoProperty (PID_ScanOperatorID, &aProp)) {
1182       theScanGroup->scan_operator_id = (FPXWideStr)(*aProp);
1183       theScanGroup->scan_operator_id_valid = true;
1184     } else
1185       theScanGroup->scan_operator_id_valid = false;
1186 
1187     if (filePtr->GetImageInfoProperty (PID_ScanDate, &aProp)) {
1188       theScanGroup->scan_date = (FILETIME)(*aProp);
1189       theScanGroup->scan_date_valid = true;
1190     } else
1191       theScanGroup->scan_date_valid = false;
1192 
1193     if (filePtr->GetImageInfoProperty (PID_LastModifiedDate, &aProp)) {
1194       theScanGroup->last_modified_date = (FILETIME)(*aProp);
1195       theScanGroup->last_modified_date_valid = true;
1196     } else
1197       theScanGroup->last_modified_date_valid = false;
1198 
1199     if (filePtr->GetImageInfoProperty (PID_ScannerPixelSize, &aProp)) {
1200       theScanGroup->scanner_pixel_size = (float)(*aProp);
1201       theScanGroup->scanner_pixel_size_valid = true;
1202     } else
1203       theScanGroup->scanner_pixel_size_valid = false;
1204 
1205   } else
1206     status = FPX_INVALID_FPX_HANDLE;
1207 
1208   return status;
1209 }
1210 
1211 
1212 
1213 //  - EOF ----------------------------------------------------------------------
1214