PNG Example

Nobori Symbology MIL-STD-2525 C++ SDK PNG rasterization example.

The example below shows just how easily a C or C++ language program can call the straightforward and logical C++ API of the Nobori Symbology MIL-STD-2525 SDK to generate an ARGB32 format raster image and even write it to a PNG file. 

#include 

static void basic_test()
{
	MilSymbolStartup();
	const char *style =
		"{fill:true}"
		"{frame:true}"
		"{infoFields:true}"
		"{engagementType:TARGET}"
		"{colorMode:Medium}"
		"{infoBackground:grey}"
		"{infoColor:orange}"
		"{outlineColor:false}"
		"{infoOutlineColor:black}"
		"{outlineWidth:2}"
		"{infoOutlineWidth:2}"
		"{hqStaffLength:120}"
		"{infoSize:40}";

	const char *description =
		"{sidc:10031020231205005801}"
		"{reinforcedReduced:F}"
		"{staffComments:G}"
		"{additionalInformation:H}"
		"{evaluationRating:J}"
		"{combatEffectiveness:K}"
		"{signatureEquipment:L}"
		"{higherFormation:M}"
		"{hostile:N}"
		"{iffSif:P}"
		"{direction:331.2}"
		"{uniqueDesignation:T}"
		"{type:V}"
		"{dtg:W}"
		"{altitudeDepth:X}"
		"{location:Y}"
		"{speed:Z}"
		"{engagementBar:AO}";

	MilSymbolContextRef context = MilSymbolContextCreate();
	MilSymbolContextSetStyle(context, style);
	MilSymbolRef symbol = MilSymbolContextGenerateSymbol(context, description);
	if (symbol)
	{
		MilSymbolCanvasRef canvas = MilSymbolSymbolAsCanvas(symbol, MILSYMBOL_CANVASFORMAT_ARGB32, 1);
		if (canvas)
		{
			MilSymbolCanvasWriteFile(canvas, "basic_test.png");
			MilSymbolCanvasDestroy(canvas);
		}
		MilSymbolDestroySymbol(symbol);
	}

	MilSymbolContextRelease(context);
	MilSymbolShutdown();
}
Scroll to top
0
    0
    Your Cart
    Your cart is emptyReturn to Shop