4 Replies Latest reply on Jul 13, 2010 10:54 AM by Shongrunden

    Large Image Renderer

    fedotenko Level 1

      Ok so i have this little problem saving high resolution images (png or jpeg) to disk with an air application. I am making pages for printing and sometimes there are big pictures with filters on them on the pages. The thing is that the images rendering have sometimes larger that maximum bitmapData width or height, 8191, in pixels wich first results in the filters breaking and wont show up and then the images breaking an they wont show up. I then tought of splitting up the end result in to smaller squares that make up the whole. so say a png in 8000 x 8000 would be four 2000 x 2000. Im using the ImageSnapshot.captureImage like this:

       

           var myBitmap:BitmapData = new BitmapData(pageParthWidth, pagePartHeight);

       

           myBitmap.draw(page);

           var imgSS:ImageSnapshot = ImageSnapshot.captureImage(page, 72, new PNGEncoder(), false);

       

       

      The page variable is a s:Scroller that has the page in it as a s:Group. Before each part renderers with imageSnapshot i change the s:Scroller's  verticalScrollPosition and horizontalScrollPosition to render the next part. The problem as i stated is if the page(s:Group) inside the s:Scoller has a image that is to big it will break or/and its filter will break and not show in the saved part. Is there a way around this so flash just draws whats inside the scoller at the moment?

       

      So the real question is can i scale only a part of the interface in flash? Hop you understand what i mean

       

       

       

       

        • 1. Re: Large Image Renderer
          Shongrunden Adobe Employee

          Does your Scroller look like this:

           

          <s:Scroller ...>
              <s:Group id="viewport">
                  <s:Image />
                  <s:Image />
                  <s:Image />
                  <s:Image />
              </s:Group>
          </s:Scroller>

           

          More specifically, are the images directly inside of the "viewport" Group or are they inside a sub-Group of the viewport?
          • 2. Re: Large Image Renderer
            fedotenko Level 1

            Yes more or less. It is actually:

             

            <s:Scroller ...>
                <s:Group id="viewport">

                    <s:Border>
                         <s:Image />
                         <s:Image />
                         <s:Image />
                         <s:Image />

                    </s:Border>
                </s:Group>
            </s:Scroller>

             

            But what i would like to know is if there is a way that one could scale up an image beyond the Limit (8091x8091 i think). But render them out as parts. Like show one little part at the time in the scoller (that is smaller than the s:Group holding the images) and then save that part, scroll forward and take that little part and so on. But since the whole image is drawn beyond the scollers view it is broken if larger than the limit. Is there another way?

            • 3. Re: Large Image Renderer
              BhaskerChari Level 4

              Hi fedotenko,

               

              If your main objective is to print the images and merely not saving the images directly to the disk...I think you want to print these images without scrolling and the full content...So you can do something like below:

               

              // Here mainContainer is the container or box id the contents of which you want to print
                 private function doPrintContainer():void
                 {
                  var printJob:FlexPrintJob = new FlexPrintJob();
                  if(printJob.start() != true) return;

                  try
                              {
                   var mainContainerHeight:int = mainContainer.height;
                   //Increasing the height of the desired component to be printed.
                   mainContainer.height = mainContainer.measuredMinHeight;
                   mainContainer.verticalScrollPolicy = "off";

                   //Adding the resized Component to our FlexPrintjob and then sending the print request
                   printJob.addObject(this,FlexPrintJobScaleType.MATCH_WIDTH);    
                   printJob.send();
                  
                   //Resizing the component back to normal size
                   mainContainer.height = mainContainerHeight;
                   mainContainer.verticalScrollPolicy = "auto";    
                  }
                  catch(error:Error)
                              {
                               trace("Error : " + error.message);
                              }
                 }

               

               


              If this post answers your question or helps, please kindly mark it as such.


              Thanks,

              Bhasker Chari

              • 4. Re: Large Image Renderer
                Shongrunden Adobe Employee

                The scroller places the scrollRect on the viewport Group.  Try getting rid of the BorderContainer so the images are direct children of the viewport Group and see if that fixes things.