Ejemplo n.º 1
0
/*==================================
	PatternToOffscreen
===================================*/
SUOffscreen *PTPatternView::BWPatternToOffscreen( const Pattern &inPattern )
{
	StSaveGWorld	save1;
	CTabHandle		theTable = nil;
	SUOffscreen		*theBuffer = nil;
	
	try
	{
		theTable = SUColorUtils::GetColorTable( 1 );
		
		theBuffer = SUOffscreen::CreateBuffer( DefaultPatternWidth, DefaultPatternHeight, 1, theTable );
		//theBuffer->AssignPalette( theTable );		
		
		theBuffer->BeginDrawing();
			Rect		r;
			::SetRect( &r, 0, 0, DefaultPatternWidth, DefaultPatternHeight );
			::PenPat( &inPattern );
			::PaintRect( &r );
			::PenNormal();
		theBuffer->EndDrawing();
	}
	catch( ... )
	{
		if ( theBuffer ) delete( theBuffer );
		if ( theTable ) ::DisposeCTable( theTable );
		throw;
	}
	
	if ( theTable ) ::DisposeCTable( theTable );
	return( theBuffer );
}