Trim() public méthode

Trim the glyphs, ensuring that they will never go past the specified bounds.
public Trim ( int xMin, int yMin, int xMax, int yMax ) : void
xMin int
yMin int
xMax int
yMax int
Résultat void
Exemple #1
0
    private void Trim()
    {
        var texture = mAtlas.texture;

        if (texture != null && mSprite != null)
        {
            var rect  = NGUIMath.ConvertToPixels(mUVRect, this.texture.width, this.texture.height, true);
            var rect2 = mAtlas.coordinates != UIAtlas.Coordinates.TexCoords ? mSprite.outer : NGUIMath.ConvertToPixels(mSprite.outer, texture.width, texture.height, true);
            var xMin  = Mathf.RoundToInt(rect2.xMin - rect.xMin);
            var yMin  = Mathf.RoundToInt(rect2.yMin - rect.yMin);
            var xMax  = Mathf.RoundToInt(rect2.xMax - rect.xMin);
            var yMax  = Mathf.RoundToInt(rect2.yMax - rect.yMin);
            mFont.Trim(xMin, yMin, xMax, yMax);
        }
    }
    private void Trim()
    {
        Texture texture = mAtlas.texture;

        if (texture != null && mSprite != null)
        {
            Rect rect  = NGUIMath.ConvertToPixels(mUVRect, this.texture.width, this.texture.height, round: true);
            Rect rect2 = new Rect((float)mSprite.x, (float)mSprite.y, (float)mSprite.width, (float)mSprite.height);
            int  xMin  = Mathf.RoundToInt(rect2.xMin - rect.xMin);
            int  yMin  = Mathf.RoundToInt(rect2.yMin - rect.yMin);
            int  xMax  = Mathf.RoundToInt(rect2.xMax - rect.xMin);
            int  yMax  = Mathf.RoundToInt(rect2.yMax - rect.yMin);
            mFont.Trim(xMin, yMin, xMax, yMax);
        }
    }
Exemple #3
0
    /// <summary>
    /// Trim the glyphs, making sure they never go past the trimmed texture bounds.
    /// </summary>

    void Trim()
    {
        Texture tex = mAtlas.texture;

        if (tex != null && mSprite != null)
        {
            Rect full    = NGUIMath.ConvertToPixels(mUVRect, texture.width, texture.height, true);
            Rect trimmed = new Rect(mSprite.x, mSprite.y, mSprite.width, mSprite.height);

            int xMin = Mathf.RoundToInt(trimmed.xMin - full.xMin);
            int yMin = Mathf.RoundToInt(trimmed.yMin - full.yMin);
            int xMax = Mathf.RoundToInt(trimmed.xMax - full.xMin);
            int yMax = Mathf.RoundToInt(trimmed.yMax - full.yMin);

            mFont.Trim(xMin, yMin, xMax, yMax);
        }
    }
Exemple #4
0
    /// <summary>
    /// Trim the glyphs, making sure they never go past the trimmed texture bounds.
    /// </summary>

    void Trim()
    {
        Texture tex = mAtlas.texture;

        if (tex != null && mSprite != null)
        {
            Rect full    = NGUIMath.ConvertToPixels(mUVRect, texture.width, texture.height, true);
            Rect trimmed = (mAtlas.coordinates == UIAtlas.Coordinates.TexCoords) ?
                           NGUIMath.ConvertToPixels(mSprite.outer, tex.width, tex.height, true) : mSprite.outer;

            int xMin = Mathf.RoundToInt(trimmed.xMin - full.xMin);
            int yMin = Mathf.RoundToInt(trimmed.yMin - full.yMin);
            int xMax = Mathf.RoundToInt(trimmed.xMax - full.xMin);
            int yMax = Mathf.RoundToInt(trimmed.yMax - full.yMin);

            mFont.Trim(xMin, yMin, xMax, yMax);
        }
    }
    }    //IL_0015: Unknown result type (might be due to invalid IL or missing references)

    //IL_001a: Unknown result type (might be due to invalid IL or missing references)


    private void Trim()
    {
        //IL_0024: Unknown result type (might be due to invalid IL or missing references)
        //IL_0040: Unknown result type (might be due to invalid IL or missing references)
        //IL_0045: Unknown result type (might be due to invalid IL or missing references)
        Texture texture = mAtlas.texture;

        if (texture != null && mSprite != null)
        {
            Rect val  = NGUIMath.ConvertToPixels(mUVRect, this.texture.get_width(), this.texture.get_height(), true);
            Rect val2 = default(Rect);
            val2._002Ector((float)mSprite.x, (float)mSprite.y, (float)mSprite.width, (float)mSprite.height);
            int xMin = Mathf.RoundToInt(val2.get_xMin() - val.get_xMin());
            int yMin = Mathf.RoundToInt(val2.get_yMin() - val.get_yMin());
            int xMax = Mathf.RoundToInt(val2.get_xMax() - val.get_xMin());
            int yMax = Mathf.RoundToInt(val2.get_yMax() - val.get_yMin());
            mFont.Trim(xMin, yMin, xMax, yMax);
        }
    }
Exemple #6
0
 static public int Trim(IntPtr l)
 {
     try {
         BMFont       self = (BMFont)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         System.Int32 a3;
         checkType(l, 4, out a3);
         System.Int32 a4;
         checkType(l, 5, out a4);
         self.Trim(a1, a2, a3, a4);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }