internal void LoadImageFromFile(Triggernometry.RealPlugin plug, Graphics g, string ifn)
        {
            string fn = AuraImage.ResolveImageFilename(plug, ifn);

            byte[] data = File.ReadAllBytes(fn);
            LoadImageDataFromByte(plug, g, data);
        }
        internal override void RenderImage(AuraImage a)
        {
            SharpDXState s = a.State as SharpDXState;

            if (s.NeedImage == true)
            {
                if (s.window == null)
                {
                    AdjustSurface(a);
                }
                //s.LoadImageOnDemand();
                s.NeedImage  = false;
                s.NeedRender = true;
            }
            if (s.IsAnimated == true)
            {
                bool af = s.AdvanceFrame();
                s.NeedRender = s.NeedRender || af;
            }
            if (Owner.RenderingActive == false)
            {
                if (s.WasHidden == false)
                {
                    s.NeedRender = true;
                    s.WasHidden  = true;
                }
            }
            else
            {
                if (s.WasHidden == true)
                {
                    s.NeedRender = true;
                    s.WasHidden  = false;
                }
            }
            if (s.NeedRender == false)
            {
                return;
            }
            AdjustSurface(a);
            s.NeedRender = false;
            s.graphics.BeginScene();
            s.graphics.ClearScene(s.bgColor);
            if (Owner.RenderingActive == false)
            {
                s.graphics.EndScene();
                return;
            }
            switch (a.Display)
            {
            case PictureBoxSizeMode.Zoom:
                float mW = (float)a.Width / s.OriginalImage.Width;
                float mH = (float)a.Height / s.OriginalImage.Height;
                float aW, aH;
                if (mH < mW)
                {
                    aW = mH * s.OriginalImage.Width;
                    aH = a.Height;
                }
                else if (mW < mH)
                {
                    aW = a.Width;
                    aH = mW * s.OriginalImage.Height;
                }
                else
                {
                    aW = a.Width;
                    aH = a.Height;
                }
                s.graphics.DrawImage(
                    s.OriginalImage,
                    ((a.Width - aW) / 2),
                    ((a.Height - aH) / 2),
                    ((a.Width - aW) / 2) + aW,
                    ((a.Height - aH) / 2) + aH,
                    a.Opacity / 100.0f
                    );
                break;

            case PictureBoxSizeMode.Normal:
                if (s.OriginalImage.Width <= a.Width && s.OriginalImage.Height <= a.Height)
                {
                    s.graphics.DrawImage(
                        s.OriginalImage,
                        0,
                        0,
                        s.OriginalImage.Width,
                        s.OriginalImage.Height,
                        a.Opacity / 100.0f
                        );
                }
                else
                {
                    if (s.OriginalImage.Width <= a.Width)
                    {
                        s.graphics.DrawImageEx(
                            s.OriginalImage,
                            new Rectangle(0, 0, s.OriginalImage.Width, a.Height),
                            new Rectangle(0, 0, s.OriginalImage.Width, a.Height),
                            a.Opacity / 100.0f
                            );
                    }
                    else if (s.OriginalImage.Height <= a.Height)
                    {
                        s.graphics.DrawImageEx(
                            s.OriginalImage,
                            new Rectangle(0, 0, a.Width, s.OriginalImage.Height),
                            new Rectangle(0, 0, a.Width, s.OriginalImage.Height),
                            a.Opacity / 100.0f
                            );
                    }
                    else
                    {
                        s.graphics.DrawImageEx(
                            s.OriginalImage,
                            new Rectangle(0, 0, a.Width, a.Height),
                            new Rectangle(0, 0, a.Width, a.Height),
                            a.Opacity / 100.0f
                            );
                    }
                }
                break;

            case PictureBoxSizeMode.CenterImage:
                if (s.OriginalImage.Width <= a.Width && s.OriginalImage.Height <= a.Height)
                {
                    s.graphics.DrawImage(
                        s.OriginalImage,
                        ((a.Width - s.OriginalImage.Width) / 2),
                        ((a.Height - s.OriginalImage.Height) / 2),
                        ((a.Width - s.OriginalImage.Width) / 2) + s.OriginalImage.Width,
                        ((a.Height - s.OriginalImage.Height) / 2) + s.OriginalImage.Height,
                        a.Opacity / 100.0f
                        );
                }
                else
                {
                    s.graphics.DrawImageEx(
                        s.OriginalImage,
                        new Rectangle(
                            (s.OriginalImage.Width / 2) - (a.Width / 2),
                            (s.OriginalImage.Height / 2) - (a.Height / 2),
                            (s.OriginalImage.Width / 2) + (a.Width / 2),
                            (s.OriginalImage.Height / 2) + (a.Height / 2)
                            ),
                        new Rectangle(
                            0,
                            0,
                            a.Width,
                            a.Height
                            ),
                        a.Opacity / 100.0f
                        );
                }
                break;

            case PictureBoxSizeMode.StretchImage:
                s.graphics.DrawImage(
                    s.OriginalImage,
                    0,
                    0,
                    a.Width,
                    a.Height,
                    a.Opacity / 100.0f
                    );
                break;
            }
            s.graphics.EndScene();
        }
Esempio n. 3
0
 internal void RenderImage(AuraImage a)
 {
     /*
      * if (NeedImage == true)
      * {
      *  if (_window == null)
      *  {
      *      AdjustSurface();
      *  }
      *  LoadImageOnDemand();
      *  NeedImage = false;
      *  NeedRender = true;
      * }
      * if (IsAnimated == true)
      * {
      *  bool af = AdvanceFrame();
      *  NeedRender = NeedRender || af;
      * }
      * if (Owner.RenderingActive == false)
      * {
      *  if (WasHidden == false)
      *  {
      *      NeedRender = true;
      *      WasHidden = true;
      *  }
      * }
      * else
      * {
      *  if (WasHidden == true)
      *  {
      *      NeedRender = true;
      *      WasHidden = false;
      *  }
      * }
      * if (NeedRender == false)
      * {
      *  return;
      * }
      * AdjustSurface();
      * NeedRender = false;
      * _graphics.BeginScene();
      * _graphics.ClearScene(_bgColor);
      * if (Owner.RenderingActive == false)
      * {
      *  _graphics.EndScene();
      *  return;
      * }
      * switch (a.Display)
      * {
      *  case PictureBoxSizeMode.Zoom:
      *      float mW = (float)a.Width / OriginalImage.Width;
      *      float mH = (float)a.Height / OriginalImage.Height;
      *      float aW, aH;
      *      if (mH < mW)
      *      {
      *          aW = mH * OriginalImage.Width;
      *          aH = a.Height;
      *      }
      *      else if (mW < mH)
      *      {
      *          aW = a.Width;
      *          aH = mW * OriginalImage.Height;
      *      }
      *      else
      *      {
      *          aW = a.Width;
      *          aH = a.Height;
      *      }
      *      _graphics.DrawImage(
      *          OriginalImage,
      *          ((a.Width - aW) / 2),
      *          ((a.Height - aH) / 2),
      *          ((a.Width - aW) / 2) + aW,
      *          ((a.Height - aH) / 2) + aH,
      *          a.Opacity / 100.0f
      *      );
      *      break;
      *  case PictureBoxSizeMode.Normal:
      *      if (OriginalImage.Width <= a.Width && OriginalImage.Height <= a.Height)
      *      {
      *          _graphics.DrawImage(
      *              OriginalImage,
      *              0,
      *              0,
      *              OriginalImage.Width,
      *              OriginalImage.Height,
      *              a.Opacity / 100.0f
      *          );
      *      }
      *      else
      *      {
      *          if (OriginalImage.Width <= a.Width)
      *          {
      *              _graphics.DrawImageEx(
      *                  OriginalImage,
      *                  new Rectangle(0, 0, OriginalImage.Width, a.Height),
      *                  new Rectangle(0, 0, OriginalImage.Width, a.Height),
      *                  a.Opacity / 100.0f
      *              );
      *          }
      *          else if (OriginalImage.Height <= a.Height)
      *          {
      *              _graphics.DrawImageEx(
      *                  OriginalImage,
      *                  new Rectangle(0, 0, a.Width, OriginalImage.Height),
      *                  new Rectangle(0, 0, a.Width, OriginalImage.Height),
      *                  a.Opacity / 100.0f
      *              );
      *          }
      *          else
      *          {
      *              _graphics.DrawImageEx(
      *                  OriginalImage,
      *                  new Rectangle(0, 0, a.Width, a.Height),
      *                  new Rectangle(0, 0, a.Width, a.Height),
      *                  a.Opacity / 100.0f
      *              );
      *          }
      *      }
      *      break;
      *  case PictureBoxSizeMode.CenterImage:
      *      if (OriginalImage.Width <= a.Width && OriginalImage.Height <= a.Height)
      *      {
      *          _graphics.DrawImage(
      *              OriginalImage,
      *              ((a.Width - OriginalImage.Width) / 2),
      *              ((a.Height - OriginalImage.Height) / 2),
      *              ((a.Width - OriginalImage.Width) / 2) + OriginalImage.Width,
      *              ((a.Height - OriginalImage.Height) / 2) + OriginalImage.Height,
      *              a.Opacity / 100.0f
      *          );
      *      }
      *      else
      *      {
      *          _graphics.DrawImageEx(
      *              OriginalImage,
      *              new Rectangle(
      *                  (OriginalImage.Width / 2) - (a.Width / 2),
      *                  (OriginalImage.Height / 2) - (a.Height / 2),
      *                  (OriginalImage.Width / 2) + (a.Width / 2),
      *                  (OriginalImage.Height / 2) + (a.Height / 2)
      *              ),
      *              new Rectangle(
      *                  0,
      *                  0,
      *                  a.Width,
      *                  a.Height
      *              ),
      *              a.Opacity / 100.0f
      *          );
      *      }
      *      break;
      *  case PictureBoxSizeMode.StretchImage:
      *      _graphics.DrawImage(
      *          OriginalImage,
      *          0,
      *          0,
      *          a.Width,
      *          a.Height,
      *          a.Opacity / 100.0f
      *      );
      *      break;
      * }
      * _graphics.EndScene();*/
 }
Esempio n. 4
0
 internal override void RenderImage(AuraImage a)
 {
 }