// //////////// 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); }
public override void CloneDataFromRead(PngChunk other) { PngChunkITXT pngChunkITXT = (PngChunkITXT)other; key = pngChunkITXT.key; val = pngChunkITXT.val; compressed = pngChunkITXT.compressed; langTag = pngChunkITXT.langTag; translatedTag = pngChunkITXT.translatedTag; }
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; }
private void CloneData(PngChunkITXT other) { if (other is null) { throw new System.ArgumentNullException(nameof(other)); } Key = other.Key; Val = other.Val; compressed = other.compressed; langTag = other.langTag; translatedTag = other.translatedTag; }
public PngChunkTextVar SetText(string key, string val, bool useLatin1, bool compress) { if (compress && !useLatin1) { throw new PngjException("cannot compress non latin text"); } PngChunkTextVar pngChunkTextVar; if (useLatin1) { pngChunkTextVar = ((!compress) ? ((PngChunkTextVar) new PngChunkTEXT(chunkList.imageInfo)) : ((PngChunkTextVar) new PngChunkZTXT(chunkList.imageInfo))); } else { pngChunkTextVar = new PngChunkITXT(chunkList.imageInfo); ((PngChunkITXT)pngChunkTextVar).SetLangtag(key); } pngChunkTextVar.SetKeyVal(key, val); QueueChunk(pngChunkTextVar, lazyOverwrite: true); return(pngChunkTextVar); }
// //////////// 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; }