I have a tiny feature request

Is it possible to have official SDL_GetPixel() and SDL_PutPixel() functions?

Yes I am aware of the example functions in the documentation, but I think it
would be better to have them built into the API than having to copy/paste it
into every project we’re going to use them in.

I agree, we really should have that. :-/

Lazy Foo wrote:> Is it possible to have official SDL_GetPixel() and SDL_PutPixel() functions?

Yes I am aware of the example functions in the documentation, but I think it
would be better to have them built into the API than having to copy/paste it
into every project we’re going to use them in.

Is it possible to have official SDL_GetPixel() and SDL_PutPixel()
functions?

Yes I am aware of the example functions in the documentation, but I
think it would be better to have them built into the API than having
to copy/paste it into every project we’re going to use them in.

i was kinda missing that at one point, but pixel drawing is really slow
though.

mattOn Fri, 3 Aug 2007 00:32:20 +0000 (UTC) Lazy Foo wrote:

matt <mattmatteh earthlink.net> writes:

i was kinda missing that at one point, but pixel drawing is really slow
though.

matt

SDL_PutPixel() don’t replace blitting. They’re there for situations where
you need to directly access pixels IE bitmap font engines.

It’d probably end up one of those things where people would start using it
heavily and then complain about the speed and similar… much like using
QUAD’s to blit 2d things in opengl. Besides, working on your own put/get
pixel is a great way to get introduced to SDL.

Granted, you could easily argue that knowing how the insides of surfaces and
such work is beyond the scope of the end user… that they should only be
concerned with higher level stuff…

I dunno. I’m not extremely active in the SDL world, but I say making people
implement their own putpixel/getpixel stuff is preferred… just as an
introduction to the darker side of graphics programming.

-WillOn 8/2/07, Lazy Foo wrote:

matt <mattmatteh earthlink.net> writes:

i was kinda missing that at one point, but pixel drawing is really slow
though.

matt

SDL_PutPixel() don’t replace blitting. They’re there for situations where
you need to directly access pixels IE bitmap font engines.

SDL_PutPixel() don’t replace blitting. They’re there for situations where
you need to directly access pixels IE bitmap font engines.

Possibly, although it’s always about an order of magnitude faster to do the
pixel accesses inline rather than call a function to do so.

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

If SDL can offer a fast way to put pixels, it could make blending a
bit more easier. For me, i now do this in load time, so i only have
resulting surfaces ready. When i really want to have my sprites
affected, i only check the pixels that need to be blended, which
leaves me to the sprite surface itself.

It requires more ram, as i must remember what has to be blended with
what (light effects, etc) but in the end it is faster.

I don’t know if there are any references to fast-blending or
fast-putpixel routines?

regards,

Stefan

2007/8/3, Sam Lantinga :> > SDL_PutPixel() don’t replace blitting. They’re there for situations where

you need to directly access pixels IE bitmap font engines.

Possibly, although it’s always about an order of magnitude faster to do the
pixel accesses inline rather than call a function to do so.

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Stefan Hendriks

http://www.fundynamic.nl

Hey,

Could the pixel access be done through macros in the SDL #includes? Why would it have to be a function?

Jonny D> To: sdl at lists.libsdl.org> From: slouken at devolution.com> Date: Thu, 2 Aug 2007 21:03:28 -0700> Subject: Re: [SDL] I have a tiny feature request> > > SDL_PutPixel() don’t replace blitting. They’re there for situations where> > you need to directly access pixels IE bitmap font engines.> > Possibly, although it’s always about an order of magnitude faster to do the> pixel accesses inline rather than call a function to do so.> > See ya,> -Sam Lantinga, Lead Software Engineer, Blizzard Entertainment> _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what you?re getting into?before you go there
http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral_preview_0507

Hey,

Could the pixel access be done through macros in the SDL #includes?
Why would it have to be a function?

Even as macros, they won’t be as fast as more direct access. Largely
because you’ll end up having to do more calculation per pixel (y*span+x)
instead of, say, merely incrementing a pointer.

I do think adding the API is good, though, as sometimes it’s just
necessary, and easier, and the performance of a macro (or inline
function) isn’t that bad. Not everyone cares about being able to push
an extra 4 FPS when they’re already capable of pushing 1000. :pOn Fri, 2007-08-03 at 16:17 -0400, Jonathan Dearborn wrote:

Jonny D


To: sdl at lists.libsdl.org
From: slouken at devolution.com
Date: Thu, 2 Aug 2007 21:03:28 -0700
Subject: Re: [SDL] I have a tiny feature request

SDL_PutPixel() don’t replace blitting. They’re there for
situations where

you need to directly access pixels IE bitmap font engines.

Possibly, although it’s always about an order of magnitude faster to
do the
pixel accesses inline rather than call a function to do so.

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what you?re getting into?before you go there See it!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hey,

Could the pixel access be done through macros in the SDL #includes?
Why would it have to be a function?
Jonny D

not sure macro’s are a good idea. arguments in those can be tricky,
like i++ can expand to more than that.

mattOn Fri, 3 Aug 2007 16:17:15 -0400 Jonathan Dearborn wrote:

Hey,

Could the pixel access be done through macros in the SDL #includes?
Why would it have to be a function?
Jonny D

not sure macro’s are a good idea. arguments in those can be tricky,
like i++ can expand to more than that.

Good point. In pixel access functions, that sort of thing would be
very, very common.

However, I don’t believe any argument would need to be expanded more
than once. It really is as simple as (y*span+x). The only parameter
which would be expanded more than once is the surface itself; once to
access the pixel data, and once to access the horizontal span.On Fri, 2007-08-03 at 23:20 -0500, matt wrote:

On Fri, 3 Aug 2007 16:17:15 -0400 Jonathan Dearborn wrote:

matt


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Sean Middleditch <@Sean_Middleditch>