C++ Multimedia Lecture
by Raymond
For Blacksun Research Facility [BSRF]
http://blacksun.box.sk


- Source Code to FLARE.H and documentation can be downloaded in zip format from http://blacksun.box.sk/tutorials/FLARE-1.0.zip

<blitz> led raymon talk
<Pecca-ve> so you learned c++
<Raymond> so i learned alot about the graphical functions in the gdi32.dll
<Raymond> and then i learned C++
<Raymond> one of the most powerfull functions in gdi32 is BitBlt or StrechBlt
<Raymond> most C++ windows prgramers have used it
<ArSeNiC> i wanna learn c++ ray, Any advice fer me?
<pitpat-> keep quiet arsenic
<Raymond> yes, think very structured
<Raymond> =)
<Pecca-ve> read alot
<Pecca-ve> lecture
<blitz> LET RAY TALK THEN QUESTIONS
               -- Lecture seriously begins approx. here --
<Raymond> what BitBlt and stretchblt do
<Raymond> is copy rectangkles of image data to other Device Contexts
*** rek has joined #bsrf
*** ChanServ sets mode: +o rek
<Raymond> this can be the basis for bitmaped image output
*** snider sets mode: +v Raymond
*** rek is now known as rek[away]
<Pecca-ve> then what?
<blitz> ?
<Raymond> while bitblt is considerd a fast function
<pitpat-> what include do we need for BitBlt and stretchblt?
<Raymond> it can become very slow when not used in an acceptable fashion
*** Skulker has joined #bsrf
<Raymond> btiblt and stretchblt can be accesed thru win32 by the windows.h
<Raymond> and should not require and lib inclusion
<ArSeNiC> hey, why aint you nice 2 newbies to your server
<Raymond> now, to get back to the begining on windows and graphics
<ArSeNiC> just cause i dont know c/c++ doesnt mean i dunno unix syntax
<Raymond> windows by nature is slow graphicly
<Raymond> but widnows has many ways to exploit fast image routines
<Raymond> oen feature is the windows DIB object
<Raymond> it stands for Device Indipendant Bitmap
*** rxcv has joined #bsrf
<Raymond> and it simply stores logical image data in ram
<Raymond> not in video memeory
* pitpat- nods
<Raymond> this is a very important feature
<Raymond> becsaue yuo can aquire a pointer to the image data's bytes
*** rxcv Quit (Not enough time connected)
*** DeadKro1 has joined #bsrf
<Raymond> and do extreamly fast image manipultions with that pointer
*** rxcv  has joined #bsrf
<Raymond> this can be as simple as ploting pixels
*** DHamster  has joined #bsrf
<Raymond> or as complex as drawing an overlayed sine wave on an image to produce the effect of water
<devin> Does anyone know the PHP header function to that'll seamlessly change URL's?
<devin> I can't find it.
<pitpat-> shhhh devin
<pitpat-> lecture
<DHamster> hiwo all agian
<Raymond> im now going to ask everyone if they have a certain direction they would like me to go with this lecture
<Raymond> be it game specific
<blitz> please continute ray
<Raymond> or multimedia specific
<pitpat-> multimedia ray
*** DHamster is now known as _Dhamster-
<pitpat-> show us a little coding
<Pecca-ve> game?
<Raymond> is that hunanomous?
<Mtcx> game
<pitpat-> ok game
<Raymond> ok game it is
*** devin has left #bsrf
<Raymond> i will now shwo you a fucntion that i use for extramly fast pixel manipulation
<Raymond> please wait...
* pitpat- holds
<Raymond> ok, sorry for the wait
<Raymond> void __forceinline WritePixel(signed long x,signed long y,FC_Image *lpImage,FS_Color *lpColor)
<Raymond> {
<Raymond>  if(x>-1&&y>-1&&x<lpImage->ImageWidth&&y<lpImage->ImageHeight)
<Raymond>  {
<Raymond>   unsigned char *lpByte=(unsigned char*)&lpImage->lpImagePixels[y*lpImage->ImageWidth+x];
<Raymond>   *lpByte=lpColor->B;
<Raymond>   lpByte++;
<Raymond>   *lpByte=lpColor->G;
<Raymond>   lpByte++;
<Raymond>   *lpByte=lpColor->R;
<Raymond>  }
<Raymond> }
<Raymond> this function writes a single 24 bit color pointer into an existing image
<rek[away]> Raymond: try pvting it to him next time (chan flood...)
<snider> rek
<snider> its a lecture
<pitpat-> it's lecture
<rek[away]> opps
<Raymond> the advantage of using this fucntion over the well known function SetPixel
<Raymond> is that is is extramly fast in comparison
<Raymond> SetPixel does alot of color table matching in the background
<ElfQrin> hehe... luckily rek didn't kicked Raymond as a warning ;)
<Raymond> and simply will not do for graphical manipulation
<Raymond> hehe
<Raymond> the same method can be applied to extract a pixel from an image
<Raymond> void __forceinline ReadPixel(signed long x,signed long y,FC_Image *lpImage,FS_Color *lpColor)
<Raymond> {
<Raymond>  if(x>-1&&y>-1&&x<lpImage->ImageWidth&&y<lpImage->ImageHeight)
<Raymond>  {
<Raymond>   unsigned char *lpByte=(unsigned char*)&lpImage->lpImagePixels[y*lpImage->ImageWidth+x];
<Raymond>   lpColor->B=*lpByte;
<Raymond>   lpByte++;
<Raymond>   lpColor->G=*lpByte;
<Raymond>   lpByte++;
<Raymond>   lpColor->R=*lpByte;
<Raymond>  }
<Raymond> }
<Raymond> note that out-of-bounds checking is done in thsi function
*** DeadKro1 (Fux4r@64.40.167.BOX-3589) Quit (Read error: 113 (No route to host))
<Raymond> makign higher level functions that use this one, not have to haev such a check
<Raymond> one thing that i always hear people saying
<Raymond> is how they want to perform animation on a window
<Raymond> short of using an avi file
<Raymond> you can splice together all of your animation frames
<Raymond> into one bitmap
<pitpat-> :)
<Raymond> load it into an HBITMAP using the LoadImageFunction
<Raymond> and use BitBlt to actualy clip out
<Raymond> and draw
<Raymond> induvidual frames
<Raymond> onto a window's device context
<Raymond> another common question i hear is that they want to draw images that have certain colors extracted
<Raymond> i haev made a routine for this..pleae wait
*** hehe (hehe@BOX-24664.navipath.net) has joined #bsrf
*** hehe is now known as Raymond_2
<pitpat-> ...
<ElfQrin> The lecture's not bad but I need to sleep (3:21am here), if someone would e-mail it to me, I'd appreciate it.
<Raymond_2> sorry about that io lost my connection
<Raymond_2> void ImageTint(FC_Image *lpImage,bool RedOFF,bool GreenOFF,bool BlueOFF)
<Raymond_2> {
<Raymond_2>  unsigned long i=0;
<Raymond_2>  unsigned char *lpPixelByte=(unsigned char*)lpImage->lpImagePixels;
<Raymond_2>  while(i<lpImage->ImageSizePixels)
<Raymond_2>  {
<blitz> its ok
<Raymond_2>   if(BlueOFF)*lpPixelByte=0;
<Raymond_2>   lpPixelByte++;
<Raymond_2>   if(GreenOFF)*lpPixelByte=0;
<Raymond_2>   lpPixelByte++;
<Raymond_2>   if(RedOFF)*lpPixelByte=0;
<Raymond_2>   lpPixelByte++;
*** Skulker is now known as Rimmag
<Raymond_2>   i++;
<Raymond_2>  }
<Raymond_2>  return;
<Raymond_2> }
<Raymond_2> this function allows you to turn off the color channels or an image
<Raymond_2> *of
*** MOOCOWMOO has joined #BSRF
<Raymond_2> the function that i have that is similar to this
<MOOCOWMOO> hrmm....
<Raymond_2> is for alphablending
<pitpat-> nice ray
<MOOCOWMOO> i think i cracked that wargame thing
<Raymond_2> void ImageFade(FC_Image *lpImage,FS_Color *lpColor,unsigned char Alpha)
<Raymond_2> {
<Raymond_2>  unsigned long i=0;
<Raymond_2>  unsigned char *lpByte=(unsigned char*)lpImage->lpImagePixels;
<Raymond_2>  while(i<lpImage->ImageSizePixels)
<Raymond_2>  {
*** Raymond (hehe@BOX-23318.navipath.net) Quit (Ping timeout: 180 seconds)
<MOOCOWMOO> ther's an ftp running on port 21
<Raymond_2>   *lpByte=(Alpha*(lpColor->B-*lpByte)>>8)+*lpByte;
<Raymond_2>   lpByte++;
<Raymond_2>   *lpByte=(Alpha*(lpColor->G-*lpByte)>>8)+*lpByte;
<Raymond_2>   lpByte++;
<MOOCOWMOO> hey
<Raymond_2>   *lpByte=(Alpha*(lpColor->R-*lpByte)>>8)+*lpByte;
<Raymond_2>   lpByte++;
<Raymond_2>   i++;
<MOOCOWMOO> can someone here teach me BNC real quick?
<Raymond_2>  }
<Raymond_2>  return;
<MOOCOWMOO> or how to use it
<Raymond_2> }
<Raymond_2> this will put an overall color shade on an image
<pitpat-> moocow we have a lecture
<Mtcx> yeah, sh
<MOOCOWMOO> ok i b quiet
<Raymond_2> hehe,
*** rek[away]  Quit (Quit: )
<Raymond_2> so, getting back to the story
<Raymond_2> after about two years of research
<ElfQrin> good nite, if someone could remember that please mail this lecture to me when it'll be finished.
<ElfQrin> cya
<Raymond_2> ive finaly come up with a very advanced multimedia and game development engine
<pitpat-> cya elf
<snider> nitey nite
<Raymond_2> it sport's it's own image type called the GMB
*** ElfQrin  has left #bsrf
<Raymond_2> and has the option of RLE compression
<Raymond_2> in some cases, for animation streams
<Raymond_2> compresion can be as high as 12 mb file to 2 mb file
*** Red_Death is now known as Smoking_Death
*** _sangoma-  has joined #bsrf
<Raymond_2> the engine also supports an object framework
<Raymond_2> for creating buttons scrollbars
<Raymond_2> windows
<Raymond_2> and the custom objects that are used in the engine
<Raymond_2> those being..
<Raymond_2> Actor2D
<Raymond_2> Actor3D
<Raymond_2> HotSpot
<Raymond_2> SpotLight
<Raymond_2> and zBuffer object
<Raymond_2> the real power of this lecture is in that i am going to distribute my engine to anyone who wants it
<Raymond_2> free of charge
*** essex Quit ()
<blitz> i want it
<Raymond_2> and to do with whatever you like
<pitpat-> i have it
<pitpat-> hehe
<pitpat-> ;)
<Raymond_2> but, obviously
<Raymond_2> ther is no warently impiled
<blitz> k
<Raymond_2> and you face all conciquences of using it
<pitpat-> yea pay respect to ray if you use it
<blitz> k
<pitpat-> he spent 2 years developing it
<Raymond_2> a comment about me would be nice
<Raymond_2> but not totaly neccisary
<Raymond_2> i simply want the people in the world to have the best tools possible
<NemoH> ray: what's the advantage of doing this vs using something like directx or opengl?
<Raymond_2> the advantage of using my engine over DX or opengl
<Raymond_2> is that the software rendering that it does
<Raymond_2> is faster that the software rendering of directx
<Raymond_2> while it doesn nor support hardware modes
<Raymond_2> *not
<Raymond_2> it also requires no dependency
<Raymond_2> otehr than what win32 already has
*** sheepnus  has joined #bsrf
<blitz> so with those tools I ll have almost everything right?
<Raymond_2> and the functionaly was built very moduarly
<Raymond_2> so you coudl adapt it to directX
<NemoH> ray: well it's definitely tied to win32
<Raymond_2> with the file i am going to distribute
<Raymond_2> definetly
<Raymond_2> if you haev MSVC++ 6.0
<Raymond_2> you can use this engine
<Raymond_2> it may be possible to use it on other compilers
<Raymond_2> but i havent tested it on such
<Raymond_2> the engine has been tested on win95, 98, me and 2k
<NemoH> and do you support all of the operation that directx does or do they need to be implemented
<Raymond_2> i doont suport all of what directx does
<Raymond_2> for instance
<Raymond_2> i dont support a rotation blt
<Raymond_2> or an alphablt
*** Smoking_Death is now known as Red_Death
<Raymond_2> but ther implementation can be very easily worked into the existing class structure
<Raymond_2> sicne bitmaped images are handled in the FC_Image Class
<Raymond_2> and all other functions take a pointer to an FC Image
<Raymond_2> ther is lots of base functionalty
<Raymond_2> and lots of room for expansion
<Raymond_2> the best part of the engine tho
<Raymond_2> and actualy that part that i almost didnt wana give away
<Raymond_2> is that it has a multichannel audio mixer
<Raymond_2> for async wave file play
<pitpat-> :)
<Raymond_2> meaning that you could play up to 200 waves simultaniously
<pitpat-> :)
<pitpat-> yea that's alot
*** Raymond_2 (hehe@BOX-24664.navipath.net) Quit (Read error: 104 (Connection reset by peer))
<pitpat-> oh no
*** Raymond_2  has joined #bsrf
<pitpat-> Raaaaayyyyyy!!!!!!1
<Raymond_2> =)
<pitpat-> lol peer took you away
<snider> hehe
<Raymond_2> so, without futher or do
<Raymond_2> im going to give the source to snider
<Raymond_2> and he will distribute it to those who want it          -- Look near end of file
*** RealStony is now known as Stony
<pitpat-> ray
<blitz> k
<pitpat-> can i put it up on my site?
<pitpat-> people can go and grab it
<Mtcx> pitpat - where's you site
<Raymond_2> you can, but obviously it would be nice if you gave me a bit of credit on the site
<pitpat-> yea
<pitpat-> www.mmm69.com
<pitpat-> nothing yet
<blitz> ya
<Raymond_2> dont pass it off as your own, hve pride=)
<Raymond_2> lol
<pitpat-> don't worry ray
<Raymond_2> i will now take any questions on the engine or the lecture
<blitz> uhm...
<blitz> so this program your talking about it will go faster right?
<Raymond_2> it provies the fastest possible output from the base graphical system of windows
<Raymond_2> that is without using DirectX
<Raymond_2> or any other Library
<blitz> cool
*** Trance has joined #bsrf
*** ArSeNiC  Quit (Quit: )
<Mtcx> so how do we get it?
<Raymond_2> it also supports the playing of avi movies and the like
<Raymond_2> im working with snider right now
<blitz> ok
<Mtcx> ok
<pitpat-> k
*** Temp-nick is now known as AlienDaemon
<snider> i'll send it, if you need it right away. or you can pick it up from the lecture log (tomorrow)
*** XarZ  has joined #bsrf
<Mtcx> where will the lecture log be?
<Raymond_2> im also including the documentation for the engine
<Raymond_2> not it is incomplete
<Raymond_2> *note
<Raymond_2> but it will shed alot of light on the objects
<XarZ> damn....i missed a lecture
<blitz> well I wanna wait for the documentation when can i get it with everything?
<Raymond_2> and also
<Raymond_2> if ther becomes the need
<Raymond_2> and i get alot of intrest
<Raymond_2> let pitpat know about it
<Raymond_2> and he will get back to me
<pitpat-> :)
<Raymond_2> and maybe we can post some code samples of the engiens use on his page
<pitpat-> :)
<XarZ> what engine?
<pitpat-> anything you want ray
<XarZ> gfx?
<XarZ> kewl
<Raymond_2> multimedia engine
<Raymond_2> specialy developed for games
<XarZ> o
<XarZ> kewl
<Raymond_2> but can be used for multimedia
<XarZ> like a dX thing
<Raymond_2> and high quality sound and animations
*** AciBiBeR Quit (Ping timeout: 180 seconds)
<Raymond_2> like dx, but it's standard win32
<Mtcx> so where will the lecture log be tomorrow, where we can download it?
*** MurDoch  has joined #bsrf
<pitpat-> Mtcx ask snider
*** Antid0t  has joined #bsrf
<Pecca-ve> snider?
<blitz> I think he's busy
<XarZ> well....the only thing i hate about dX is that u need the whole SDK to use it correctly...and those are lots of filez...
<snider> yeah i was gonna set up an auto-transfer script but what the hell
<pitpat-> snider are you gonna put it up on the site?
<snider> yes, but i don
<snider> err
<snider> don't have access, so mikkkeee will have to get it first
*** _Dhamster-  Quit (Quit: Leaving)
<Pecca-ve> bsrf´s site?
*** Antid0t  Quit (Not enough time connected)
<snider> blacksun.box.sk  yes
*** MurDoch  has left #bsrf
<Pecca-ve> k
<blitz> where's mikkkeee
*** Jesteruk  has joined #bsrf
<pitpat-> ray thanx for the lecture
<pitpat-> :)

---End of  Lecture--