io.github.humbleui.skija.RSXform Maven / Gradle / Ivy
// Generated by delombok at Mon Dec 20 14:13:09 UTC 2021
package io.github.humbleui.skija;
import org.jetbrains.annotations.*;
/**
* A compressed form of a rotation+scale matrix.
*
* [ fSCos -fSSin fTx ]
* [ fSSin fSCos fTy ]
* [ 0 0 1 ]
*/
public class RSXform {
@ApiStatus.Internal
public final float _scos;
@ApiStatus.Internal
public final float _ssin;
@ApiStatus.Internal
public final float _tx;
@ApiStatus.Internal
public final float _ty;
/**
* Initialize a new xform based on the scale, rotation (in radians), final tx,ty location
* and anchor-point ax,ay within the src quad.
*
* Note: the anchor point is not normalized (e.g. 0...1) but is in pixels of the src image.
*/
public static RSXform makeFromRadians(float scale, float radians, float tx, float ty, float ax, float ay) {
float s = (float) Math.sin(radians) * scale;
float c = (float) Math.cos(radians) * scale;
return new RSXform(c, s, tx + -c * ax + s * ay, ty + -s * ax - c * ay);
}
@java.lang.SuppressWarnings("all")
public RSXform(final float scos, final float ssin, final float tx, final float ty) {
this._scos = scos;
this._ssin = ssin;
this._tx = tx;
this._ty = ty;
}
@java.lang.SuppressWarnings("all")
public float getScos() {
return this._scos;
}
@java.lang.SuppressWarnings("all")
public float getSsin() {
return this._ssin;
}
@java.lang.SuppressWarnings("all")
public float getTx() {
return this._tx;
}
@java.lang.SuppressWarnings("all")
public float getTy() {
return this._ty;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof RSXform)) return false;
final RSXform other = (RSXform) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (java.lang.Float.compare(this.getScos(), other.getScos()) != 0) return false;
if (java.lang.Float.compare(this.getSsin(), other.getSsin()) != 0) return false;
if (java.lang.Float.compare(this.getTx(), other.getTx()) != 0) return false;
if (java.lang.Float.compare(this.getTy(), other.getTy()) != 0) return false;
return true;
}
@java.lang.SuppressWarnings("all")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof RSXform;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + java.lang.Float.floatToIntBits(this.getScos());
result = result * PRIME + java.lang.Float.floatToIntBits(this.getSsin());
result = result * PRIME + java.lang.Float.floatToIntBits(this.getTx());
result = result * PRIME + java.lang.Float.floatToIntBits(this.getTy());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "RSXform(_scos=" + this.getScos() + ", _ssin=" + this.getSsin() + ", _tx=" + this.getTx() + ", _ty=" + this.getTy() + ")";
}
}