4D Pack v14

AP Is Picture Deprecated

Home

 
4D Pack v14
AP Is Picture Deprecated

AP Is Picture Deprecated 


 

AP Is Picture Deprecated ( ptrPict ) -> Function result 
Parameter Type   Description
ptrPict  Pointer in Pointer to picture field or variable to test
Function result  Longint in 0 = valid format, 1 = obsolete format (PICT)

The AP Is Picture Deprecated command returns 1 when the picture referenced by the ptrPict parameter contains the (obsolete) PICT format and 0 otherwise. A picture is considered as obsolete when it is in the PICT format or when it contains the PICT format (pictures inserted through drag-and-drop may include several formats). 

In ptrPict, pass a pointer to a 4D picture field or variable, or to an element in a 4D picture array that you want to test. 

This command is intended to prepare the development of your applications for the next major versions of 4D. In fact, the Mac "PICT" format was declared obsolete by Apple several Mac OS versions ago (see the description of the PICT format on Wikipedia). It was kept in 4D for compatibility's sake but it is no longer supported beginning with 4D v14. To prepare for the migration of your applications, you can start using this command now so as to detect all the PICT pictures in your database and convert them to a native format (such as PNG) using the CONVERT PICTURE command. Note that once converted to a format, pictures only contain this new format.

Note: Deleting the PICT format requires prior analysis in the case of pictures intended for printing. Since PICT was a vector format, it may be used particularly under Windows for printing, when present. So in this context, it is preferable to convert PICT pictures to another vector format, such as EMF for instance.

Example  

You want to test and convert all the pictures of the library if necessary:

 C_LONGINT($vlPict;$vPictCount;$vPictRef;$vTotal)
 C_TEXT($vPictName)
 C_POINTER($vPointer)
 C_PICTURE($vpPict)
 ARRAY TEXT($arrPictNames;0)
 ARRAY LONGINT($arrPictRefs;0)
 
 $vTotal:=0
 PICTURE LIBRARY LIST($arrPictRefs;$arrPictNames)
 $vPictCount:=Size of array($arrPictRefs)
 If($vPictCount>0)
    For($vlPict;1;$vPictCount// for each picture
       $vPictRef:=$arrPictRefs{$vlPict}
       $vPictName:=$arrPictNames{$vlPict}
       GET PICTURE FROM LIBRARY($arrPictRefs{$vlPict};$vpPict)
       $vPointer:=->$vpPict  // pass a pointer
       $isObs:=AP Is Picture Deprecated($vPointer)
       If($isObs=1) // if format is obsolete
          CONVERT PICTURE($vPointer->;".PNG") // conversion to png
  // and saving in library
          SET PICTURE TO LIBRARY($vPointer->;$vPictRef;$vPictName)
          $vTotal:=$vTotal+1
       End if
    End for
    ALERT(String($vTotal)+" picture(s) out of "+String($vPictCount)+" were converted to png.")
 Else
    ALERT("The picture library is empty.")
 End if

 
PROPERTIES 

Product: 4D Pack
Theme: 4D_Pack : Picture Files
Number: 61950

 
HISTORY 

Created: 4D Pack v13.2

 
SEE ALSO 


 
TAGS 

PICT

 
ARTICLE USAGE

4D Pack ( 4D Pack v13.2)
4D Pack ( 4D Pack v14 R2)
4D Pack ( 4D Pack v14)
4D Pack ( 4D Pack v14 R3)
4D Pack ( 4D Pack v14 R4)