0 Replies Latest reply on Nov 15, 2006 11:36 AM by chesworth

    Image loses ColorMatrixFilter when zoomed above 2880 pixels

    chesworth
      I have a image viewer component that allows the user to zoom and scroll an image. The user is allowed to invert the image. The problem I have is that when the user zooms the image so that the height is above 2880 the image loses its inverted filter and reverts to viewing the original image. The following is from the DisplayObect.cacheAsBitmap flex doc.

      ------------------------------------------------

      The cacheAsBitmap property is automatically set to true whenever you apply a filter to a display object (when its filter array is not empty), and if a display object has a filter applied to it, cacheAsBitmap is reported as true for that display object, even if you set the property to false. If you clear all filters for a display object, the cacheAsBitmap setting changes to
      what it was last set to.

      A display object does not use a bitmap even if the cacheAsBitmap property is set to true and instead renders from vector data in the following cases:

      The bitmap is too large: greater than 2880 pixels in either direction.
      The bitmap fails to allocate (out of memory error).

      ------------------------------------------------

      My relevant section of code for applying the inverted state to the
      image follows:

      public function invertImage():void
      {
      var matrix:Array = new Array();
      matrix = matrix.concat([-1, 0, 0, 0, 255]);
      matrix = matrix.concat([ 0, -1, 0, 0, 255]);
      matrix = matrix.concat([ 0, 0, -1, 0, 255]);
      matrix = matrix.concat([ 0, 0, 0, 1, 0]);
      var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
      var filters:Array = new Array();
      filters.push(filter);
      image.filters = filters;
      }

      Any suggestions on how I can workaround the 2880 limitation?