Text Functions
Functions:
MTK_Object_Text_AppendRecord
int MTK_Object_Text_AppendRecord(MTK_Object* obj, const char* record);
Description
Append a record (line) to a text object.
Parameters
obj
pointer to an MTK_Object struct
record
the record (const char*)
Return Value
0
success
other
failure
MTK_Object_Text_DeleteAllRecords
int MTK_Object_Text_DeleteAllRecords(MTK_Object* obj);
Description
Delete all records (lines) of a text object.
Parameters
obj
pointer to an MTK_Object struct
Return Value
0
success
other
failure
MTK_Object_Text_DeleteRecord
int MTK_Object_Text_DeleteRecord(MTK_Object* obj, const int& index);
Description
Delete a specific record (line) of a text object.
Parameters
obj
pointer to an MTK_Object struct
index
the index of the record to delete (int)
Return Value
0
success
other
failure
MTK_Object_Text_GetAttributes
int MTK_Object_Text_GetAttributes( MTK_Object* obj, char* font, char* scale, double* angle, double* height, double* width, int* boxed );
Description
Get the attributes of a text object.
Parameters
obj
pointer to an MTK_Object struct
font
buffer of length MTK_BUFFER_SIZE to receive the font of the text (char*)
scale
buffer of length MTK_BUFFER_SIZE to receive the scale of the text (char*)
angle
angle of the text (double*)
height
height of the text (double*)
width
width of the text (double*)
boxed
whether the text is boxed or not (int*)
Return Value
0
success
other
failure
MTK_Object_Text_GetOrigin
int MTK_Object_Text_GetOrigin( MTK_Object* obj, double* x, double* y, double* z );
Description
Get the origin of a text object.
Parameters
obj
pointer to an MTK_Object struct
x
origin x value (double*)
y
origin y value (double*)
z
origin z value (double*)
Return Value
0
success
other
failure
MTK_Object_Text_GetRecord
int MTK_Object_Text_GetRecord(MTK_Object* obj, const int& index, char* record);
Description
Get a specific record (line) of a text object.
Parameters
obj
pointer to an MTK_Object struct
index
the index of the desired record (int)
record
buffer of length MTK_BUFFER_SIZE to receive the record at the index (char*)
Return Value
0
success
other
failure
MTK_Object_Text_NRecords
int MTK_Object_Text_NRecords(MTK_Object* obj);
Description
Get the number of records in a text object.
Parameters
obj
pointer to an MTK_Object struct
Return Value
int
number of records (lines) in the object
-1
failed
MTK_Object_Text_SetAttributes
int MTK_Object_Text_SetAttributes( MTK_Object* obj, const char* font, const char* scale, const double& angle, const double& height, const double& width, const int& boxed );
Description
Set the attributes of a text object. Passing a -1 or NULL will skip setting that attribute.
Parameters
obj
pointer to an MTK_Object struct
font
font of the text (const char*)
scale
scale of the text (const char*)
angle
angle of the text (double)
height
height of the text (double)
width
width of the text (double)
boxed
whether the text is boxed or not (int)
Return Value
0
success
other
failure
Example
// MTK_Object_Text_SetAttributes Example
int main()
{
int status;
// Authorisation code
// Get an MTK_Object* that is a DESIGN_TEXT
status = MTK_Object_Text_SetAttributes(
object,
NULL, // Leave font alone
NULL, // Leave scale alone
-1, // Leave angle alone
20, // Set height to 20
100, // Set width to 100
-1 // Leave boxed alone
);
if (status)
{
char error[MTK_BUFFER_SIZE];
MTK_API_GetError(error);
printf("%s\n", error);
return 1;
}
// Save the MTK_Object*
return 0;
}
MTK_Object_Text_SetOrigin
int MTK_Object_Text_SetOrigin( MTK_Object* obj, const double& x, const double& y, const double& z );
Description
Set the origin of a text object.
Parameters
obj
pointer to an MTK_Object struct
x
origin x value (double)
y
origin y value (double)
z
origin z value (double)
Return Value
0
success
other
failure
MTK_Object_Text_SetRecord
int MTK_Object_Text_SetRecord( MTK_Object* obj, const int& index, const char* record );
Description
Set a specific record (line) of a text object.
Parameters
obj
pointer to an MTK_Object struct
index
the desired index of the record (int)
record
the record (const char*)
Return Value
0
success
other
failure