Archicad 28 C++ API
Loading...
Searching...
No Matches
Unit and image conversion

Functions providing conversion between different measurement units and different image types. More...

Classes

struct  API_UnitConversionData
 Input and output struct for ACAPI_Conversion_GetConvertedUnitValue. More...
 
struct  API_PictureHandle
 Structure for picture conversion. More...
 
struct  API_MimePicture
 Structure for picture conversion using MIME identifier. More...
 

Enumerations

enum  API_UnitConversionPrefID {
  APIUnitConv_WorkModel , APIUnitConv_WorkLayout , APIUnitConv_WorkAngle , APIUnitConv_DimLinear ,
  APIUnitConv_DimAngle , APIUnitConv_DimRadial , APIUnitConv_DimLevel , APIUnitConv_DimElevation ,
  APIUnitConv_DimDoorWindow , APIUnitConv_DimParapet , APIUnitConv_DimArea , APIUnitConv_CalcLength ,
  APIUnitConv_CalcArea , APIUnitConv_CalcVolume , APIUnitConv_CalcAngle
}
 Describes the supported Project Preferences to use with ACAPI_Conversion_GetConvertedUnitValue.
 

Functions

GSErrCode ACAPI_Conversion_GetConvertedUnitValue (API_UnitConversionData *api_unitConvData)
 Returns the value of a physical property (length/area/volume/angle) in the unit of the given Project Preference.
 
GSErrCode ACAPI_Conversion_ConvertPicture (API_PictureHandle *oldPict, API_PictureHandle *newPict)
 Converts a picture into another image format.
 
GSErrCode ACAPI_Conversion_ConvertMimePicture (API_MimePicture *mimePicture)
 Converts a picture into another image format using MIME types.
 
GS::Guid & APIGuid2GSGuid (API_Guid &guid)
 Converting from API_Guid to a GS::Guid.
 
const GS::Guid & APIGuid2GSGuid (const API_Guid &guid)
 Converting from API_Guid to GS::Guid.
 
API_GuidGSGuid2APIGuid (GS::Guid &guid)
 Converting from GS::Guid to API_Guid.
 
const API_GuidGSGuid2APIGuid (const GS::Guid &guid)
 Converting from GS::Guid to API_Guid.
 
API_Guid APIGuidFromString (const char *str)
 Converting from a string to an API_Guid.
 
GS::UniString APIGuidToString (const API_Guid &guid)
 Converting the API_Guid to a GS::UniString.
 

Detailed Description

Functions providing conversion between different measurement units and different image types.

Function Documentation

◆ ACAPI_Conversion_ConvertMimePicture()

GSErrCode ACAPI_Conversion_ConvertMimePicture ( API_MimePicture mimePicture)

Converts a picture into another image format using MIME types.

Parameters
mimePicture[in/out] Parameters of the source and the destination picture.
Returns
  • NoError - The function has completed with success.
  • APIERR_BADPARS - The input parameters are not given correctly (see API_MimePicture)
  • APIERR_MEMFULL - Not enough memory to create the new pictHdl
Remarks
This function is used to convert a picture from one standard image format to an other. The image formats are specified with MIME (Multi-purpose Internet Mail Extensions) types. MIME types of the most commonly used image formats:
Image type MIME type
Windows Bitmap image/x-bmp
GIF image/gif
TIFF image/tiff
JPEG image/jpeg
Pict image/pict
SGI image/x-sgi
Photoshop Image image/x-photoshop
PNG image/png
MacPaint Image image/x-macpaint
Truevision TGA image/x-targa
QuickTime Image image/x-quicktime

You can pass a special output type "vnd/DIB" to create a device independent bitmap on Windows. Conversion from one pixel depth to another is not supported at the moment. You can use the ACAPI_Conversion_ConvertPicture goody function for converting images with API_PictureFormat identifiers rather than MIME types. Remember to dispose the returned outputHdl when it is not needed any more. See more options at the description of the API_MimePicture structure.

Example
Converting a TIFF figure placed on the floorplan into a PNG format image:

◆ ACAPI_Conversion_ConvertPicture()

GSErrCode ACAPI_Conversion_ConvertPicture ( API_PictureHandle oldPict,
API_PictureHandle newPict 
)

Converts a picture into another image format.

Parameters
oldPict[in] Parameters of the source picture. The old format and data must be passed in the storageFormat and pictHdl fields, respectively.
newPict[in/out] Parameters of the destination picture. The new format of the picture must be passed in the storageFormat field. The pictHdl field will be returned according to the specified format.
Returns
  • NoError - The function has completed with success.
  • APIERR_BADPARS - parameters are nullptr or storage formats are invalid
  • APIERR_MEMFULL - Not enough memory to create the new pictHdl
Remarks
This function is used to convert a picture from one standard image format to an other. Any picture format can be passed in both the input and output parameters. See also ACAPI_Conversion_ConvertMimePicture if you want to specify the image format using MIME types.

◆ ACAPI_Conversion_GetConvertedUnitValue()

GSErrCode ACAPI_Conversion_GetConvertedUnitValue ( API_UnitConversionData api_unitConvData)

Returns the value of a physical property (length/area/volume/angle) in the unit of the given Project Preference.

Parameters
api_unitConvData[in/out] You can specify in it the value to convert, and the Project Preference with which to convert. The environment function returns the converted value, extra accuracy and unit string in the same struct.
Returns
  • NoError - The function has completed with success.
  • APIERR_BADPARS - api_unitConvData is nullptr, or api_unitConvData->unitConvPref is invalid.
Remarks
api_unitConvData->value has to be given in m/m²/m³/radian. The converted value will be returned in string format, as it would appear in Archicad.

◆ APIGuid2GSGuid() [1/2]

GS::Guid & APIGuid2GSGuid ( API_Guid guid)
inline

Converting from API_Guid to a GS::Guid.

Parameters
guidThe API_Guid to convert.
Returns
Converted guid.

◆ APIGuid2GSGuid() [2/2]

const GS::Guid & APIGuid2GSGuid ( const API_Guid guid)
inline

Converting from API_Guid to GS::Guid.

Parameters
guidThe API_Guid to convert.
Returns
Converted guid.

◆ APIGuidFromString()

API_Guid APIGuidFromString ( const char *  str)
inline

Converting from a string to an API_Guid.

Parameters
strString representation of guid.
Returns
Converted guid.

◆ APIGuidToString()

GS::UniString APIGuidToString ( const API_Guid guid)
inline

Converting the API_Guid to a GS::UniString.

Parameters
guidThe API_Guid to convert.
Returns
Guid represented in GS::UniString.

◆ GSGuid2APIGuid() [1/2]

const API_Guid & GSGuid2APIGuid ( const GS::Guid &  guid)
inline

Converting from GS::Guid to API_Guid.

Parameters
guidThe GS::Guid to convert.
Returns
Converted guid.

◆ GSGuid2APIGuid() [2/2]

API_Guid & GSGuid2APIGuid ( GS::Guid &  guid)
inline

Converting from GS::Guid to API_Guid.

Parameters
guidThe GS::Guid to convert.
Returns
Converted guid.