# SDL\_MapSurface use in code

**URL:** <https://discourse.libsdl.org/t/sdl-mapsurface-use-in-code/784>\
**Category:** SDL Development\
**Created:** [March 22, 1999, 3:01am UTC](https://discourse.libsdl.org/t/sdl-mapsurface-use-in-code/784 "1999-03-22T03:01:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Southgate](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@Alexander\_Southgate](https://discourse.libsdl.org/u/Alexander_Southgate)\
**Post date:** [March 22, 1999, 3:01am UTC](https://discourse.libsdl.org/t/sdl-mapsurface-use-in-code/784/1 "1999-03-22T03:01:42Z")

</div>

I’m attempting to use SDL\_MapSurface() in a chunk of code, but I’m getting  
implicit declaration errors when compiling.

I checkec the /usr/local/include/SDL directory, and truly enough there doesn’t  
seem to be an SDL\_MapSurface function in any of the include files. However,  
the function does show up in SDL-0.9.9/src/SDL\_pixels.c.

The SDL documentation doesn’t say that I can’t use it. Am I missing something  
here?

Thanks  
Alex—  
[alex southgate]  
[@Alexander_Southgate]  
[(212)677-2977]

---

<div class="post-metadata">

**Author:** ![Michael\_K\_Vance](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@Michael\_K\_Vance](https://discourse.libsdl.org/u/Michael_K_Vance)\
**Post date:** [March 22, 1999, 4:23am UTC](https://discourse.libsdl.org/t/sdl-mapsurface-use-in-code/784/2 "1999-03-22T04:23:31Z")

</div>

Master Southgate wrote:

> I’m attempting to use SDL\_MapSurface() in a chunk of code, but I’m getting  
> implicit declaration errors when compiling.

You probably want to use SDL\_DisplayFormat instead. The docs aren’t updated.

m.–  
“We can deny everything, except that we have the possibility of being better.  
Simply reflect on that.”  
– His Holiness The Dalai Lama

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [March 22, 1999, 5:23am UTC](https://discourse.libsdl.org/t/sdl-mapsurface-use-in-code/784/3 "1999-03-22T05:23:35Z")

</div>

> I’m attempting to use SDL\_MapSurface() in a chunk of code, but I’m getting  
> implicit declaration errors when compiling.

The function is no longer necessary as of SDL 0.9.x

> I checkec the /usr/local/include/SDL directory, and truly enough there doesn’t  
> seem to be an SDL\_MapSurface function in any of the include files. However,  
> the function does show up in SDL-0.9.9/src/SDL\_pixels.c.

> The SDL documentation doesn’t say that I can’t use it. Am I missing something  
> here?

Where did the documentation show you that you could use it?

```
-Sam Lantinga (slouken at devolution.com)

```

## Lead Programmer, Loki Entertainment Software– Author of Simple DirectMedia Layer - [http://www.devolution.com/~slouken/SDL/](http://www.devolution.com/~slouken/SDL/)

---

<div class="post-metadata">

**Author:** ![Alexander\_Southgate](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@Alexander\_Southgate](https://discourse.libsdl.org/u/Alexander_Southgate)\
**Post date:** [March 23, 1999, 3:01am UTC](https://discourse.libsdl.org/t/sdl-mapsurface-use-in-code/784/4 "1999-03-23T03:01:34Z")

</div>

The HTML Docs, in the Function Reference. They don’t say that I _can’t_ use it.

extern SDL\_Surface \*SDL\_DisplayFormat(SDL\_Surface \*surface); 

This function takes a surface and copies it to a new surface of the pixel  
format and colors of the  
video framebuffer, suitable for fast blitting onto the display surface. It calls  
SDL\_ConvertSurface()e  
etc…  
\</From the Docs\>

I’m trying to do a fade to black of an 8-bit BMP that I have loaded  
with LoadBMP. I figure I need to set the palette of the screen  
surface to that of the image surface, so that I can directly manipulate  
the screen’s palette, instead of manipulating the image’s palette, and blitting  
the image to the screen surface at every update. Here is where I thought I  
could use MapSurface to copy the image’s format, palette and all, to the screen  
surface’s format. What method would you suggest?

Thanks  
AlexOn 22-Mar-99 Sam Lantinga wrote:

> > I’m attempting to use SDL\_MapSurface() in a chunk of code, but I’m getting  
> > implicit declaration errors when compiling.
> 
> The function is no longer necessary as of SDL 0.9.x
> 
> > I checkec the /usr/local/include/SDL directory, and truly enough there  
> > doesn’t  
> > seem to be an SDL\_MapSurface function in any of the include files. However,  
> > the function does show up in SDL-0.9.9/src/SDL\_pixels.c.
> 
> > The SDL documentation doesn’t say that I can’t use it. Am I missing  
> > something  
> > here?
> 
> Where did the documentation show you that you could use it?
> 
> ```
> -Sam Lantinga (slouken at devolution.com)
> 
> ```
> 
> ## Lead Programmer, Loki Entertainment Software
> 
> ## Author of Simple DirectMedia Layer - [http://www.devolution.com/~slouken/SDL/](http://www.devolution.com/~slouken/SDL/)

* * *

[alex southgate]  
[@Alexander_Southgate]  
[(212)677-2977]
