/// <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; }
/// <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; }
/// <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(); }
public static extern SDL_Cursor *CreateColorCursor(SDL_Surface_Native *surface, Int32 hot_x, Int32 hot_y);
public static extern Int32 GetSurfaceBlendMode(SDL_Surface_Native *surface, SDL_BlendMode *blendMode);
public static Int32 BlitScaled(SDL_Surface_Native *src, SDL_Rect *srcrect, SDL_Surface_Native *dst, SDL_Rect *dstrect) { return(UpperBlitScaled(src, srcrect, dst, dstrect)); }
private static extern Int32 UpperBlitScaled(SDL_Surface_Native *src, SDL_Rect *srcrect, SDL_Surface_Native *dst, SDL_Rect *dstrect);
public static extern void UnlockSurface(SDL_Surface_Native *surface);
public static extern Int32 LockSurface(SDL_Surface_Native *surface);
public static extern void FreeSurface(SDL_Surface_Native *surface);
public static Int32 SaveBMP(SDL_Surface_Native *surface, String file) { return(SaveBMP_RW(surface, RWFromFile(file, "wb"), 1)); }
public static extern Int32 SaveBMP_RW(SDL_Surface_Native *surface, IntPtr dst, Int32 freedst);
public static Boolean MUSTLOCK(SDL_Surface_Native *surface) { const uint SDL_RLEACCEL = 0x00000002; return((surface->flags & SDL_RLEACCEL) != 0); }