static bool AddSubImageIfPossible( InputBitmap ib, OutputBitmap ob, bool allowImageResize )
        {
            if ( ob.SingleImageOutput )
                return false;

            // attempt to fill a small power of 2 texture first, then expand it gradually up to the maximum size
            // if the sub images don't fit. mVirtualSize is the size of the current rect we are trying to fill
            if ( ob.AvailableRects.Count == 0 )
            {
                // first time this output bitmap has been used, try using the smallest possible virtual texture size
                ob.InitVirtualSize( ib.mBitmap.Size );
            }

            if ( allowImageResize )
            {
                while ( !InsertImage( ib, ob ) )
                {
                    // no images could be inserted in current image using current virtual size.
                    // increase virtual size and try again
                    if ( !ob.IncreaseVirtualSize() )
                        return false; // cannot fit anymore images into this output image
                }
                return true;
            }
            else
                return InsertImage( ib, ob );
        }
Exemple #2
0
        static bool AddSubImageIfPossible(InputBitmap ib, OutputBitmap ob, bool allowImageResize)
        {
            if (ob.SingleImageOutput)
            {
                return(false);
            }

            // attempt to fill a small power of 2 texture first, then expand it gradually up to the maximum size
            // if the sub images don't fit. mVirtualSize is the size of the current rect we are trying to fill
            if (ob.AvailableRects.Count == 0)
            {
                // first time this output bitmap has been used, try using the smallest possible virtual texture size
                ob.InitVirtualSize(ib.mBitmap.Size);
            }

            if (allowImageResize)
            {
                while (!InsertImage(ib, ob))
                {
                    // no images could be inserted in current image using current virtual size.
                    // increase virtual size and try again
                    if (!ob.IncreaseVirtualSize())
                    {
                        return(false);                        // cannot fit anymore images into this output image
                    }
                }
                return(true);
            }
            else
            {
                return(InsertImage(ib, ob));
            }
        }