int lineWidth = 0; if ( fd.isUnderline( ) || fd.isStrikethrough( ) ) { lineWidth = (int) ( fd.getSize( ) / 12 ); gc.setLineWidth( lineWidth );  if ( fd.isUnderline( ) ) { gc.drawLine( (int) ( dX + ins.getLeft( ) ), (int) ( dY - dFH + dH - lineWidth ), (int) ( dX + ins.getLeft( ) + dFW ), (int) ( dY - dFH + dH - lineWidth ) ); } if ( fd.isStrikethrough( ) ) { gc.drawLine( (int) ( dX + ins.getLeft( ) ), (int) ( dY - dFH + dH * 0.5 - lineWidth ), (int) ( dX + ins.getLeft( ) + dFW ), (int) ( dY - dFH + dH * 0.5 - lineWidth ) ); } }
	final Image rotatedTextAsImage( Label la )	{		double dX = 0, dY = 0;		final FontDefinition fd = la.getCaption( ).getFont( );		final double dAngleInDegrees = fd.getRotation( );		final Color clrText = (Color) _sxs.getColor( la.getCaption( )				.getColor( ) );		double dAngleInRadians = ( ( -dAngleInDegrees * Math.PI ) / 180.0 );		final ITextMetrics itm = new SwtTextMetrics( _sxs, la );		final double dFW = itm.getFullWidth( );		final double dH = itm.getHeight( );		final double dFH = itm.getFullHeight( );		final int iLC = itm.getLineCount( );		final Insets ins = la.getInsets( )				.scaledInstance( _sxs.getDpiResolution( ) / 72d );		dY += dFH;		double dCosTheta = Math.cos( dAngleInRadians );		double dSineTheta = Math.sin( dAngleInRadians );		final double dFWt = Math.abs( dFW				* dCosTheta				+ dFH				* Math.abs( dSineTheta ) );		final double dFHt = Math.abs( dFH				* dCosTheta				+ dFW				* Math.abs( dSineTheta ) );		final int clipWs = (int) dFW;		final int clipHs = (int) dFH;		final int clipWt = (int) dFWt;		final int clipHt = (int) dFHt;		// RENDER THE TEXT ON AN OFFSCREEN CANVAS		ImageData imgdtaS = new ImageData( clipWs, clipHs, 32, PALETTE_DATA );		imgdtaS.transparentPixel = TRANSPARENT_COLOR;		final Image imgSource = new Image( _sxs.getDevice( ), imgdtaS );		for ( int i = 0; i < clipHs; i++ )		{			for ( int j = 0; j < clipWs; j++ )			{				imgdtaS.setPixel( j, i, imgdtaS.transparentPixel );			}		}		final GC gc = new GC( imgSource );		final Font f = (Font) _sxs.createFont( fd );		final Rectangle r = new Rectangle( (int) dX,				(int) ( dY - dFH ),				(int) dFW,				(int) dFH );		// RENDER THE BACKGROUND		final boolean bFullyTransparent = ( ( (ColorDefinition) la.getBackground( ) ).getTransparency( ) == 0 );		if ( !bFullyTransparent )		{			final Color clrBackground = (Color) _sxs.getColor( (ColorDefinition) la.getBackground( ) );			gc.setBackground( clrBackground );			gc.fillRectangle( r );			clrBackground.dispose( );		}		else		{			final Color cTransparent = new Color( _sxs.getDevice( ),					0x12,					0x34,					0x56 );			gc.setBackground( cTransparent );			gc.fillRectangle( r );			cTransparent.dispose( );		}		// RENDER THE TEXT		gc.setForeground( clrText );		gc.setFont( f );		for ( int i = 0; i < itm.getLineCount( ); i++ )		{			gc.drawText( itm.getLine( iLC - i - 1 ),					(int) ( dX + ins.getLeft( ) ),					(int) ( dY - dH - dH * i + ins.getTop( ) ),					false );		}		clrText.dispose( );		itm.dispose( );		f.dispose( );		gc.dispose( );		imgdtaS = imgSource.getImageData( );		final ImageData imgdtaT = new ImageData( clipWt,				clipHt,				32,				PALETTE_DATA );		imgdtaT.palette = imgdtaS.palette;		imgdtaT.transparentPixel = imgdtaS.transparentPixel;		for ( int i = 0; i < clipHt; i++ )		{			for ( int j = 0; j < clipWt; j++ )			{				imgdtaT.setPixel( j, i, imgdtaT.transparentPixel );			}		}		final int neg = ( dAngleInDegrees < 0 ) ? (int) ( clipHs * dSineTheta )				: 0;		final int pos = ( dAngleInDegrees > 0 ) ? (int) ( clipWs * Math.abs( dSineTheta ) )				: 0;		final int yMax = clipHt - pos;		final int xMax = clipWt - neg;		int xSrc = 0, ySrc = 0, xDest = 0, yDest = 0, x = 0, y = 0;		double yDestCosTheta, yDestSineTheta;		// PIXEL TRANSFER LOOP		for ( yDest = -pos; yDest < yMax; yDest++ )		{			yDestCosTheta = yDest * dCosTheta;			yDestSineTheta = yDest * dSineTheta;			for ( xDest = -neg; xDest < xMax; xDest++ )			{				// CALC SRC CO-ORDINATES				xSrc = (int) Math.round( xDest * dCosTheta + yDestSineTheta );				ySrc = (int) Math.round( yDestCosTheta - xDest * dSineTheta );				if ( xSrc < 0 || xSrc >= clipWs || ySrc < 0 || ySrc >= clipHs ) // OUT				// OF				// RANGE				{					continue;				}				// CALC DEST CO-ORDINATES				x = xDest + neg;				y = yDest + pos;				if ( x < 0 || x >= clipWt || y < 0 || y >= clipHt ) // OUT OF				// RANGE				{					continue;				}				// NOW THAT BOTH CO-ORDINATES ARE WITHIN RANGE, TRANSFER A PIXEL				imgdtaT.setPixel( x, y, imgdtaS.getPixel( xSrc, ySrc ) );			}		}		imgSource.dispose( );		// BUILD THE IMAGE USING THE NEWLY MANIPULATED BYTES		return new Image( _sxs.getDevice( ), imgdtaT );	};