Exemplo n.º 1
0
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkTEXT otherx = (PngChunkTEXT)other;

            key = otherx.key;
            val = otherx.val;
        }
Exemplo n.º 2
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 AbstractPngChunkTextVar SetText(string key, string val, bool useLatin1, bool compress)
        {
            if (compress && !useLatin1)
            {
                throw new PngjException("cannot compress non latin text");
            }

            AbstractPngChunkTextVar 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);
        }
Exemplo n.º 3
0
        private void CloneData(PngChunkTEXT other)
        {
            if (other is null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Key = other.Key;
            Val = other.Val;
        }
Exemplo n.º 4
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;
 }