public void selectMetaObject(int index,PdfCanvas cb){
  MetaObject obj=MetaObjects.get(index);
  if (obj == null)   return;
  int style;
switch (obj.getType()) {
case MetaObject.META_BRUSH:
    currentBrush=(MetaBrush)obj;
  style=currentBrush.getStyle();
if (style == MetaBrush.BS_SOLID) {
  Color color=currentBrush.getColor();
  cb.setFillColor(color);
}
 else if (style == MetaBrush.BS_HATCHED) {
  Color color=currentBackgroundColor;
  cb.setFillColor(color);
}
break;
case MetaObject.META_PEN:
{
currentPen=(MetaPen)obj;
style=currentPen.getStyle();
if (style != MetaPen.PS_NULL) {
Color color=currentPen.getColor();
cb.setStrokeColor(color);
cb.setLineWidth(Math.abs(currentPen.getPenWidth() * scalingX / extentWx));
switch (style) {
case MetaPen.PS_DASH:
  cb.setLineDash(18,6,0);
break;
case MetaPen.PS_DASHDOT:
cb.writeLiteral("[9 6 3 6]0 d\n");
break;
case MetaPen.PS_DASHDOTDOT:
cb.writeLiteral("[9 3 3 3 3 3]0 d\n");
break;
case MetaPen.PS_DOT:
cb.setLineDash(3,0);
break;
default :
cb.setLineDash(0);
break;
}
}
break;
}
case MetaObject.META_FONT:
{
currentFont=(MetaFont)obj;
break;
}
}
}

public void selectMetaObject ( int index , PdfCanvas cb ) { MetaObject obj = MetaObjects . get ( index ) ; if ( obj == null ) return ; int style ; switch ( obj . getType ( ) ) { case MetaObject . META_BRUSH : currentBrush = ( MetaBrush ) obj ; style = currentBrush . getStyle ( ) ; if ( style == MetaBrush . BS_SOLID ) { Color color = currentBrush . getColor ( ) ; cb . setFillColor ( color ) ; } else if ( style == MetaBrush . BS_HATCHED ) { Color color = currentBackgroundColor ; cb . setFillColor ( color ) ; } break ; case MetaObject . META_PEN : { currentPen = ( MetaPen ) obj ; style = currentPen . getStyle ( ) ; if ( style != MetaPen . PS_NULL ) { Color color = currentPen . getColor ( ) ; cb . setStrokeColor ( color ) ; cb . setLineWidth ( Math . abs ( currentPen . getPenWidth ( ) * scalingX / extentWx ) ) ; switch ( style ) { case MetaPen . PS_DASH : cb . setLineDash ( 18 , 6 , 0 ) ; break ; case MetaPen . PS_DASHDOT : cb . writeLiteral ( "[9 6 3 6]0 d\n" ) ; break ; case MetaPen . PS_DASHDOTDOT : cb . writeLiteral ( "[9 3 3 3 3 3]0 d\n" ) ; break ; case MetaPen . PS_DOT : cb . setLineDash ( 3 , 0 ) ; break ; default : cb . setLineDash ( 0 ) ; break ; } } break ; } case MetaObject . META_FONT : { currentFont = ( MetaFont ) obj ; break ; } } }
select the metaobject at the specified index and prepare the pdfcanvas .
