public void scale(LDSize s, AspectRatioMode mode) { LDSize size = this.scaled(s, mode); this.wd = size.wd; this.ht = size.ht; }
public LDSize scaled(LDSize s, AspectRatioMode mode) { if (s.isEmpty()) { return(new LDSize()); } LDSize S; switch (mode) { case AspectRatioMode.IgnoreAspectRatio: S = s; break; case AspectRatioMode.KeepAspectRatio: S = new LDSize(this.wd * Math.Min(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Min(s.wd / this.wd, s.ht / this.ht)); break; case AspectRatioMode.KeepAspectRatioByExpanding: S = new LDSize(this.wd * Math.Max(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Max(s.wd / this.wd, s.ht / this.ht)); break; default: S = null; break; } return(S); }
public LDRect(LDPoint topleft, LDSize size) { this.xp = topleft.x(); this.yp = topleft.y(); this.w = size.width(); this.h = size.height(); }
public void updateUvMap(LDSize ImageSize) { m_uvMap.Clear(); for (int i = 0; i < m_points.size(); i++) { float u = m_points[i].x() / ImageSize.width(); float v = m_points[i].y() / ImageSize.height(); LDMathUtil.clamp(u, 0.0f, 1.0f); LDMathUtil.clamp(v, 0.0f, 1.0f); m_uvMap.Add(new LDPoint(u, v)); } }
public LDSize(LDSize sz) { this.wd = sz.wd; this.ht = sz.ht; }
public LDSize boundedTo(LDSize s) { return(new LDSize(Math.Min(this.wd, s.wd), Math.Min(this.wd, this.ht))); }
public LDSize expandedTo(LDSize s) { return(new LDSize(Math.Max(this.wd, s.wd), Math.Max(this.wd, this.ht))); }
public void setSize(LDSize s) { this.w = s.width(); this.h = s.height(); }
public LDSize expandedTo(LDSize s) { return new LDSize(Math.Max(this.wd, s.wd), Math.Max(this.wd, this.ht)); }
public LDSize boundedTo(LDSize s) { return new LDSize(Math.Min(this.wd, s.wd), Math.Min(this.wd, this.ht)); }
public LDSize scaled(LDSize s, AspectRatioMode mode) { if (s.isEmpty()) return new LDSize(); LDSize S; switch (mode) { case AspectRatioMode.IgnoreAspectRatio: S = s; break; case AspectRatioMode.KeepAspectRatio: S = new LDSize(this.wd * Math.Min(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Min(s.wd / this.wd, s.ht / this.ht)); break; case AspectRatioMode.KeepAspectRatioByExpanding: S = new LDSize(this.wd * Math.Max(s.wd / this.wd, s.ht / this.ht), this.ht * Math.Max(s.wd / this.wd, s.ht / this.ht)); break; default: S = null; break; } return S; }