docs: static Dimension getSize(int pOriginalWidth, int pOriginalHeight,
                                         int pWidth, int pHeight,
                                         boolean pPercent, boolean pUniform) {
  
          // If uniform, make sure width and height are scaled the same amount
          // (use ONLY height or ONLY width).
          //
          // Algorithm:
          // if uniform
          //    if newHeight not set
          //       find ratio newWidth / oldWidth
          //       oldHeight *= ratio
          //    else if newWidth not set
          //       find ratio newWidth / oldWidth
          //       oldHeight *= ratio
          //    else
          //       find both ratios and use the smallest one
          //       (this will be the largest version of the image that fits
          //        inside the rectangle given)
          //       (if PERCENT, just use smallest percentage).
          //
          // If units is percent, we only need old height and width
  
          float ratio;
  
          if (pPercent) {
              if (pWidth >= 0 && pHeight >= 0) {
                  // Non-uniform
                  pWidth = Math.round((float) pOriginalWidth * (float) pWidth / 100f);
                  pHeight = Math.round((float) pOriginalHeight * (float) pHeight / 100f);
              }
              else if (pWidth >= 0) {
                  // Find ratio from pWidth
                  ratio = (float) pWidth / 100f;
                  pWidth = Math.round((float) pOriginalWidth * ratio);
                  pHeight = Math.round((float) pOriginalHeight * ratio);
              }
              else if (pHeight >= 0) {
                  // Find ratio from pHeight
                  ratio = (float) pHeight / 100f;
                  pWidth = Math.round((float) pOriginalWidth * ratio);
                  pHeight = Math.round((float) pOriginalHeight * ratio);
              }
              // Else: No scale
          }
          else {
              if (pUniform) {
                  if (pWidth >= 0 && pHeight >= 0) {
                      // Compute both ratios
                      ratio = (float) pWidth / (float) pOriginalWidth;
                      float heightRatio = (float) pHeight / (float) pOriginalHeight;
  
                      // Find the largest ratio, and use that for both
                      if (heightRatio < ratio) {
                          ratio = heightRatio;
                          pWidth = Math.round((float) pOriginalWidth * ratio);
                      }
                      else {
                          pHeight = Math.round((float) pOriginalHeight * ratio);
                      }
                  }
                  else if (pWidth >= 0) {
                      // Find ratio from pWidth
                      ratio = (float) pWidth / (float) pOriginalWidth;
                      pHeight = Math.round((float) pOriginalHeight * ratio);
                  }
                  else if (pHeight >= 0) {
                      // Find ratio from pHeight
                      ratio = (float) pHeight / (float) pOriginalHeight;
                      pWidth = Math.round((float) pOriginalWidth * ratio);
                  }
                  // Else: No scale
              }
          }
  
          // Default is no scale, just work as a proxy
          if (pWidth < 0) {
              pWidth = pOriginalWidth;
          }
          if (pHeight < 0) {
              pHeight = pOriginalHeight;
          }
  
          // Create new Dimension object and return
          return new Dimension(pWidth, pHeight);
      }