to top
Android APIs
public class

Matrix2f

extends Object
java.lang.Object
   ↳ android.renderscript.Matrix2f

Class Overview

Class for exposing the native Renderscript rs_matrix2x2 type back to the Android system.

Summary

Public Constructors
Matrix2f()
Creates a new identity 2x2 matrix
Matrix2f(float[] dataArray)
Creates a new matrix and sets its values from the given parameter
Public Methods
float get(int x, int y)
Returns the value for a given row and column
float[] getArray()
Return a reference to the internal array representing matrix values.
void load(Matrix2f src)
Sets the values of the matrix to those of the parameter
void loadIdentity()
Sets the matrix values to identity
void loadMultiply(Matrix2f lhs, Matrix2f rhs)
Sets current values to be the result of multiplying two given matrices
void loadRotate(float rot)
Sets current values to be a rotation matrix of given angle
void loadScale(float x, float y)
Sets current values to be a scale matrix of given dimensions
void multiply(Matrix2f rhs)
Post-multiplies the current matrix by a given parameter
void rotate(float rot)
Modifies the current matrix by post-multiplying it with a rotation matrix of given angle
void scale(float x, float y)
Modifies the current matrix by post-multiplying it with a scale matrix of given dimensions
void set(int x, int y, float v)
Sets the value for a given row and column
void transpose()
Sets the current matrix to its transpose
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Matrix2f ()

Added in API level 11

Creates a new identity 2x2 matrix

public Matrix2f (float[] dataArray)

Added in API level 11

Creates a new matrix and sets its values from the given parameter

Parameters
dataArray values to set the matrix to, must be 4 floats long

Public Methods

public float get (int x, int y)

Added in API level 11

Returns the value for a given row and column

Parameters
x column of the value to return
y row of the value to return
Returns
  • value in the yth row and xth column

public float[] getArray ()

Added in API level 11

Return a reference to the internal array representing matrix values. Modifying this array will also change the matrix

Returns
  • internal array representing the matrix

public void load (Matrix2f src)

Added in API level 11

Sets the values of the matrix to those of the parameter

Parameters
src matrix to load the values from

public void loadIdentity ()

Added in API level 11

Sets the matrix values to identity

public void loadMultiply (Matrix2f lhs, Matrix2f rhs)

Added in API level 11

Sets current values to be the result of multiplying two given matrices

Parameters
lhs left hand side matrix
rhs right hand side matrix

public void loadRotate (float rot)

Added in API level 11

Sets current values to be a rotation matrix of given angle

Parameters
rot rotation angle

public void loadScale (float x, float y)

Added in API level 11

Sets current values to be a scale matrix of given dimensions

Parameters
x scale component x
y scale component y

public void multiply (Matrix2f rhs)

Added in API level 11

Post-multiplies the current matrix by a given parameter

Parameters
rhs right hand side to multiply by

public void rotate (float rot)

Added in API level 11

Modifies the current matrix by post-multiplying it with a rotation matrix of given angle

Parameters
rot angle of rotation

public void scale (float x, float y)

Added in API level 11

Modifies the current matrix by post-multiplying it with a scale matrix of given dimensions

Parameters
x scale component x
y scale component y

public void set (int x, int y, float v)

Added in API level 11

Sets the value for a given row and column

Parameters
x column of the value to set
y row of the value to set

public void transpose ()

Added in API level 11

Sets the current matrix to its transpose