/// <summary> /// Sets the mirror flags. /// </summary> /// <param name="mirrorX">The horizontal mirror.</param> /// <param name="mirrorY">The vertical mirror.</param> /// <returns>Self.</returns> public ImageSource WithMirror(bool mirrorX, bool mirrorY) { var o = _ImageFlags.None; if (mirrorX) { o |= _ImageFlags.FlipHorizontal; } if (mirrorY) { o |= _ImageFlags.FlipVertical; } if (_OrientationMask == o) { return(this); } _OrientationMask = o; _Transforms = null; return(this); }
public void TransformVertices(Span <XY> vertices, System.Numerics.Matrix3x2 xform, _ImageFlags o) { xform = _Transforms[(int)o] * xform; var r0 = new XY(xform.M11, xform.M12); var r1 = new XY(xform.M21, xform.M22); vertices[0] = xform.Translation; vertices[1] = xform.Translation + r0; vertices[2] = xform.Translation + r0 + r1; vertices[3] = xform.Translation + r1; }
public void TransformVertices(Span <Vertex2> vertices, System.Numerics.Matrix3x2 xform, _ImageFlags o, uint color) { xform = _Transforms[(int)o] * xform; var r0 = new XY(xform.M11, xform.M12); var r1 = new XY(xform.M21, xform.M22); vertices[0].Position = xform.Translation; vertices[0].Color = color; vertices[0].TextureCoord = _UV0; vertices[1].Position = xform.Translation + r0; vertices[1].Color = color; vertices[1].TextureCoord = _UV1; vertices[2].Position = xform.Translation + r0 + r1; vertices[2].Color = color; vertices[2].TextureCoord = _UV2; vertices[3].Position = xform.Translation + r1; vertices[3].Color = color; vertices[3].TextureCoord = _UV3; }
public System.Numerics.Matrix3x2 GetImageMatrix(_ImageFlags orientation) { return(_Transforms[(int)orientation]); }