Esempio n. 1
0
        public void scale(LDSize s, AspectRatioMode mode)
        {
            LDSize size = this.scaled(s, mode);

            this.wd = size.wd;
            this.ht = size.ht;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public LDRect(LDPoint topleft, LDSize size)
 {
     this.xp = topleft.x();
     this.yp = topleft.y();
     this.w  = size.width();
     this.h  = size.height();
 }
Esempio n. 4
0
 public LDRect(LDPoint topleft, LDSize size)
 {
     this.xp = topleft.x();
     this.yp = topleft.y();
     this.w = size.width();
     this.h = size.height();
 }
Esempio n. 5
0
        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));
            }
        }
Esempio n. 6
0
 public LDSize(LDSize sz)
 {
     this.wd = sz.wd;
     this.ht = sz.ht;
 }
Esempio n. 7
0
 public LDSize boundedTo(LDSize s)
 {
     return(new LDSize(Math.Min(this.wd, s.wd), Math.Min(this.wd, this.ht)));
 }
Esempio n. 8
0
 public LDSize expandedTo(LDSize s)
 {
     return(new LDSize(Math.Max(this.wd, s.wd), Math.Max(this.wd, this.ht)));
 }
Esempio n. 9
0
 public void setSize(LDSize s)
 {
     this.w = s.width();
     this.h = s.height();
 }
Esempio n. 10
0
 public void setSize(LDSize s)
 {
     this.w = s.width();
     this.h = s.height();
 }
Esempio n. 11
0
 public LDSize expandedTo(LDSize s)
 {
     return new LDSize(Math.Max(this.wd, s.wd), Math.Max(this.wd, this.ht));
 }
Esempio n. 12
0
 public LDSize boundedTo(LDSize s)
 {
     return new LDSize(Math.Min(this.wd, s.wd), Math.Min(this.wd, this.ht));
 }
Esempio n. 13
0
 public LDSize(LDSize sz)
 {
     this.wd = sz.wd;
     this.ht = sz.ht;
 }
Esempio n. 14
0
 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;
 }
Esempio n. 15
0
 public void scale(LDSize s, AspectRatioMode mode)
 {
     LDSize size = this.scaled(s, mode);
     this.wd = size.wd;
     this.ht = size.ht;
 }
Esempio n. 16
0
        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));
            }
        }