Exemplo n.º 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 == false)
            {
                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);
        }
Exemplo n.º 2
0
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkITXT otherx = (PngChunkITXT)other;

            key           = otherx.key;
            val           = otherx.val;
            compressed    = otherx.compressed;
            langTag       = otherx.langTag;
            translatedTag = otherx.translatedTag;
        }