Example #1
0
 private void DetermineSize(PageContext pageContext)
 {
     if (!m_invalidImage && m_streamName == null && m_imageProps == null)
     {
         Microsoft.ReportingServices.OnDemandReportRendering.Image image = (Microsoft.ReportingServices.OnDemandReportRendering.Image)m_source;
         CheckAutoSize(image, pageContext);
     }
     if (m_imageProps != null)
     {
         ResizeImage(pageContext, m_imageProps.Width, m_imageProps.Height);
     }
     else
     {
         if (m_streamName == null)
         {
             return;
         }
         Hashtable autoSizeSharedImages = pageContext.AutoSizeSharedImages;
         if (autoSizeSharedImages != null)
         {
             AutosizeImageProps autosizeImageProps = (AutosizeImageProps)autoSizeSharedImages[m_streamName];
             if (autosizeImageProps != null)
             {
                 ResizeImage(pageContext, autosizeImageProps.Width, autosizeImageProps.Height);
             }
         }
     }
 }
Example #2
0
 private void DetermineSize(PageContext pageContext)
 {
     if (!this.m_invalidImage && this.m_streamName == null && this.m_imageProps == null)
     {
         AspNetCore.ReportingServices.OnDemandReportRendering.Image image = (AspNetCore.ReportingServices.OnDemandReportRendering.Image)base.m_source;
         this.CheckAutoSize(image, pageContext);
     }
     if (this.m_imageProps != null)
     {
         this.ResizeImage(pageContext, this.m_imageProps.Width, this.m_imageProps.Height);
     }
     else if (this.m_streamName != null)
     {
         Hashtable autoSizeSharedImages = pageContext.AutoSizeSharedImages;
         if (autoSizeSharedImages != null)
         {
             AutosizeImageProps autosizeImageProps = (AutosizeImageProps)autoSizeSharedImages[this.m_streamName];
             if (autosizeImageProps != null)
             {
                 this.ResizeImage(pageContext, autosizeImageProps.Width, autosizeImageProps.Height);
             }
         }
     }
 }
Example #3
0
        private bool AutoSizeImage(PageContext pageContext, ImageInstance imageInstance, out System.Drawing.Image gdiImage)
        {
            gdiImage = null;
            bool result = false;
            AutosizeImageProps autosizeImageProps = null;

            this.m_streamName = imageInstance.StreamName;
            if (this.m_streamName != null)
            {
                Hashtable hashtable = pageContext.AutoSizeSharedImages;
                if (hashtable != null)
                {
                    autosizeImageProps = (AutosizeImageProps)hashtable[this.m_streamName];
                    if (autosizeImageProps != null)
                    {
                        this.GetPaddings(pageContext);
                        return(autosizeImageProps.InvalidImage);
                    }
                }
                autosizeImageProps = new AutosizeImageProps();
                if (hashtable == null)
                {
                    hashtable = (pageContext.AutoSizeSharedImages = new Hashtable());
                }
                hashtable.Add(this.m_streamName, autosizeImageProps);
            }
            else
            {
                autosizeImageProps = new AutosizeImageProps();
            }
            byte[] array = imageInstance.ImageData;
            if (array != null)
            {
                try
                {
                    MemoryStream stream = new MemoryStream(array, false);
                    gdiImage = System.Drawing.Image.FromStream(stream);
                    if (gdiImage != null)
                    {
                        ((Bitmap)gdiImage).SetResolution((float)pageContext.DpiX, (float)pageContext.DpiY);
                    }
                }
                catch
                {
                    array = null;
                }
            }
            if (array == null)
            {
                gdiImage = (Bitmap)HPBProcessing.HPBResourceManager.GetObject("InvalidImage");
                result   = true;
                autosizeImageProps.InvalidImage = true;
            }
            if (gdiImage != null)
            {
                this.GetPaddings(pageContext);
                autosizeImageProps.Width  = gdiImage.Width;
                autosizeImageProps.Height = gdiImage.Height;
            }
            return(result);
        }
Example #4
0
        private bool AutoSizeImage(PageContext pageContext, ImageInstance imageInstance, out System.Drawing.Image gdiImage)
        {
            gdiImage = null;
            if (!pageContext.MeasureItems)
            {
                return(false);
            }
            if (((Microsoft.ReportingServices.OnDemandReportRendering.Image)m_source).Sizing != 0)
            {
                return(false);
            }
            bool result = false;
            AutosizeImageProps autosizeImageProps = null;
            string             streamName         = imageInstance.StreamName;

            if (streamName != null)
            {
                Hashtable hashtable = pageContext.AutoSizeSharedImages;
                if (hashtable != null)
                {
                    autosizeImageProps = (AutosizeImageProps)hashtable[streamName];
                    if (autosizeImageProps != null)
                    {
                        ResizeImage(pageContext, autosizeImageProps.Width, autosizeImageProps.Height);
                        return(autosizeImageProps.InvalidImage);
                    }
                }
                autosizeImageProps = new AutosizeImageProps();
                if (hashtable == null)
                {
                    hashtable = (pageContext.AutoSizeSharedImages = new Hashtable());
                }
                hashtable.Add(streamName, autosizeImageProps);
            }
            else
            {
                autosizeImageProps = new AutosizeImageProps();
            }
            byte[] array = imageInstance.ImageData;
            if (array != null)
            {
                try
                {
                    MemoryStream stream = new MemoryStream(array, writable: false);
                    gdiImage = System.Drawing.Image.FromStream(stream);
                    if (gdiImage != null)
                    {
                        ((Bitmap)gdiImage).SetResolution(pageContext.DpiX, pageContext.DpiY);
                    }
                }
                catch
                {
                    array = null;
                    if (gdiImage != null)
                    {
                        gdiImage.Dispose();
                        gdiImage = null;
                    }
                }
            }
            if (array == null)
            {
                gdiImage = (Bitmap)SPBProcessing.SPBResourceManager.GetObject("InvalidImage");
                result   = true;
                autosizeImageProps.InvalidImage = true;
            }
            if (gdiImage != null)
            {
                ResizeImage(pageContext, gdiImage.Width, gdiImage.Height);
                autosizeImageProps.Width  = gdiImage.Width;
                autosizeImageProps.Height = gdiImage.Height;
            }
            return(result);
        }
Example #5
0
        private bool AutoSizeImage(PageContext pageContext, ImageInstance imageInstance, out System.Drawing.Image gdiImage)
        {
            gdiImage = null;
            bool result = false;
            AutosizeImageProps autosizeImageProps = null;

            m_streamName = imageInstance.StreamName;
            if (m_streamName != null)
            {
                Hashtable hashtable = pageContext.AutoSizeSharedImages;
                if (hashtable != null)
                {
                    autosizeImageProps = (AutosizeImageProps)hashtable[m_streamName];
                    if (autosizeImageProps != null)
                    {
                        GetPaddings(pageContext);
                        return(autosizeImageProps.InvalidImage);
                    }
                }
                autosizeImageProps = new AutosizeImageProps();
                if (hashtable == null)
                {
                    hashtable = (pageContext.AutoSizeSharedImages = new Hashtable());
                }
                hashtable.Add(m_streamName, autosizeImageProps);
            }
            else
            {
                autosizeImageProps = new AutosizeImageProps();
            }
            byte[] array = imageInstance.ImageData;
            if (array != null)
            {
                try
                {
                    MemoryStream stream = new MemoryStream(array, writable: false);
                    gdiImage = System.Drawing.Image.FromStream(stream);
                    if (gdiImage != null)
                    {
                        ((Bitmap)gdiImage).SetResolution(pageContext.DpiX, pageContext.DpiY);
                    }
                }
                catch
                {
                    array = null;
                }
            }
            if (array == null)
            {
                gdiImage = Microsoft.ReportingServices.InvalidImage.Image;
                result   = true;
                autosizeImageProps.InvalidImage = true;
            }
            if (gdiImage != null)
            {
                GetPaddings(pageContext);
                autosizeImageProps.Width  = gdiImage.Width;
                autosizeImageProps.Height = gdiImage.Height;
            }
            return(result);
        }