当前位置: 首页>>代码示例>>Java>>正文


Java COSNumber.floatValue方法代码示例

本文整理汇总了Java中org.apache.pdfbox.cos.COSNumber.floatValue方法的典型用法代码示例。如果您正苦于以下问题:Java COSNumber.floatValue方法的具体用法?Java COSNumber.floatValue怎么用?Java COSNumber.floatValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pdfbox.cos.COSNumber的用法示例。


在下文中一共展示了COSNumber.floatValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> arguments)
  throws IOException {
  if (arguments.size() < 6) {
    throw new MissingOperandException(operator, arguments);
  }

  // concatenate matrix to current transformation matrix
  COSNumber a = (COSNumber) arguments.get(0);
  COSNumber b = (COSNumber) arguments.get(1);
  COSNumber c = (COSNumber) arguments.get(2);
  COSNumber d = (COSNumber) arguments.get(3);
  COSNumber e = (COSNumber) arguments.get(4);
  COSNumber f = (COSNumber) arguments.get(5);

  Matrix matrix = new Matrix(a.floatValue(), b.floatValue(), c.floatValue(),
          d.floatValue(), e.floatValue(), f.floatValue());

  context.getCurrentTransformationMatrix().concatenate(matrix);
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:21,代码来源:ModifyCurrentTransformationMatrix.java

示例2: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands)
  throws IOException {
  COSNumber x = (COSNumber) operands.get(0);
  COSNumber y = (COSNumber) operands.get(1);
  COSNumber w = (COSNumber) operands.get(2);
  COSNumber h = (COSNumber) operands.get(3);

  Point lowerLeft = new SimplePoint(x.floatValue(), y.floatValue());
  Point upperRight = new SimplePoint(w.floatValue() + lowerLeft.getX(), 
      h.floatValue() + lowerLeft.getY());
  
  context.transform(lowerLeft);
  context.transform(upperRight);
  
  // To ensure that the path is created in the right direction,
  // we have to create it by combining single lines instead of
  // creating a simple rectangle
  GeneralPath path = context.getLinePath();
  path.moveTo(lowerLeft.getX(), lowerLeft.getY());
  path.lineTo(upperRight.getX(), lowerLeft.getY());
  path.lineTo(upperRight.getX(), upperRight.getY());
  path.lineTo(lowerLeft.getX(), upperRight.getY());
  path.lineTo(lowerLeft.getX(), lowerLeft.getY());
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:26,代码来源:AppendRectangleToPath.java

示例3: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands)
  throws IOException {
  COSNumber x2 = (COSNumber) operands.get(0);
  COSNumber y2 = (COSNumber) operands.get(1);
  COSNumber x3 = (COSNumber) operands.get(2);
  COSNumber y3 = (COSNumber) operands.get(3);

  Point2D currentPoint = context.getLinePath().getCurrentPoint();
  Point point2 = new SimplePoint(x2.floatValue(), y2.floatValue());
  Point point3 = new SimplePoint(x3.floatValue(), y3.floatValue());
  
  context.transform(point2);
  context.transform(point3);

  if (currentPoint == null) {
    context.getLinePath().moveTo(point3.getX(), point3.getY());
  } else {
    context.getLinePath().curveTo(
        (float) currentPoint.getX(), (float) currentPoint.getY(),
        point2.getX(), point2.getY(), point3.getX(), point3.getY());
  }
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:24,代码来源:CurveToReplicateInitialPoint.java

示例4: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands) 
    throws IOException {
  COSNumber x1 = (COSNumber) operands.get(0);
  COSNumber y1 = (COSNumber) operands.get(1);
  COSNumber x3 = (COSNumber) operands.get(2);
  COSNumber y3 = (COSNumber) operands.get(3);

  Point point1 = new SimplePoint(x1.floatValue(), y1.floatValue());
  Point point3 = new SimplePoint(x3.floatValue(), y3.floatValue());
  
  context.transform(point1);
  context.transform(point3);

  context.getLinePath().curveTo(point1.getX(), point1.getY(), 
      point3.getX(), point3.getY(), point3.getX(), point3.getY());
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:18,代码来源:CurveToReplicateFinalPoint.java

示例5: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands)
  throws IOException {
  COSNumber x1 = (COSNumber) operands.get(0);
  COSNumber y1 = (COSNumber) operands.get(1);
  COSNumber x2 = (COSNumber) operands.get(2);
  COSNumber y2 = (COSNumber) operands.get(3);
  COSNumber x3 = (COSNumber) operands.get(4);
  COSNumber y3 = (COSNumber) operands.get(5);

  Point point1 = new SimplePoint(x1.floatValue(), y1.floatValue());
  Point point2 = new SimplePoint(x2.floatValue(), y2.floatValue());
  Point point3 = new SimplePoint(x3.floatValue(), y3.floatValue());
  
  context.transform(point1);
  context.transform(point2);
  context.transform(point3);
  
  if (context.getLinePath().getCurrentPoint() == null) {
    context.getLinePath().moveTo(point3.getX(), point3.getY());
  } else {
    context.getLinePath().curveTo(point1.getX(), point1.getY(), 
        point2.getX(), point2.getY(), point3.getX(), point3.getY());
  }
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:26,代码来源:CurveTo.java

示例6: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> arguments)
  throws MissingOperandException {
  if (arguments.size() < 6) {
    throw new MissingOperandException(operator, arguments);
  }
  
  COSNumber a = (COSNumber) arguments.get(0);
  COSNumber b = (COSNumber) arguments.get(1);
  COSNumber c = (COSNumber) arguments.get(2);
  COSNumber d = (COSNumber) arguments.get(3);
  COSNumber e = (COSNumber) arguments.get(4);
  COSNumber f = (COSNumber) arguments.get(5);

  // Set both matrices to 
  // [ a b 0
  //   c d 0
  //   e f 1 ]
  
  Matrix matrix = new Matrix(a.floatValue(), b.floatValue(), 
      c.floatValue(), d.floatValue(), e.floatValue(), f.floatValue());

  context.setTextMatrix(matrix);
  context.setTextLineMatrix(matrix.clone());
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:26,代码来源:SetTextMatrix.java

示例7: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> arguments)
  throws MissingOperandException {
  if (arguments.size() < 2) {
    throw new MissingOperandException(operator, arguments);
  }
  Matrix tlm = context.getTextLineMatrix();
  if (tlm == null) {
    return;
  }

  COSNumber tx = (COSNumber) arguments.get(0);
  COSNumber ty = (COSNumber) arguments.get(1);
  
  Matrix matrix = new Matrix(1, 0, 0, 1, tx.floatValue(), ty.floatValue());
  tlm.concatenate(matrix);
      
  context.setTextMatrix(tlm.clone());
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:20,代码来源:MoveText.java

示例8: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands) throws IOException {
    if (operands.size() < 4) {
        throw new MissingOperandException(operator, operands);
    }
    if (!checkArrayTypesClass(operands, COSNumber.class)) {
        return;
    }
    COSNumber x = (COSNumber) operands.get(0);
    COSNumber y = (COSNumber) operands.get(1);
    COSNumber w = (COSNumber) operands.get(2);
    COSNumber h = (COSNumber) operands.get(3);

    float x1 = x.floatValue();
    float y1 = y.floatValue();

    // create a pair of coordinates for the transformation
    float x2 = w.floatValue() + x1;
    float y2 = h.floatValue() + y1;

    Point2D p0 = context.transformedPoint(x1, y1);
    Point2D p1 = context.transformedPoint(x2, y1);
    Point2D p2 = context.transformedPoint(x2, y2);
    Point2D p3 = context.transformedPoint(x1, y2);

    // to ensure that the path is created in the right direction, we have to create
    // it by combining single lines instead of creating a simple rectangle
    linePath.moveTo((float) p0.getX(), (float) p0.getY());
    linePath.lineTo((float) p1.getX(), (float) p1.getY());
    linePath.lineTo((float) p2.getX(), (float) p2.getY());
    linePath.lineTo((float) p3.getX(), (float) p3.getY());

    // close the subpath instead of adding the last line so that a possible set line
    // cap style isn't taken into account at the "beginning" of the rectangle
    linePath.closePath();
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox2,代码行数:37,代码来源:PDFVisibleTextStripper.java

示例9: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands)
  throws IOException {
  // append straight line segment from the current point to the point.
  COSNumber x = (COSNumber) operands.get(0);
  COSNumber y = (COSNumber) operands.get(1);
  
  Point point = new SimplePoint(x.floatValue(), y.floatValue());
  
  context.transform(point);
  context.getLinePath().lineTo(point.getX(), point.getY());  
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:13,代码来源:LineTo.java

示例10: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
public void process(Operator operator, List<COSBase> operands)
  throws IOException {
  COSNumber x = (COSNumber) operands.get(0);
  COSNumber y = (COSNumber) operands.get(1);
  
  Point point = new SimplePoint(x.floatValue(), y.floatValue());
  
  context.transform(point);
  context.getLinePath().moveTo(point.getX(), point.getY());
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:12,代码来源:MoveTo.java

示例11: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
@Override
  public void process(Operator operator, List<COSBase> arguments)
    throws IOException {
    if (arguments.size() < 6) {
      throw new MissingOperandException(operator, arguments);
    }
    
    // Set glyph with and bounding box for type 3 font
//    COSNumber hDisplacement = (COSNumber) arguments.get(0);
//    COSNumber vDisplacement = (COSNumber) arguments.get(1);
    COSNumber llx = (COSNumber) arguments.get(2);
    COSNumber lly = (COSNumber) arguments.get(3);
    COSNumber urx = (COSNumber) arguments.get(4);
    COSNumber ury = (COSNumber) arguments.get(5);
      
    Point lowerLeft = new SimplePoint(llx.floatValue(), lly.floatValue());
    Point upperRight = new SimplePoint(urx.floatValue(), ury.floatValue());
      
    context.transform(lowerLeft);
    context.transform(upperRight);
    
    float minX = Math.min(lowerLeft.getX(), upperRight.getX());
    float minY = Math.min(lowerLeft.getY(), upperRight.getY());
    float maxX = Math.max(lowerLeft.getX(), upperRight.getX());
    float maxY = Math.max(lowerLeft.getY(), upperRight.getY());
    
    Rectangle boundingBox = new SimpleRectangle(minX, minY, maxX, maxY);
    context.setCurrentType3GlyphBoundingBox(boundingBox);
  }
 
开发者ID:ckorzen,项目名称:icecite,代码行数:30,代码来源:SetType3GlyphWidthAndBoundingBox.java

示例12: process

import org.apache.pdfbox.cos.COSNumber; //导入方法依赖的package包/类
/**
 * process : re : append rectangle to path.
 * @param operator The operator that is being executed.
 * @param arguments List
 */
public void process(PDFOperator operator, List arguments) 
{
    PDFObjectExtractor drawer = (PDFObjectExtractor)context;
    
    COSNumber x = (COSNumber)arguments.get( 0 );
    COSNumber y = (COSNumber)arguments.get( 1 );
    COSNumber w = (COSNumber)arguments.get( 2 );
    COSNumber h = (COSNumber)arguments.get( 3 );
   
    double finalX = x.floatValue();
    double finalY = y.floatValue();
    double finalW = w.floatValue();
    double finalH = h.floatValue();
            
    Point2D Ppos = drawer.TransformedPoint(finalX, finalY);
    Point2D Psize = drawer.ScaledPoint(finalW, finalH);
    
    finalY = Ppos.getY() - Psize.getY();
    
    
    if(finalY < 0)
    {
    	finalY = 0;
    }
   
    
    //logger().info("Rectangle coords: " + Ppos.getX() + "," +  finalY + "," +  Psize.getX() + "," +  Psize.getY() );
    Rectangle2D rect = new Rectangle2D.Double(Ppos.getX(), finalY, Psize.getX(), Psize.getY());
    
    drawer.getLinePath().reset();
    
    //System.out.println( "Bounds before=" + drawer.getLinePath().getBounds() );
    drawer.getLinePath().append( rect, false );
    //graphics.drawRect((int)x.doubleValue(), (int)(pageSize.getHeight() - y.doubleValue()),
    //                  (int)w.doubleValue(),(int)h.doubleValue() );
    //System.out.println( "<re x=\"" + x.getValue() + "\" y=\"" + y.getValue() + "\" width=\"" +
    //                                 width.getValue() + "\" height=\"" + height.getValue() + "\" >" );
    
 	//drawer.simpleAddRect(x.floatValue(), y.floatValue(), w.floatValue(), h.floatValue());
    drawer.newPath();
    drawer.simpleAddRect((float)Ppos.getX(), (float)finalY, 
    	(float)Psize.getX(), (float)Psize.getY());
}
 
开发者ID:tamirhassan,项目名称:pdfxtk,代码行数:49,代码来源:AppendRectangleToPath.java


注:本文中的org.apache.pdfbox.cos.COSNumber.floatValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。