Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the SDL_Surface class.
        /// </summary>
        /// <param name="src">A pointer to the native SDL surface.</param>
        public SDL_Surface(SDL_Surface_Native* src)
        {
            if (src == null)
                throw new ArgumentNullException("src");

            var dst = SDL.CreateRGBSurface(0, src->w, src->h, 32, rmask, gmask, bmask, amask);
            if (dst == null)
                throw new SDL2Exception();

            if (SDL.BlitSurface(src, null, dst, null) < 0)
                throw new SDL2Exception();

            this.ptr = dst;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the SDL_Surface class.
        /// </summary>
        /// <param name="src">A pointer to the native SDL surface.</param>
        public SDL_Surface(SDL_Surface_Native *src)
        {
            if (src == null)
            {
                throw new ArgumentNullException("src");
            }

            var dst = SDL.CreateRGBSurface(0, src->w, src->h, 32, rmask, gmask, bmask, amask);

            if (dst == null)
            {
                throw new SDL2Exception();
            }

            if (SDL.BlitSurface(src, null, dst, null) < 0)
            {
                throw new SDL2Exception();
            }

            this.ptr = dst;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the SDL_Surface class.
 /// </summary>
 /// <param name="width">The surface's width.</param>
 /// <param name="height">The surface's height.</param>
 public SDL_Surface(Int32 width, Int32 height)
 {
     if ((this.ptr = SDL.CreateRGBSurface(0, width, height, 32, rmask, gmask, bmask, amask)) == null)
         throw new SDL2Exception();
 }
Ejemplo n.º 4
0
 public static extern SDL_Cursor *CreateColorCursor(SDL_Surface_Native *surface, Int32 hot_x, Int32 hot_y);
Ejemplo n.º 5
0
 public static extern Int32 GetSurfaceBlendMode(SDL_Surface_Native *surface, SDL_BlendMode *blendMode);
Ejemplo n.º 6
0
 public static Int32 BlitScaled(SDL_Surface_Native *src, SDL_Rect *srcrect, SDL_Surface_Native *dst, SDL_Rect *dstrect)
 {
     return(UpperBlitScaled(src, srcrect, dst, dstrect));
 }
Ejemplo n.º 7
0
 private static extern Int32 UpperBlitScaled(SDL_Surface_Native *src, SDL_Rect *srcrect, SDL_Surface_Native *dst, SDL_Rect *dstrect);
Ejemplo n.º 8
0
 public static extern void UnlockSurface(SDL_Surface_Native *surface);
Ejemplo n.º 9
0
 public static extern Int32 LockSurface(SDL_Surface_Native *surface);
Ejemplo n.º 10
0
 public static extern void FreeSurface(SDL_Surface_Native *surface);
Ejemplo n.º 11
0
 public static Int32 SaveBMP(SDL_Surface_Native *surface, String file)
 {
     return(SaveBMP_RW(surface, RWFromFile(file, "wb"), 1));
 }
Ejemplo n.º 12
0
 public static extern Int32 SaveBMP_RW(SDL_Surface_Native *surface, IntPtr dst, Int32 freedst);
Ejemplo n.º 13
0
        public static Boolean MUSTLOCK(SDL_Surface_Native *surface)
        {
            const uint SDL_RLEACCEL = 0x00000002;

            return((surface->flags & SDL_RLEACCEL) != 0);
        }