public Dictionary <string, object> slice(object start, object end, object type) { Blob blob = _slice(Convert.ToInt64(start), Convert.ToInt64(end), (string)type); Moxie.compFactory.add(blob.uid, blob); return(blob.ToObject()); }
public Dictionary <string, object> getAsBlob(object type) { Blob blob = new Blob(new List <object> { _buffer }, new Dictionary <string, string> { { "type", (string)type } }); Moxie.compFactory.add(blob.uid, blob); return(blob.ToObject()); }
public void loadFromStream(Stream stream) { size = stream.Length; if (JPEG.test(stream)) { _img = new JPEG(stream); type = JPEG.MIME; ((JPEG)_img).extractHeaders(); // preserve headers for later meta = ((JPEG)_img).metaInfo(); // save thumb data as Blob object thumbData; if (meta.ContainsKey("thumb") && ((Dictionary <string, object>)meta["thumb"]).TryGetValue("data", out thumbData)) { Blob blob = new Blob(new List <object> { (byte[])thumbData }, new Dictionary <string, string> { { "type", "image/jpeg" } }); Moxie.compFactory.add(blob.uid, blob); ((Dictionary <string, object>)meta["thumb"])["data"] = blob.ToObject(); } } else if (PNG.test(stream)) { _img = new PNG(stream); type = PNG.MIME; } else { Error(this, new ErrorEventArgs(ImageError.WRONG_FORMAT)); return; } Dictionary <string, int> info = _img.info(); if (info != null) { width = info["width"]; height = info["height"]; } BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(stream); _bm = new WriteableBitmap(bitmapImage); Load(this, null); }
public Dictionary<string, object> getAsBlob(object type) { Blob blob = new Blob(new List<object>{_buffer}, new Dictionary<string,string>{{ "type", (string)type }}); Moxie.compFactory.add(blob.uid, blob); return blob.ToObject(); }
public void loadFromStream(Stream stream) { size = stream.Length; if (JPEG.test(stream)) { _img = new JPEG(stream); type = JPEG.MIME; ((JPEG)_img).extractHeaders(); // preserve headers for later meta = ((JPEG)_img).metaInfo(); // save thumb data as Blob object thumbData; if (meta.ContainsKey("thumb") && ((Dictionary<string,object>)meta["thumb"]).TryGetValue("data", out thumbData)) { Blob blob = new Blob(new List<object> { (byte[])thumbData }, new Dictionary<string, string>{ { "type", "image/jpeg" } }); Moxie.compFactory.add(blob.uid, blob); ((Dictionary<string, object>)meta["thumb"])["data"] = blob.ToObject(); } } else if (PNG.test(stream)) { _img = new PNG(stream); type = PNG.MIME; } else { Error(this, new ErrorEventArgs(ImageError.WRONG_FORMAT)); return; } Dictionary<string, int> info = _img.info(); if (info != null) { width = info["width"]; height = info["height"]; } BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(stream); _bm = new WriteableBitmap(bitmapImage); Load(this, null); }