Lingua

MediaProjection.Callback.OnCapturedContentResize(Int32, Int32) Metodo

Definizione

Richiamato immediatamente dopo l'inizio dell'acquisizione o quando cambia la dimensione dell'area acquisita, fornendo il ridimensionamento accurato per l'acquisizione trasmessa.

[Android.Runtime.Register("onCapturedContentResize", "(II)V", "GetOnCapturedContentResize_IIHandler", ApiSince=34)]
public virtual void OnCapturedContentResize(int width, int height);
[<Android.Runtime.Register("onCapturedContentResize", "(II)V", "GetOnCapturedContentResize_IIHandler", ApiSince=34)>]
abstract member OnCapturedContentResize : int * int -> unit
override this.OnCapturedContentResize : int * int -> unit

Parametri

width
Int32

Larghezza dell'area acquisita, in pixel.

height
Int32

Altezza dell'area acquisita, in pixel.

Attributi

Commenti

Richiamato immediatamente dopo l'inizio dell'acquisizione o quando cambia la dimensione dell'area acquisita, fornendo il ridimensionamento accurato per l'acquisizione trasmessa.

La larghezza e l'altezza specificate, in pixel, corrispondono alla stessa larghezza e altezza che verrebbe restituita dall'area android.view.WindowMetrics#getBounds() acquisita.

Se il contenuto registrato ha proporzioni diverse rispetto all'output VirtualDisplaySurfaceo , il flusso acquisito dispone di letterboxing (barre nere) intorno al contenuto registrato. L'applicazione può evitare il letterboxing intorno al contenuto registrato aggiornando le dimensioni dell'output VirtualDisplaySurfacee :

&#x40;Override
            public String onCapturedContentResize(int width, int height) {
                // VirtualDisplay instance from MediaProjection#createVirtualDisplay
                virtualDisplay.resize(width, height, dpi);

                // Create a new Surface with the updated size (depending on the application's use
                // case, this may be through different APIs - see Surface documentation for
                // options).
                int texName; // the OpenGL texture object name
                SurfaceTexture surfaceTexture = new SurfaceTexture(texName);
                surfaceTexture.setDefaultBufferSize(width, height);
                Surface surface = new Surface(surfaceTexture);

                // Ensure the VirtualDisplay has the updated Surface to send the capture to.
                virtualDisplay.setSurface(surface);
            }

per android.media.projection.MediaProjection.Callback.onCapturedContentResize(int, int).

Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dalla e usati in base ai termini descritti in Creative License 2.5 Attribution License.

Si applica a