// intelbug.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "RastrTool.h"

int _tmain(int argc, _TCHAR* argv[])
{
	HRGN ergn = CreateEllipticRgn( 0, 0, 10, 10 );
	CRastrTool rastrTool;
	int     areaPolygonCount = 0, *areaPointInPolyCounts;    
	POINT * areaPoint;           
	int     areaPointsCount;     
	std::vector<char> rgnDataBuf(GetRegionData(ergn, 0, NULL));
	LPRGNDATA rgnData = (LPRGNDATA)&rgnDataBuf.front();
	double xxx = 0, yyy = 0;
    if( GetRegionData (ergn, rgnDataBuf.size(), rgnData) )
	{
		std::cout << "GetRegionData ok\n";
		if( RgnData2Poly(rgnData, &rastrTool) )
		{
			std::cout << "RgnData2Poly ok\n";
			if( rastrTool.GetPolyPolygon(&areaPolygonCount, &areaPointInPolyCounts, (long**)&areaPoint, &areaPointsCount) )
			{
				std::cout << "GetPolyPolygon ok:" << areaPointsCount << std::endl;
			} else
				std::cout << "GetPolyPolygon failed" << std::endl;
		} else
            std::cout << "RgnData2Poly failed" << std::endl;;
	} else
		std::cout << "GetRegionData failed\n";
	DeleteObject( ergn );
	return 0;
}

