コード例 #1
0
        private Rectangle DrawFoundImageUnderCursor(Graphics g)
        {
            var bmp   = (m_AssetUnderCursor != null) ? m_AssetUnderCursor.Importer.Load <Bitmap>() : Resources.X_ICO_256;
            var ratio = k_MaxImagePreviewSize * 1.0f / (bmp.Width > bmp.Height ? bmp.Width : bmp.Height);

            ratio *= (m_AssetUnderCursor != null) ? 1 : 0.4f;

            var rect    = new Rectangle(m_LastCursorPos, new Size((int)(bmp.Width * ratio), (int)(bmp.Height * ratio)));
            var opacity = GetOpacityValue((int)m_FindImageWatch.ElapsedMilliseconds, k_ImageShowLength);

            if (m_LastScreeBmpAtPos == null)
            {
                m_LastScreeBmpAtPos = BitmapUtility.TakeScreenshotOfSpecificRect(rect.Location, rect.Size);
            }

            var bmp2 = BitmapUtility.ResizeBitmap(bmp, rect);
            var bmp3 = BlendTwoImagesWithOpacity(m_LastScreeBmpAtPos, bmp2, opacity);

            g.DrawImage(bmp3, rect);
            return(rect);
        }