?? cpplecture.html
字號(hào):
<HTML>
<HEAD>
<TITLE>The C++ Multimedia Lecture</TITLE>
</HEAD>
<BODY>
<br>
<CENTER>
<HR SIZE=1 NOSHADE WIDTH="45%">
C++ Multimedia Lecture<br>
by Raymond<br>
For <A HREF="http://blacksun.box.sk">Blacksun Research Facility
[BSRF]</A><br>
<A HREF="http://blacksun.box.sk">http://blacksun.box.sk</A><br>
<HR SIZE=1 NOSHADE WIDTH="56%"></CENTER><br>
<P>- Source Code to FLARE.H and documentation can be downloaded in zip
format from <A HREF="http://blacksun.box.sk/tutorials/FLARE-1.0.zip">http://blacksun.box.sk/tutorials/FLARE-1.0.zip</A>
<P><blitz> led raymon talk
<BR><Pecca-ve> so you learned c++
<BR><Raymond> so i learned alot about the graphical functions in the
gdi32.dll
<BR><Raymond> and then i learned C++
<BR><Raymond> one of the most powerfull functions in gdi32 is BitBlt
or StrechBlt
<BR><Raymond> most C++ windows prgramers have used it
<BR><ArSeNiC> i wanna learn c++ ray, Any advice fer me?
<BR><pitpat-> keep quiet arsenic
<BR><Raymond> yes, think very structured
<BR><Raymond> =)
<BR><Pecca-ve> read alot
<BR><Pecca-ve> lecture
<BR><blitz> LET RAY TALK THEN QUESTIONS
<BR>
-- Lecture seriously begins approx. here --
<BR><Raymond> what BitBlt and stretchblt do
<BR><Raymond> is copy rectangkles of image data to other Device Contexts
<BR>*** rek has joined #bsrf
<BR>*** ChanServ sets mode: +o rek
<BR><Raymond> this can be the basis for bitmaped image output
<BR>*** snider sets mode: +v Raymond
<BR>*** rek is now known as rek[away]
<BR><Pecca-ve> then what?
<BR><blitz> ?
<BR><Raymond> while bitblt is considerd a fast function
<BR><pitpat-> what include do we need for BitBlt and stretchblt?
<BR><Raymond> it can become very slow when not used in an acceptable
fashion
<BR>*** Skulker has joined #bsrf
<BR><Raymond> btiblt and stretchblt can be accesed thru win32 by the
windows.h
<BR><Raymond> and should not require and lib inclusion
<BR><ArSeNiC> hey, why aint you nice 2 newbies to your server
<BR><Raymond> now, to get back to the begining on windows and graphics
<BR><ArSeNiC> just cause i dont know c/c++ doesnt mean i dunno unix
syntax
<BR><Raymond> windows by nature is slow graphicly
<BR><Raymond> but widnows has many ways to exploit fast image routines
<BR><Raymond> oen feature is the windows DIB object
<BR><Raymond> it stands for Device Indipendant Bitmap
<BR>*** rxcv has joined #bsrf
<BR><Raymond> and it simply stores logical image data in ram
<BR><Raymond> not in video memeory
<BR>* pitpat- nods
<BR><Raymond> this is a very important feature
<BR><Raymond> becsaue yuo can aquire a pointer to the image data's bytes
<BR>*** rxcv Quit (Not enough time connected)
<BR>*** DeadKro1 has joined #bsrf
<BR><Raymond> and do extreamly fast image manipultions with that pointer
<BR>*** rxcv has joined #bsrf
<BR><Raymond> this can be as simple as ploting pixels
<BR>*** DHamster has joined #bsrf
<BR><Raymond> or as complex as drawing an overlayed sine wave on an
image to produce the effect of water
<BR><devin> Does anyone know the PHP header function to that'll seamlessly
change URL's?
<BR><devin> I can't find it.
<BR><pitpat-> shhhh devin
<BR><pitpat-> lecture
<BR><DHamster> hiwo all agian
<BR><Raymond> im now going to ask everyone if they have a certain direction
they would like me to go with this lecture
<BR><Raymond> be it game specific
<BR><blitz> please continute ray
<BR><Raymond> or multimedia specific
<BR><pitpat-> multimedia ray
<BR>*** DHamster is now known as _Dhamster-
<BR><pitpat-> show us a little coding
<BR><Pecca-ve> game?
<BR><Raymond> is that hunanomous?
<BR><Mtcx> game
<BR><pitpat-> ok game
<BR><Raymond> ok game it is
<BR>*** devin has left #bsrf
<BR><Raymond> i will now shwo you a fucntion that i use for extramly
fast pixel manipulation
<BR><Raymond> please wait...
<BR>* pitpat- holds
<BR><Raymond> ok, sorry for the wait
<BR><Raymond> void __forceinline WritePixel(signed long x,signed long
y,FC_Image *lpImage,FS_Color *lpColor)
<BR><Raymond> {
<BR><Raymond> if(x>-1&&y>-1&&x<lpImage->ImageWidth&&y<lpImage->ImageHeight)
<BR><Raymond> {
<BR><Raymond> unsigned char *lpByte=(unsigned char*)&lpImage->lpImagePixels[y*lpImage->ImageWidth+x];
<BR><Raymond> *lpByte=lpColor->B;
<BR><Raymond> lpByte++;
<BR><Raymond> *lpByte=lpColor->G;
<BR><Raymond> lpByte++;
<BR><Raymond> *lpByte=lpColor->R;
<BR><Raymond> }
<BR><Raymond> }
<BR><Raymond> this function writes a single 24 bit color pointer into
an existing image
<BR><rek[away]> Raymond: try pvting it to him next time (chan flood...)
<BR><snider> rek
<BR><snider> its a lecture
<BR><pitpat-> it's lecture
<BR><rek[away]> opps
<BR><Raymond> the advantage of using this fucntion over the well known
function SetPixel
<BR><Raymond> is that is is extramly fast in comparison
<BR><Raymond> SetPixel does alot of color table matching in the background
<BR><ElfQrin> hehe... luckily rek didn't kicked Raymond as a warning
;)
<BR><Raymond> and simply will not do for graphical manipulation
<BR><Raymond> hehe
<BR><Raymond> the same method can be applied to extract a pixel from
an image
<BR><Raymond> void __forceinline ReadPixel(signed long x,signed long
y,FC_Image *lpImage,FS_Color *lpColor)
<BR><Raymond> {
<BR><Raymond> if(x>-1&&y>-1&&x<lpImage->ImageWidth&&y<lpImage->ImageHeight)
<BR><Raymond> {
<BR><Raymond> unsigned char *lpByte=(unsigned char*)&lpImage->lpImagePixels[y*lpImage->ImageWidth+x];
<BR><Raymond> lpColor->B=*lpByte;
<BR><Raymond> lpByte++;
<BR><Raymond> lpColor->G=*lpByte;
<BR><Raymond> lpByte++;
<BR><Raymond> lpColor->R=*lpByte;
<BR><Raymond> }
<BR><Raymond> }
<BR><Raymond> note that out-of-bounds checking is done in thsi function
<BR>*** DeadKro1 (Fux4r@64.40.167.BOX-3589) Quit (Read error: 113 (No route
to host))
<BR><Raymond> makign higher level functions that use this one, not have
to haev such a check
<BR><Raymond> one thing that i always hear people saying
<BR><Raymond> is how they want to perform animation on a window
<BR><Raymond> short of using an avi file
<BR><Raymond> you can splice together all of your animation frames
<BR><Raymond> into one bitmap
<BR><pitpat-> :)
<BR><Raymond> load it into an HBITMAP using the LoadImageFunction
<BR><Raymond> and use BitBlt to actualy clip out
<BR><Raymond> and draw
<BR><Raymond> induvidual frames
<BR><Raymond> onto a window's device context
<BR><Raymond> another common question i hear is that they want to draw
images that have certain colors extracted
<BR><Raymond> i haev made a routine for this..pleae wait
<BR>*** hehe (hehe@BOX-24664.navipath.net) has joined #bsrf
<BR>*** hehe is now known as Raymond_2
<BR><pitpat-> ...
<BR><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.
<BR><Raymond_2> sorry about that io lost my connection
<BR><Raymond_2> void ImageTint(FC_Image *lpImage,bool RedOFF,bool GreenOFF,bool
BlueOFF)
<BR><Raymond_2> {
<BR><Raymond_2> unsigned long i=0;
<BR><Raymond_2> unsigned char *lpPixelByte=(unsigned char*)lpImage->lpImagePixels;
<BR><Raymond_2> while(i<lpImage->ImageSizePixels)
<BR><Raymond_2> {
<BR><blitz> its ok
<BR><Raymond_2> if(BlueOFF)*lpPixelByte=0;
<BR><Raymond_2> lpPixelByte++;
<BR><Raymond_2> if(GreenOFF)*lpPixelByte=0;
<BR><Raymond_2> lpPixelByte++;
<BR><Raymond_2> if(RedOFF)*lpPixelByte=0;
<BR><Raymond_2> lpPixelByte++;
<BR>*** Skulker is now known as Rimmag
<BR><Raymond_2> i++;
<BR><Raymond_2> }
<BR><Raymond_2> return;
<BR><Raymond_2> }
<BR><Raymond_2> this function allows you to turn off the color channels
or an image
<BR><Raymond_2> *of
<BR>*** MOOCOWMOO has joined #BSRF
<BR><Raymond_2> the function that i have that is similar to this
<BR><MOOCOWMOO> hrmm....
<BR><Raymond_2> is for alphablending
<BR><pitpat-> nice ray
<BR><MOOCOWMOO> i think i cracked that wargame thing
<BR><Raymond_2> void ImageFade(FC_Image *lpImage,FS_Color *lpColor,unsigned
char Alpha)
<BR><Raymond_2> {
<BR><Raymond_2> unsigned long i=0;
<BR><Raymond_2> unsigned char *lpByte=(unsigned char*)lpImage->lpImagePixels;
<BR><Raymond_2> while(i<lpImage->ImageSizePixels)
<BR><Raymond_2> {
<BR>*** Raymond (hehe@BOX-23318.navipath.net) Quit (Ping timeout: 180 seconds)
<BR><MOOCOWMOO> ther's an ftp running on port 21
<BR><Raymond_2> *lpByte=(Alpha*(lpColor->B-*lpByte)>>8)+*lpByte;
<BR><Raymond_2> lpByte++;
<BR><Raymond_2> *lpByte=(Alpha*(lpColor->G-*lpByte)>>8)+*lpByte;
<BR><Raymond_2> lpByte++;
<BR><MOOCOWMOO> hey
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -