I was Triing to get into GDI+ With C# and made one of them HQnX
modifiers like the emulatos use, but making it look like an old TV
its a Simple 1 pixel -> 9 pixel by taking the center pixel as the souce pixel and interpoliting the 8 surrounding ones with the surrounding ones of the orginal pixle, and then i added noise and made the border darker and the sender lighter and the effect is done
blue gradient from 100% opacity at the top to 0% blue to the center - that layer is set to the blendmode "screen". The same with a red one coming from the bottom.
Ok, i implemented the Gradient, took a bit longer, the whole thingy got a bit uncompfy so i recoded it using my one pixelformat that implements all common operators and some blendmodes
got alot shoerter though and i fixed the noiser bug, now the noise looks like from a real television (took the noise from an analog camera screenshot)
the funny thing though is, i was to lazy to implement a gradient and noise generator, because the random from c# sucks arse, so, i made image resources,
noise is tilable and gradient = 1 pixel width and 128 height, and teh interpolator takes alwas the pixel (0,(gradient height/destpic height) * desty)
works pretty well
now i only need the frame, i still have no idea how to make teh round parts procentual to the image but not fucking with the proportion
theres a problem with very dark colors with the screen filter though, i think i have to manipulate the effect like a parable or something like that, so that it looks better on dark colors
edit: added border (that was kinda tricky^^)
this is not a rounded rect as you can see, is was too lazy to learn that, so i made a hyperbel function and uses the corners of the images as start pint, and it got some sorta rounded rect, and i added anti alizing by brut force (you can see in the source) and thats it,
renders suggestions are done ! yay
Update:
im tweaking on this, but still very far from getting realtime
i uploaded the code and exe too, but i wouldnt look at it , at the moment its a mess
i still have perfomence poblems, i tested it with a picture from a tv show and it took 7 seconds to render,
atm my pixel class uses doubles normed from 0 to 1, but i think single would be faster, and the main loop is inefficient, also as the main colorize method
takes a bit thinking until i can add different gradients and borders
EDIT:
ok i got a performence boost about 35% from using unsafe code in a new bitmap class wrapper
so the bitmap doesnt get locket every pixel, i think now it could work realtime on small images but theres still plenty of room for improvement, atm no exe/code yet
desaturation is a value from 0-100 to desaturate your sourceimage
destimage is the imagefilename where you want to save to
Gradient is a custom gradient for the image
and the dotmatrix is a 3x3 image with its base at 128 to manipulate the appearience of the new 3x3 pixel in the scaled image
each parameter needs its left neighboars, means:
when you want to change the gradient, you also have to specifiy the desaturation value and the destination image
otherwise the exe will crash
Replies
got alot shoerter though and i fixed the noiser bug, now the noise looks like from a real television (took the noise from an analog camera screenshot)
the funny thing though is, i was to lazy to implement a gradient and noise generator, because the random from c# sucks arse, so, i made image resources,
noise is tilable and gradient = 1 pixel width and 128 height, and teh interpolator takes alwas the pixel (0,(gradient height/destpic height) * desty)
works pretty well
now i only need the frame, i still have no idea how to make teh round parts procentual to the image but not fucking with the proportion
anyway
heres the result
and ofcourse the updated exe
http://dl.dropbox.com/u/1484680/TV3X_ver2.zip
fiurther recomendations welcome^^
edit: i added source
Looks a lot better man, keep it up!
edit: added border (that was kinda tricky^^)
this is not a rounded rect as you can see, is was too lazy to learn that, so i made a hyperbel function and uses the corners of the images as start pint, and it got some sorta rounded rect, and i added anti alizing by brut force (you can see in the source) and thats it,
renders suggestions are done ! yay
result:
Uploaded with ImageShack.us
http://dl.dropbox.com/u/1484680/TV3X_ver3.zip
im tweaking on this, but still very far from getting realtime
i uploaded the code and exe too, but i wouldnt look at it , at the moment its a mess
and here is the typical teaser pic
from the nfs alike race game engine thread
nice progression btw, some other inspirations I found:
reflections on contrasty or dark colors (maybe use them as a mask for reflections):
image glow or light sources on the borders :
atm my pixel class uses doubles normed from 0 to 1, but i think single would be faster, and the main loop is inefficient, also as the main colorize method
takes a bit thinking until i can add different gradients and borders
EDIT:
ok i got a performence boost about 35% from using unsafe code in a new bitmap class wrapper
so the bitmap doesnt get locket every pixel, i think now it could work realtime on small images but theres still plenty of room for improvement, atm no exe/code yet
i call it final now
supports:
standard mode (drag you file on the exe and it results as already seen)
advanced (comand line) mode
TV3X.EXE <SOURCEIMAGE> ?<DESATURATION> ?<DESTIMAGE> ?<GRADIENT> ?<DOTMATRIX>
desaturation is a value from 0-100 to desaturate your sourceimage
destimage is the imagefilename where you want to save to
Gradient is a custom gradient for the image
and the dotmatrix is a 3x3 image with its base at 128 to manipulate the appearience of the new 3x3 pixel in the scaled image
each parameter needs its left neighboars, means:
when you want to change the gradient, you also have to specifiy the desaturation value and the destination image
otherwise the exe will crash
requires:
dotnet framework 3.5
have fun!
http://dl.dropbox.com/u/1484680/tv3x_final.zip
and here is my working image with custom settings and full desaturation
Uploaded with ImageShack.us