Binary data |
Top Previous Next |
DFM-Translator > Special assignments > Binary data A special case when converting DFM files are binary data. Binary data are assigned for example to TIcon's or TBitmaps as in the following example:
object EllipseButton: TSpeedButton ... Glyph.Data = { 4E010000424D4E01000000000000760000002800000012000000120000000100 040000000000D800000000000000000000001000000010000000000000000000 80000080000000808000800000008000800080800000C0C0C000808080000000 FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333000000 3333330000003333003333330033330000003330333333333303330000003303 3333333333303300000030333333333333330300000030333333333333330300 0000033333333333333330000000033333333333333330000000033333333333 3333300000000333333333333333300000000333333333333333300000000333 3333333333333000000030333333333333330300000030333333333333330300 0000330333333333333033000000333033333333330333000000333300333333 003333000000333333000000333333000000}
Glyph is a TBitmap. But a TBitmap doesn't really has a Data property.Rather, Delphi reads and writes this data by means of the functions
ReadData(System::Classes::TStream* Stream) WriteData(System::Classes::TStream* Stream);
Delphi2Cpp converts this into:
AssignTBitmapData(EllipseButton, { 0x4E,0x01,0x00,0x00,0x42,0x4D,0x4E,0x01,0x00,0x00 ,0x00,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x28,0x00 ,0x00,0x00,0x12,0x00,0x00,0x00,0x12,0x00,0x00,0x00 ,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0xD8,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00 ,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x00,0x80,0x00 ,0x80,0x00,0x80,0x80,0x00,0x00,0xC0,0xC0,0xC0,0x00 ,0x80,0x80,0x80,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF ,0x00,0x00,0x00,0xFF,0xFF,0x00,0xFF,0x00,0x00,0x00 ,0xFF,0x00,0xFF,0x00,0xFF,0xFF,0x00,0x00,0xFF,0xFF ,0xFF,0x00,0x33,0x33,0x33,0x00,0x00,0x00,0x33,0x33 ,0x33,0x00,0x00,0x00,0x33,0x33,0x00,0x33,0x33,0x33 ,0x00,0x33,0x33,0x00,0x00,0x00,0x33,0x30,0x33,0x33 ,0x33,0x33,0x33,0x03,0x33,0x00,0x00,0x00,0x33,0x03 ,0x33,0x33,0x33,0x33,0x33,0x30,0x33,0x00,0x00,0x00 ,0x30,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x03,0x00 ,0x00,0x00,0x30,0x33,0x33,0x33,0x33,0x33,0x33,0x33 ,0x03,0x00,0x00,0x00,0x03,0x33,0x33,0x33,0x33,0x33 ,0x33,0x33,0x30,0x00,0x00,0x00,0x03,0x33,0x33,0x33 ,0x33,0x33,0x33,0x33,0x30,0x00,0x00,0x00,0x03,0x33 ,0x33,0x33,0x33,0x33,0x33,0x33,0x30,0x00,0x00,0x00 ,0x03,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x30,0x00 ,0x00,0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33,0x33 ,0x30,0x00,0x00,0x00,0x03,0x33,0x33,0x33,0x33,0x33 ,0x33,0x33,0x30,0x00,0x00,0x00,0x30,0x33,0x33,0x33 ,0x33,0x33,0x33,0x33,0x03,0x00,0x00,0x00,0x30,0x33 ,0x33,0x33,0x33,0x33,0x33,0x33,0x03,0x00,0x00,0x00 ,0x33,0x03,0x33,0x33,0x33,0x33,0x33,0x30,0x33,0x00 ,0x00,0x00,0x33,0x30,0x33,0x33,0x33,0x33,0x33,0x03 ,0x33,0x00,0x00,0x00,0x33,0x33,0x00,0x33,0x33,0x33 ,0x00,0x33,0x33,0x00,0x00,0x00,0x33,0x33,0x33,0x00 ,0x00,0x00,0x33,0x33,0x33,0x00,0x00,0x00 });
AssignTBitmapData belongs to the predefined DFM conversion routines and is declared in the helper file d2c_vcl.h which, will be included automatically.
void AssignTBitmapData(TSpeedButton* xp, const System::DynamicArray<System::Byte>& xBytes)
The creation of the DynamicArray only works if the use of the clang compiler is enabled in C++Builder. For the classic compiler an error "E2188: expression syntax" will be produced:
The dats of TClientDataSet are to large to be treated this way and can be suppressed.
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |