public final class

GlRect

extends java.lang.Object

 java.lang.Object

↳androidx.media3.common.util.GlRect

Gradle dependencies

compile group: 'androidx.media3', name: 'media3-common', version: '1.5.0-alpha01'

  • groupId: androidx.media3
  • artifactId: media3-common
  • version: 1.5.0-alpha01

Artifact androidx.media3:media3-common:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

Represents a rectangle by the coordinates of its 4 edges (left, bottom, right, top).

Note that the right and top coordinates are exclusive.

This class represents coordinates in the OpenGL coordinate convention: left <= right and bottom <= top.

Summary

Fields
public intbottom

public intleft

public intright

public inttop

Constructors
publicGlRect(int width, int height)

Creates an instance from (0, 0) to the specified width and height.

publicGlRect(int left, int bottom, int right, int top)

Creates an instance.

Methods
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public int left

public int bottom

public int right

public int top

Constructors

public GlRect(int width, int height)

Creates an instance from (0, 0) to the specified width and height.

public GlRect(int left, int bottom, int right, int top)

Creates an instance.

Source

/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package androidx.media3.common.util;

import static androidx.media3.common.util.Assertions.checkArgument;

/**
 * Represents a rectangle by the coordinates of its 4 edges (left, bottom, right, top).
 *
 * <p>Note that the right and top coordinates are exclusive.
 *
 * <p>This class represents coordinates in the OpenGL coordinate convention: {@code left <= right}
 * and {@code bottom <= top}.
 */
@UnstableApi
public final class GlRect {
  public int left;
  public int bottom;
  public int right;
  public int top;

  /** Creates an instance from (0, 0) to the specified width and height. */
  public GlRect(int width, int height) {
    this(/* left= */ 0, /* bottom= */ 0, width, height);
  }

  /** Creates an instance. */
  public GlRect(int left, int bottom, int right, int top) {
    checkArgument(left <= right && bottom <= top);
    this.left = left;
    this.bottom = bottom;
    this.right = right;
    this.top = top;
  }
}