示例#1
0
 public override void Render(float x, float y, float width, float height)
 {
     try
     {
         if (this.textImage != null)
         {
             this.UpdateTexture();
             if (this.isVisible)
             {
                 lock (textureLock)
                 {
                     if (this.texture != null)
                     {
                         GS.DrawSprite(texture, 0xFFFFFFFF, x, y, x + width, y + height);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         API.Instance.Log("Gw2Plugin: {0}", ex.ToString());
         Debug.BreakDebugger();
     }
 }
 override public void Render(float x, float y, float width, float height)
 {
     lock (textureLock) {
         if (mCardTexture != null)
         {
             GS.DrawSprite(mCardTexture, 0xFFFFFFFF, x, y,
                           x + width, y + height);
         }
     }
 }
 override public void Render(float x, float y, float width, float height)
 {
     lock (textureLock)
     {
         if (texture != null)
         {
             GS.DrawSprite(texture, outputColor, x, y, x + width, y + height);
         }
     }
 }
 override public void Render(float x, float y, float width, float height)
 {
     lock (textureLock)
     {
         if (texture != null)
         {
             overlayHook.Draw(texture);
             GS.DrawSprite(texture, 0xFFFFFFFF, x, y, x + width, y + height);
         }
     }
 }
示例#5
0
        public override void Render(float x, float y, float width, float height)
        {
            lock (textureLock)
            {
                try
                {
                    if (texture != null)
                    {
                        texture.Dispose();
                        texture = null;
                    }

                    //if (File.Exists(imageFile))
                    //{
                    var c     = new WebClient();
                    var bytes = c.DownloadData(_serverUrl + "liveview.jpg");
                    var ms    = new MemoryStream(bytes);

                    BitmapImage src = new BitmapImage();

                    src.BeginInit();
                    src.CacheOption  = BitmapCacheOption.OnLoad;
                    src.StreamSource = ms;
                    src.EndInit();

                    WriteableBitmap wb = new WriteableBitmap(new FormatConvertedBitmap(src, PixelFormats.Bgra32, null, 0));

                    texture = GS.CreateTexture((UInt32)wb.PixelWidth, (UInt32)wb.PixelHeight, GSColorFormat.GS_BGRA, null, false, false);

                    texture.SetImage(wb.BackBuffer, GSImageFormat.GS_IMAGEFORMAT_BGRA, (UInt32)(wb.PixelWidth * 4));

                    config.Parent.SetInt("cx", wb.PixelWidth);
                    config.Parent.SetInt("cy", wb.PixelHeight);

                    Size.X = (float)wb.PixelWidth;
                    Size.Y = (float)wb.PixelHeight;

                    GS.DrawSprite(texture, 0xFFFFFFFF, x, y, x + width, y + height);
                }
                catch (Exception exception)
                {
                    this.Api.Log(exception.Message);
                }

                //}
                //else
                //{
                //    texture = null;
                //}
            }
        }
示例#6
0
 public override void Render(float x, float y, float width, float height)
 {
     if (_texture == null)
     {
         InitBmp();
         Init();
         _texture = GS.CreateTexture((UInt32)Size.X, (UInt32)Size.Y, GSColorFormat.GS_BGRA, null, false, false);
     }
     else
     {
         lock (ImageLock)
         {
             Pad.RefreshState();
             _texture.SetImage(XBDrawer.Draw(Pad.GetJoyState()), GSImageFormat.GS_IMAGEFORMAT_BGRA, (UInt32)(Size.X * 4));
             GS.DrawSprite(_texture, 0xFFFFFFFF, x, y, x + width, y + height);
         }
     }
 }
        public override void Render(float x, float y, float width, float height)
        {
            if (isConnecting)
            {
                return;
            }

            GetImage(x, y, width, height);

            if (imageData != null && texture != null)
            {
                UpdateSettings();
                lock (imageLock)
                    texture.SetImage(imageData.Pixels, GSImageFormat.GS_IMAGEFORMAT_BGRA, (UInt32)(imageData.Size.Width * 4));
            }
            if (texture != null)
            {
                lock (imageLock)
                    GS.DrawSprite(texture, 0x00FFFFFF + (uint)(transparency << 24), x, y, x + width, y + height);
            }
        }
示例#8
0
        public override void Render(float x, float y, float width, float height)
        {
            if (form == null || !form.Visible || texture == null)
            {
                return;
            }

            lock (form.BackBufferLock)
            {
                var buffer = form.BackBuffer;

                float renderWidth, renderHeight;

                if (buffer.Width / (float)buffer.Height > width / height)
                {
                    renderWidth = width;

                    var scaleFactor = width / buffer.Width;
                    renderHeight = scaleFactor * buffer.Height;
                    if (isAnchorBottom)
                    {
                        y += height - renderHeight;
                    }
                }
                else
                {
                    renderHeight = height;

                    var scaleFactor = height / buffer.Height;
                    renderWidth = scaleFactor * buffer.Width;
                    if (isAnchorRight)
                    {
                        x += width - renderWidth;
                    }
                }

                GS.DrawSprite(texture, 0xFFFFFFFF, x, y, x + renderWidth, y + renderHeight);
            }
        }
        private void GetImage(float x, float y, float width, float height)
        {
            try
            {
                var image = pipeProxy.GetImage();

                if (image != null)
                {
                    lock (imageLock)
                        imageData = image;
                }
            }
            catch
            {
                isConnecting = true;
                lock (imageLock)
                {
                    texture = GS.CreateTexture((uint)Size.X, (uint)Size.Y, GSColorFormat.GS_BGRA, null, false, false);
                    GS.DrawSprite(texture, 0xFFFFFFFF, x, y, x + width, y + height);
                }

                Task.Run(() => ConnectWCF());
            }
        }