Read dimension for non-original rendition from renditions metadata generated by "DamRenditionMetadataService".
@param rendition Rendition
@return Dimension or null
345685
private static @Nullable Dimension getDimensionFromRenditionMetadata(@NotNull Rendition rendition) {
    Asset asset = rendition.getAsset();
    String metadataPath = JCR_CONTENT + "/" + NN_RENDITIONS_METADATA + "/" + rendition.getName();
    Resource metadataResource = AdaptTo.notNull(asset, Resource.class).getChild(metadataPath);
    if (metadataResource != null) {
      ValueMap props = metadataResource.getValueMap();
      long width = props.get(PN_IMAGE_WIDTH, 0L);
      long height = props.get(PN_IMAGE_HEIGHT, 0L);
      return toDimension(width, height);
    }
    return null;
  }
661037
private Set<RenditionMetadata> getRendtionsMatchingFileExtensions(String[] fileExtensions, MediaArgs mediaArgs) {

    // if no file extension restriction get all renditions
    Set<RenditionMetadata> allRenditions = getAvailableRenditions(mediaArgs);
    if (fileExtensions == null || fileExtensions.length == 0) {
      return allRenditions;
    }

    // otherwise return those with matching extensions
    Set<RenditionMetadata> matchingRenditions = new TreeSet<RenditionMetadata>();
    for (RenditionMetadata rendition : allRenditions) {
      for (String fileExtension : fileExtensions) {
        if (StringUtils.equalsIgnoreCase(fileExtension, rendition.getFileExtension())) {
          matchingRenditions.add(rendition);
          break;
        }
      }
    }
    return matchingRenditions;
  }
683840
synchronized Dimension getPreferredSize() {
        return new Dimension(getFontWidth() * virtualTerminal.getTerminalSize().getColumns(),
                getFontHeight() * virtualTerminal.getTerminalSize().getRows());
    }
365532
private boolean readVersionRegion0(QrCode qr) {
		// set the coordinate system to the closest pp to reduce position errors
		gridReader.setSquare(qr.ppRight, (float) qr.threshRight);

		bits.resize(18);
		bits.zero();
		for (int i = 0; i < 18; i++) {
			int row = i/3;
			int col = i%3;
			read(i,row,col-4);
		}
//		System.out.println(" decoder version region 0 =  "+Integer.toBinaryString(bits.data[0]));


		return true;
	}
301579
public function convertRendition(array $data = null)
    {
        if (empty($data)) {
            return null;
        }
        $rendition = new RenditionData();

        if (isset($data[JSONConstants::JSON_RENDITION_HEIGHT])) {
            $rendition->setHeight((integer) $data[JSONConstants::JSON_RENDITION_HEIGHT]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_KIND])) {
            $rendition->setKind((string) $data[JSONConstants::JSON_RENDITION_KIND]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_LENGTH])) {
            $rendition->setLength((integer) $data[JSONConstants::JSON_RENDITION_LENGTH]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_MIMETYPE])) {
            $rendition->setMimeType((string) $data[JSONConstants::JSON_RENDITION_MIMETYPE]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_DOCUMENT_ID])) {
            $rendition->setRenditionDocumentId((string) $data[JSONConstants::JSON_RENDITION_DOCUMENT_ID]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_STREAM_ID])) {
            $rendition->setStreamId((string) $data[JSONConstants::JSON_RENDITION_STREAM_ID]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_TITLE])) {
            $rendition->setTitle((string) $data[JSONConstants::JSON_RENDITION_TITLE]);
        }
        if (isset($data[JSONConstants::JSON_RENDITION_WIDTH])) {
            $rendition->setWidth((integer) $data[JSONConstants::JSON_RENDITION_WIDTH]);
        }

        $rendition->setExtensions($this->convertExtension($data, JSONConstants::getRenditionKeys()));

        return $rendition;
    }
1052371
@Nonnegative
  public static int getSize (@Nullable final Iterator <?> aIterator)
  {
    int ret = 0;
    if (aIterator != null)
      while (aIterator.hasNext ())
      {
        aIterator.next ();
        ++ret;
      }
    return ret;
  }
17888
private double getCropScaleFactor() {
    RenditionMetadata original = getOriginalRendition();
    RenditionMetadata webEnabled = AutoCropping.getWebRenditionForCropping(getAsset());
    if (original == null || webEnabled == null || original.getWidth() == 0 || webEnabled.getWidth() == 0) {
      return 1d;
    }
    return (double)original.getWidth() / (double)webEnabled.getWidth();
  }
961867
private RenditionMetadata getVirtualRendition(RenditionMetadata rendition, long widthValue, long heightValue, double ratioValue) {

    long width = widthValue;
    long height = heightValue;
    double ratio = ratioValue;

    // if ratio is missing: calculate from given rendition
    if (ratio < MediaFormatHandler.RATIO_TOLERANCE) {
      ratio = (double)rendition.getWidth() / (double)rendition.getHeight();
    }

    // if height is missing - calculate from width
    if (height == 0 && width > 0) {
      height = (int)Math.round(width / ratio);
    }

    // if width is missing - calculate from height
    if (width == 0 && height > 0) {
      width = (int)Math.round(height * ratio);
    }

    // return virtual rendition
    if (width > 0 && height > 0) {
      if (rendition instanceof VirtualTransformedRenditionMetadata) {
        VirtualTransformedRenditionMetadata cropRendition = (VirtualTransformedRenditionMetadata)rendition;
        return new VirtualTransformedRenditionMetadata(cropRendition.getRendition(), width, height,
            cropRendition.getCropDimension(), cropRendition.getRotation());
      }
      else {
        return new VirtualRenditionMetadata(rendition.getRendition(), width, height);
      }
    }
    else {
      return null;
    }
  }
320262
@Override
  public RenditionMetadata getRendition(MediaArgs mediaArgs) {

    // get list of file extensions requested
    String[] requestedFileExtensions = getRequestedFileExtensions(mediaArgs);

    // if the array is null file extensions constraints are applied, but do not match to each other
    // - no rendition can fulfill these constraints
    if (requestedFileExtensions == null) {
      return null;
    }

    // check if a specific media size is requested
    boolean isSizeMatchingRequest = isSizeMatchingRequest(mediaArgs, requestedFileExtensions);

    // get rendition candidates matching for file extensions
    Set<RenditionMetadata> candidates = getRendtionsMatchingFileExtensions(requestedFileExtensions, mediaArgs);

    // if request does not contain any size restrictions return original image or first by filename matching rendition
    if (!isSizeMatchingRequest) {
      return getOriginalOrFirstRendition(candidates);
    }

    // original rendition is a image - check for matching rendition or build virtual one
    RenditionMetadata exactMatchRendition = getExactMatchRendition(candidates, mediaArgs);
    if (exactMatchRendition != null) {
      return exactMatchRendition;
    }

    // get rendition virtual rendition downscaled from existing one
    RenditionMetadata virtualRendition = getVirtualRendition(candidates, mediaArgs);
    if (virtualRendition != null) {
      return virtualRendition;
    }

    // no match found
    return null;
  }
682530
def get_rendition_size(self, spec, output_scale, crop):
        

        if crop:
            # Use the cropping rectangle size
            _, _, width, height = crop
        else:
            # Use the original image size
            width = self._record.width
            height = self._record.height

        mode = spec.get('resize', 'fit')
        if mode == 'fit':
            return self.get_rendition_fit_size(spec, width, height, output_scale)

        if mode == 'fill':
            return self.get_rendition_fill_size(spec, width, height, output_scale)

        if mode == 'stretch':
            return self.get_rendition_stretch_size(spec, width, height, output_scale)

        raise ValueError("Unknown resize mode {}".format(mode))
253866
public static final MetadataServiceListVersion valueOf(String version) {
    String[] components = version.split("\\.");
    return valueOf(Integer.valueOf(components[0]), Integer.valueOf(components[1]));
  }
22331
private boolean readFormatRegion1(QrCode qr) {
//		if( qr.ppRight.get(0).distance(988.8,268.3) < 30 )
//			System.out.println("tjere");
//		System.out.println(qr.ppRight.get(0));

		// set the coordinate system to the closest pp to reduce position errors
		gridReader.setSquare(qr.ppRight,(float)qr.threshRight);

		bits.resize(15);
		bits.zero();
		for (int i = 0; i < 8; i++) {
			read(i,8,6-i);
		}

		gridReader.setSquare(qr.ppDown,(float)qr.threshDown);

		for (int i = 0; i < 6; i++) {
			read(i+8,i,8);
		}

		return true;
	}
466195
function(request) {
        var doc = request.responseXML;
        if (!doc || !doc.documentElement) {
            doc = request.responseText;
        }
        if (!doc || doc.length <= 0) {
            return null;
        }
        return this.format.read(doc);
    }
883845
public static @Nullable RenditionMetadata getWebRenditionForCropping(@NotNull Asset asset) {
    return asset.getRenditions().stream()
        .filter(AssetRendition::isWebRendition)
        .findFirst()
        .map(rendition -> new RenditionMetadata(rendition))
        .orElse(null);
  }
881032
public static Dimension getScreenDimension(Component component)
	{
		int screenID = getScreenID(component);
		Dimension dimension = new Dimension(0, 0);

		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
		GraphicsConfiguration defaultConfiguration = ge.getScreenDevices()[screenID]
			.getDefaultConfiguration();
		Rectangle rectangle = defaultConfiguration.getBounds();
		dimension.setSize(rectangle.getWidth(), rectangle.getHeight());
		return dimension;
	}
82139
@SuppressWarnings("null")
  protected final @Nullable CropDimension getMediaCropDimension(@NotNull MediaRequest mediaRequest,
      @Nullable MediaHandlerConfig mediaHandlerConfig) {
    if (mediaRequest.getResource() != null) {
      String cropProperty = getMediaCropProperty(mediaRequest, mediaHandlerConfig);
      String cropString = mediaRequest.getResource().getValueMap().get(cropProperty, String.class);
      if (StringUtils.isNotEmpty(cropString)) {
        try {
          return CropDimension.fromCropString(cropString);
        }
        catch (IllegalArgumentException ex) {
          // ignore
        }
      }
    }
    return null;
  }
1079195
protected static void obtainTermSize ()
    {
        if (_tdimens == null) {
            _tdimens = TermUtil.getTerminalSize();

            // if we were unable to obtain our dimensions, use defaults
            if (_tdimens == null) {
                _tdimens = new Dimension(132, 24);
            }
        }
    }