/// <summary> /// set local loaded image /// </summary> /// <param name="image"></param> public virtual void SetLocalImage(PixelFarm.Drawing.Image image, bool raiseEvent = true) { //set image to this binder if (image != null) { _localImg = image; this.State = BinderState.Loaded; if (raiseEvent) { RaiseImageChanged(); } else { //eg. when we setLocalImage //from other thread //don't call raise image changed directly here //please use 'main thread queue' to invoke this } } else { //if set to null } }
public void SetImage(PixelFarm.Drawing.Image image) { //set image to this binder if (image != null) { this._image = image; this.State = ImageBinderState.Loaded; this.OnImageChanged(); } }
public ImageBinder(PixelFarm.Drawing.Image otherImg, bool isMemBmpOwner = false) { #if DEBUG if (otherImg == null) { throw new NotSupportedException(); } #endif //binder to image _localImg = otherImg; _isLocalImgOwner = isMemBmpOwner; //if true=> this binder will release a local cahed img this.State = BinderState.Loaded; }
public ImageBinder(PixelFarm.CpuBlit.MemBitmap memBmp, bool isMemBmpOwner = false) { #if DEBUG if (memBmp == null) { throw new NotSupportedException(); } #endif //binder to image _localImg = memBmp; _isLocalImgOwner = isMemBmpOwner; //if true=> this binder will release a local cahed img this.State = BinderState.Loaded; }
/// <summary> /// On image load in renderer set the image by event async. /// </summary> void HandleImageRequest(object sender, ImageRequestEventArgs e) { PixelFarm.Drawing.Image img = TryLoadResourceImage(e.ImagSource); if (img != null) { e.SetResultImage(img); } else { //no image found e.ImageBinder.State = ImageBinderState.Error; } }
public void ClearLocalImage() { this.State = BinderState.Unloading;//reset this to unload? if (_localImg != null) { if (_isLocalImgOwner) { _localImg.Dispose(); } _localImg = null; } //TODO: review here this.State = BinderState.Unload;//reset this to unload? }
public static PixelFarm.DrawingGL.GLBitmap LoadTexture(PixelFarm.Drawing.Image bmp) { return(null); //var bmpdata = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), // System.Drawing.Imaging.ImageLockMode.ReadOnly, // System.Drawing.Imaging.PixelFormat.Format32bppArgb); //int stride = bmpdata.Stride; //byte[] buffer = new byte[stride * bmp.Height]; //System.Runtime.InteropServices.Marshal.Copy(bmpdata.Scan0, buffer, 0, buffer.Length); //bmp.UnlockBits(bmpdata); ////--------------------------- ////if we are on Little-endian machine, //// ////--------------------------- //return new PixelFarm.DrawingGL.GLBitmap(bmp.Width, bmp.Height, buffer, false); }
/// <summary> /// set local loaded image /// </summary> /// <param name="image"></param> public virtual void SetLocalImage(PixelFarm.Drawing.Image image, bool fromAnotherThread = false) { //set image to this binder if (image != null) { _localImg = image; this.State = BinderState.Loaded; if (!fromAnotherThread) { this.RaiseImageChanged(); } else { UIMsgQueue.RegisterRunOnce(() => this.RaiseImageChanged()); } } else { //if set to null } }
public static void SetImage(PixelFarm.Drawing.Image img) => s_currentUIPlatform.SetClipboardImage(img);
void ImgBinderLoadImg(PixelFarm.Drawing.ImageBinder reqImgBinder, VgVisualElement vgVisualE, object o) { PixelFarm.Drawing.Image img = _host.LoadImage(reqImgBinder.ImageSource); reqImgBinder.SetLocalImage(img); reqImgBinder.State = PixelFarm.Drawing.BinderState.Loaded; }
public abstract void SetClipboardImage(PixelFarm.Drawing.Image img);