Exemple #1
0
        // //////////// TEXT

        /// <summary>
        /// Creates a text chunk and enqueues it
        /// </summary>
        /// <param name="key">Key. Short and ASCII string</param>
        /// <param name="val">Text.</param>
        /// <param name="useLatin1">Flag. If false, will use UTF-8 (iTXt)</param>
        /// <param name="compress">Flag. Uses zTXt chunk.</param>
        /// <returns>The created and enqueued chunk</returns>
        public PngChunkTextVar SetText(String key, String val, bool useLatin1, bool compress)
        {
            if (compress && !useLatin1)
            {
                throw new PngjException("cannot compress non latin text");
            }
            PngChunkTextVar c;

            if (useLatin1)
            {
                if (compress)
                {
                    c = new PngChunkZTXT(chunkList.imageInfo);
                }
                else
                {
                    c = new PngChunkTEXT(chunkList.imageInfo);
                }
            }
            else
            {
                c = new PngChunkITXT(chunkList.imageInfo);
                ((PngChunkITXT)c).SetLangtag(key); // we use the same orig tag (this is not quite right)
            }
            c.SetKeyVal(key, val);
            QueueChunk(c, true);
            return(c);
        }
Exemple #2
0
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkZTXT otherx = (PngChunkZTXT)other;

            key = otherx.key;
            val = otherx.val;
        }
Exemple #3
0
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkZTXT pngChunkZTXT = (PngChunkZTXT)other;

            key = pngChunkZTXT.key;
            val = pngChunkZTXT.val;
        }
Exemple #4
0
        private void CloneData(PngChunkZTXT other)
        {
            if (other is null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Key = other.Key;
            Val = other.Val;
        }
Exemple #5
0
 // //////////// TEXT
 /// <summary>
 /// Creates a text chunk and enqueues it
 /// </summary>
 /// <param name="key">Key. Short and ASCII string</param>
 /// <param name="val">Text.</param>
 /// <param name="useLatin1">Flag. If false, will use UTF-8 (iTXt)</param>
 /// <param name="compress">Flag. Uses zTXt chunk.</param>
 /// <returns>The created and enqueued chunk</returns>
 public PngChunkTextVar SetText(String key, String val, bool useLatin1, bool compress)
 {
     if (compress && !useLatin1)
         throw new PngjException("cannot compress non latin text");
     PngChunkTextVar c;
     if (useLatin1) {
         if (compress) {
             c = new PngChunkZTXT(chunkList.imageInfo);
         } else {
             c = new PngChunkTEXT(chunkList.imageInfo);
         }
     } else {
         c = new PngChunkITXT(chunkList.imageInfo);
         ((PngChunkITXT)c).SetLangtag(key); // we use the same orig tag (this is not quite right)
     }
     c.SetKeyVal(key, val);
     QueueChunk(c, true);
     return c;
 }