TextureView.setTransform(Matrix transform)方法的作用

今天在學習Github上大佬的代碼的時候,發現了一個方法Texture.setTransform()

    /**
     * <p>Sets the transform to associate with this texture view.
     * The specified transform applies to the underlying surface
     * texture and does not affect the size or position of the view
     * itself, only of its content.</p>
     * 設置要與此texture view關聯的變換。指定的轉換應用於surface texture,
     * 不影響視圖的大小或位置本身,只是它的內容
     *
     * <p>Some transforms might prevent the content from drawing
     * all the pixels contained within this view's bounds. In such
     * situations, make sure this texture view is not marked opaque.</p>
     * 某些轉換可能會阻止繪製內容此view的邊界內包含的所有像素。在這樣的
     * 情況下,請確保此TextureView未標記爲不透明
     *
     * @param transform The transform to apply to the content of
     *        this view.
     *        轉換要應用於的view的內容
     *
     * @see #getTransform(android.graphics.Matrix)
     * @see #isOpaque()
     * @see #setOpaque(boolean)
     */
    public void setTransform(Matrix transform) {
        mMatrix.set(transform);
        mMatrixChanged = true;
        invalidateParentIfNeeded();
    }

(註釋翻譯源自百度翻譯)

從源碼上看就是說本方法修改的並不是view本身的大小,只是其中畫面內容會發生改變。

那麼畫面內容會發生何種變化呢?比如大小變化、畫面旋轉角度變化等(詳情可以參見->Android中的Matrix

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章