Page 1 of 1

Want to expirement with graphics filters

Posted: Fri Sep 28, 2012 3:41 am
by Joe
Hey Folks,

I want to mess around with some graphics filter code. I thought it would be more fun to use Snes9x over AVISynth, which I've done a little in. I may need help figuring out how to access the pixels.

Right now, I'm looking through RenderPlain to see how to do a basic pixel copy.
What does SetRect do? I'm kind of guessing that it seems like it's setting the source read region for other htings. I don't run it, the emu crashes when showing text.

The pixel format is 555 for SNES, right? Is the source data always that? I did notice a few masking constants, but that could also be for the output. Also, the bit shifting is throwing me off a little on things like the pitch. I have a good idea what the pitch is, but in the context of this program, what is it?

Re: Want to expirement with graphics filters

Posted: Fri Sep 28, 2012 9:09 am
by OV2
Hi Joe,

The rect variable is used to determine how much of the destination surface has been filled by the filter. This is usually a multiple of the input (for renderplain it's factor 1), which is what SetRect() is used for. You can simply set the values to the rect directly.

The windows port usually uses RGB565. It can change in directdraw mode, but there are already some filters that can't handle other modes, such as blargg's ntsc.

Pitch is the amount of bytes from one line to the next in the surface. It is shifted around when using pointers other than uint8, since those increment according to their size (so if using uint16 *, it does Pitch >> 1).

Re: Want to expirement with graphics filters

Posted: Fri Sep 28, 2012 11:16 pm
by Joe
My goodness. I didn't know what to expect, but I'm glad I asked. There's lots of elitism when it comes to programming.

Thanks for the nice, clear answers

Re: Want to expirement with graphics filters

Posted: Sat Sep 29, 2012 2:06 am
by Joe
Hm... I'm looking through the code and I'm trying to figure out if there's "fill the whole screen" because the filtering does seem managed by Snes9x

Re: Want to expirement with graphics filters

Posted: Sat Sep 29, 2012 10:07 am
by OV2
You mean an option that makes the filter get the whole screen as surface? There's nothing like that - each filter specifies the factor of the destination it needs in GetFilterScale, and then gets passed a surface of that size, into which it can then output and mark the area with the rect (e.g. blargg's specifies factor 3, thus gets 768*672 and then fills ~603*512).
S9x then outputs that centered or streched, depending on the users choice.

Re: Want to expirement with graphics filters

Posted: Sat Sep 29, 2012 7:28 pm
by Joe
Ah, yes. Exactly that