Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.     IMGLIB:  An example image loading library for use with SDL
  3.     Copyright (C) 1999  Sam Lantinga
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public
  16.     License along with this library; if not, write to the Free
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.     Sam Lantinga
  20.     5635-34 Springhouse Dr.
  21.     Pleasanton, CA 94588 (USA)
  22.     slouken@devolution.com
  23. */
  24.  
  25. /* This is a BMP image file loading framework */
  26.  
  27. #include <stdio.h>
  28. #include <string.h>
  29.  
  30. #include "SDL_image.h"
  31.  
  32. #ifdef LOAD_BMP
  33.  
  34. /* See if an image is contained in a data source */
  35. int IMG_isBMP(SDL_RWops *src)
  36. {
  37.         int is_BMP;
  38.         char magic[2];
  39.  
  40.         is_BMP = 0;
  41.         if ( SDL_RWread(src, magic, 2, 1) ) {
  42.                 if ( strncmp(magic, "BM", 2) == 0 ) {
  43.                         is_BMP = 1;
  44.                 }
  45.         }
  46.         return(is_BMP);
  47. }
  48.  
  49. /* Load a BMP type image from an SDL datasource */
  50. SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src)
  51. {
  52.         return(SDL_LoadBMP_RW(src, 0));
  53. }
  54.  
  55. #else
  56.  
  57. /* See if an image is contained in a data source */
  58. int IMG_isBMP(SDL_RWops *src)
  59. {
  60.         return(0);
  61. }
  62.  
  63. /* Load a BMP type image from an SDL datasource */
  64. SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src)
  65. {
  66.         return(NULL);
  67. }
  68.  
  69. #endif /* LOAD_BMP */
  70.