Used to store/load images and generate (scaled) pictures.
Exemplo n.º 1
0
 /// <summary>
 /// Replace the placeholder with a picture in the paragraph. The graphic must already be loaded into the same document.
 /// </summary>
 public T ToPicture <T>(TemplGraphic graphic, int width) where T : TemplMatchPara, new()
 {
     // Use InsertPicture at each match, then remove placeholder
     if (Removed || RemovedPlaceholder || Expired)
     {
         return((T)this);
     }
     InsertPicture(graphic, width);
     RemovePlaceholder();
     return((T)this);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Inserts a picture of a specific pixel width. Aspect ratio is maintained. Matched Picture is removed.
        /// </summary>
        private void InsertPicture(TemplGraphic graphic, int width)
        {
            if (RemovedPlaceholder || Expired || Removed)
            {
                return;
            }
            var newPic = graphic.Picture((uint)width);

            Paragraph.InsertPicture(newPic);
            Paragraph.Alignment = (graphic.Alignment ?? Paragraph.Alignment);
            RemovePlaceholder();
            Picture = newPic;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Insert a picture at the beginning of the paragraph. The graphic must already be loaded into the same document.
 /// </summary>
 private void InsertPicture(TemplGraphic graphic, int width)
 {
     // Simple. Picture at index(es). Ensure you load picture first.
     Paragraph.FindAll(Placeholder).ForEach(idx =>
     {
         if (width > 0)
         {
             Paragraph.InsertPicture(graphic.Picture((uint)width), idx + Placeholder.Length);
         }
         else
         {
             Paragraph.InsertPicture(graphic.Picture(), idx + Placeholder.Length);
         }
         Paragraph.Alignment = (graphic.Alignment ?? Paragraph.Alignment);
     });
 }
Exemplo n.º 4
0
 public TemplMatchText ToPictures(TemplGraphic[] g, int w) => base.ToPictures<TemplMatchText>(g, w);
Exemplo n.º 5
0
 public TemplMatchText ToPicture(TemplGraphic g, int w) => base.ToPicture<TemplMatchText>(g, w);
Exemplo n.º 6
0
 /// <summary>
 /// Inserts a picture of a specific pixel width. Aspect ratio is maintained. Matched Picture is removed.
 /// </summary>
 private void InsertPicture(TemplGraphic graphic, int width)
 {
     if (RemovedPlaceholder || Expired || Removed)
     {
         return;
     }
     var newPic = graphic.Picture((uint)width);
     Paragraph.InsertPicture(newPic);
     Paragraph.Alignment = (graphic.Alignment ?? Paragraph.Alignment);
     RemovePlaceholder();
     Picture = newPic;
 }
Exemplo n.º 7
0
 public TemplMatchText ToPicture(TemplGraphic g, int w) => base.ToPicture <TemplMatchText>(g, w);