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


C# Image.GetMatrix方法代码示例

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


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

示例1: Add

 /**
 * Adds an image to the document.
 * @param image the <CODE>Image</CODE> to add
 * @throws PdfException on error
 * @throws DocumentException on error
 */        
 protected internal void Add(Image image) {
     
     if (image.HasAbsolutePosition()) {
         graphics.AddImage(image);
         pageEmpty = false;
         return;
     }
     
     // if there isn't enough room for the image on this page, save it for the next page
     if (currentHeight != 0 && IndentTop - currentHeight - image.ScaledHeight < IndentBottom) {
         if (!strictImageSequence && imageWait == null) {
             imageWait = image;
             return;
         }
         NewPage();
         if (currentHeight != 0 && IndentTop - currentHeight - image.ScaledHeight < IndentBottom) {
             imageWait = image;
             return;
         }
     }
     pageEmpty = false;
     // avoid endless loops
     if (image == imageWait)
         imageWait = null;
     bool textwrap = (image.Alignment & Image.TEXTWRAP) == Image.TEXTWRAP
     && (image.Alignment & Image.MIDDLE_ALIGN) != Image.MIDDLE_ALIGN;
     bool underlying = (image.Alignment & Image.UNDERLYING) == Image.UNDERLYING;
     float diff = leading / 2;
     if (textwrap) {
         diff += leading;
     }
     float lowerleft = IndentTop - currentHeight - image.ScaledHeight - diff;
     float[] mt = image.GetMatrix();
     float startPosition = IndentLeft - mt[4];
     if ((image.Alignment & Image.RIGHT_ALIGN) == Image.RIGHT_ALIGN) startPosition = IndentRight - image.ScaledWidth - mt[4];
     if ((image.Alignment & Image.MIDDLE_ALIGN) == Image.MIDDLE_ALIGN) startPosition = IndentLeft + ((IndentRight - IndentLeft - image.ScaledWidth) / 2) - mt[4];
     if (image.HasAbsoluteX()) startPosition = image.AbsoluteX;
     if (textwrap) {
         if (imageEnd < 0 || imageEnd < currentHeight + image.ScaledHeight + diff) {
             imageEnd = currentHeight + image.ScaledHeight + diff;
         }
         if ((image.Alignment & Image.RIGHT_ALIGN) == Image.RIGHT_ALIGN) {
             // indentation suggested by Pelikan Stephan
             indentation.imageIndentRight += image.ScaledWidth + image.IndentationLeft;
         }
         else {
             // indentation suggested by Pelikan Stephan
             indentation.imageIndentLeft += image.ScaledWidth + image.IndentationRight;
         }
     }
     else {
         if ((image.Alignment & Image.RIGHT_ALIGN) == Image.RIGHT_ALIGN) startPosition -= image.IndentationRight;
         else if ((image.Alignment & Image.MIDDLE_ALIGN) == Image.MIDDLE_ALIGN) startPosition += image.IndentationLeft - image.IndentationRight;
         else startPosition -= image.IndentationRight;
     }
     graphics.AddImage(image, mt[0], mt[1], mt[2], mt[3], startPosition, lowerleft - mt[5]);
     if (!(textwrap || underlying)) {
         currentHeight += image.ScaledHeight + diff;
         FlushLines();
         text.MoveText(0, - (image.ScaledHeight + diff));
         NewLine();
     }
 }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:69,代码来源:PdfDocument.cs

示例2: AddImage

 /**
 * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have
 * absolute positioning. The image can be placed inline.
 * @param image the <CODE>Image</CODE> object
 * @param inlineImage <CODE>true</CODE> to place this image inline, <CODE>false</CODE> otherwise
 * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning
 */
 public virtual void AddImage(Image image, bool inlineImage) {
     if (!image.HasAbsolutePosition())
         throw new DocumentException(MessageLocalization.GetComposedMessage("the.image.must.have.absolute.positioning"));
     float[] matrix = image.GetMatrix();
     matrix[Image.CX] = image.AbsoluteX - matrix[Image.CX];
     matrix[Image.CY] = image.AbsoluteY - matrix[Image.CY];
     AddImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], inlineImage);
 }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:15,代码来源:PdfContentByte.cs


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