Exemple #1
0
        static IntPtr mask(IntPtr Self, IntPtr Args)
        {
            Ruby.Array.Expect(Args, 2, 3, 4, 5);
            odl.Bitmap result = null;
            long       len    = Ruby.Array.Length(Args);

            if (len == 2)
            {
                Ruby.Array.Expect(Args, 0, "Bitmap");
                Ruby.Array.Expect(Args, 1, "Bitmap");
                GuardDisposed(Ruby.Array.Get(Args, 0));
                GuardDisposed(Ruby.Array.Get(Args, 1));
                odl.Bitmap maskbmp = BitmapDictionary[Ruby.Array.Get(Args, 0)];
                odl.Bitmap srcbmp  = BitmapDictionary[Ruby.Array.Get(Args, 1)];
                result = odl.Bitmap.Mask(maskbmp, srcbmp);
            }
            else if (len == 3)
            {
                Ruby.Array.Expect(Args, 0, "Bitmap");
                Ruby.Array.Expect(Args, 1, "Bitmap");
                Ruby.Array.Expect(Args, 2, "Rect");
                GuardDisposed(Ruby.Array.Get(Args, 0));
                GuardDisposed(Ruby.Array.Get(Args, 1));
                odl.Bitmap maskbmp = BitmapDictionary[Ruby.Array.Get(Args, 0)];
                odl.Bitmap srcbmp  = BitmapDictionary[Ruby.Array.Get(Args, 1)];
                odl.Rect   srcrect = Rect.CreateRect(Ruby.Array.Get(Args, 2));
                result = odl.Bitmap.Mask(maskbmp, srcbmp, srcrect);
            }
            else if (len == 4)
            {
                Ruby.Array.Expect(Args, 0, "Bitmap");
                Ruby.Array.Expect(Args, 1, "Bitmap");
                Ruby.Array.Expect(Args, 2, "Integer");
                Ruby.Array.Expect(Args, 3, "Integer");
                GuardDisposed(Ruby.Array.Get(Args, 0));
                GuardDisposed(Ruby.Array.Get(Args, 1));
                odl.Bitmap maskbmp = BitmapDictionary[Ruby.Array.Get(Args, 0)];
                odl.Bitmap srcbmp  = BitmapDictionary[Ruby.Array.Get(Args, 1)];
                int        offsetx = (int)Ruby.Integer.FromPtr(Ruby.Array.Get(Args, 2));
                int        offsety = (int)Ruby.Integer.FromPtr(Ruby.Array.Get(Args, 3));
                result = odl.Bitmap.Mask(maskbmp, srcbmp, offsetx, offsety);
            }
            else if (len == 5)
            {
                Ruby.Array.Expect(Args, 0, "Bitmap");
                Ruby.Array.Expect(Args, 1, "Bitmap");
                Ruby.Array.Expect(Args, 2, "Rect");
                Ruby.Array.Expect(Args, 3, "Integer");
                Ruby.Array.Expect(Args, 4, "Integer");
                GuardDisposed(Ruby.Array.Get(Args, 0));
                GuardDisposed(Ruby.Array.Get(Args, 1));
                odl.Bitmap maskbmp = BitmapDictionary[Ruby.Array.Get(Args, 0)];
                odl.Bitmap srcbmp  = BitmapDictionary[Ruby.Array.Get(Args, 1)];
                odl.Rect   srcrect = Rect.CreateRect(Ruby.Array.Get(Args, 2));
                int        offsetx = (int)Ruby.Integer.FromPtr(Ruby.Array.Get(Args, 3));
                int        offsety = (int)Ruby.Integer.FromPtr(Ruby.Array.Get(Args, 4));
                result = odl.Bitmap.Mask(maskbmp, srcbmp, srcrect, offsetx, offsety);
            }
            return(Bitmap.CreateBitmap(result));
        }
Exemple #2
0
 public static IntPtr CreateRect(odl.Rect Rect)
 {
     return(Ruby.Funcall(Class, "new", Ruby.Integer.ToPtr(Rect.X), Ruby.Integer.ToPtr(Rect.Y), Ruby.Integer.ToPtr(Rect.Width), Ruby.Integer.ToPtr(Rect.Height)));
 }