⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpplecture.html

📁 1000 HOWTOs for various needs [WINDOWS]
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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>&lt;blitz> led raymon talk

<BR>&lt;Pecca-ve> so you learned c++

<BR>&lt;Raymond> so i learned alot about the graphical functions in the

gdi32.dll

<BR>&lt;Raymond> and then i learned C++

<BR>&lt;Raymond> one of the most powerfull functions in gdi32 is BitBlt

or StrechBlt

<BR>&lt;Raymond> most C++ windows prgramers have used it

<BR>&lt;ArSeNiC> i wanna learn c++ ray, Any advice fer me?

<BR>&lt;pitpat-> keep quiet arsenic

<BR>&lt;Raymond> yes, think very structured

<BR>&lt;Raymond> =)

<BR>&lt;Pecca-ve> read alot

<BR>&lt;Pecca-ve> lecture

<BR>&lt;blitz> LET RAY TALK THEN QUESTIONS

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

-- Lecture seriously begins approx. here --

<BR>&lt;Raymond> what BitBlt and stretchblt do

<BR>&lt;Raymond> is copy rectangkles of image data to other Device Contexts

<BR>*** rek has joined #bsrf

<BR>*** ChanServ sets mode: +o rek

<BR>&lt;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>&lt;Pecca-ve> then what?

<BR>&lt;blitz> ?

<BR>&lt;Raymond> while bitblt is considerd a fast function

<BR>&lt;pitpat-> what include do we need for BitBlt and stretchblt?

<BR>&lt;Raymond> it can become very slow when not used in an acceptable

fashion

<BR>*** Skulker has joined #bsrf

<BR>&lt;Raymond> btiblt and stretchblt can be accesed thru win32 by the

windows.h

<BR>&lt;Raymond> and should not require and lib inclusion

<BR>&lt;ArSeNiC> hey, why aint you nice 2 newbies to your server

<BR>&lt;Raymond> now, to get back to the begining on windows and graphics

<BR>&lt;ArSeNiC> just cause i dont know c/c++ doesnt mean i dunno unix

syntax

<BR>&lt;Raymond> windows by nature is slow graphicly

<BR>&lt;Raymond> but widnows has many ways to exploit fast image routines

<BR>&lt;Raymond> oen feature is the windows DIB object

<BR>&lt;Raymond> it stands for Device Indipendant Bitmap

<BR>*** rxcv has joined #bsrf

<BR>&lt;Raymond> and it simply stores logical image data in ram

<BR>&lt;Raymond> not in video memeory

<BR>* pitpat- nods

<BR>&lt;Raymond> this is a very important feature

<BR>&lt;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>&lt;Raymond> and do extreamly fast image manipultions with that pointer

<BR>*** rxcv&nbsp; has joined #bsrf

<BR>&lt;Raymond> this can be as simple as ploting pixels

<BR>*** DHamster&nbsp; has joined #bsrf

<BR>&lt;Raymond> or as complex as drawing an overlayed sine wave on an

image to produce the effect of water

<BR>&lt;devin> Does anyone know the PHP header function to that'll seamlessly

change URL's?

<BR>&lt;devin> I can't find it.

<BR>&lt;pitpat-> shhhh devin

<BR>&lt;pitpat-> lecture

<BR>&lt;DHamster> hiwo all agian

<BR>&lt;Raymond> im now going to ask everyone if they have a certain direction

they would like me to go with this lecture

<BR>&lt;Raymond> be it game specific

<BR>&lt;blitz> please continute ray

<BR>&lt;Raymond> or multimedia specific

<BR>&lt;pitpat-> multimedia ray

<BR>*** DHamster is now known as _Dhamster-

<BR>&lt;pitpat-> show us a little coding

<BR>&lt;Pecca-ve> game?

<BR>&lt;Raymond> is that hunanomous?

<BR>&lt;Mtcx> game

<BR>&lt;pitpat-> ok game

<BR>&lt;Raymond> ok game it is

<BR>*** devin has left #bsrf

<BR>&lt;Raymond> i will now shwo you a fucntion that i use for extramly

fast pixel manipulation

<BR>&lt;Raymond> please wait...

<BR>* pitpat- holds

<BR>&lt;Raymond> ok, sorry for the wait

<BR>&lt;Raymond> void __forceinline WritePixel(signed long x,signed long

y,FC_Image *lpImage,FS_Color *lpColor)

<BR>&lt;Raymond> {

<BR>&lt;Raymond>&nbsp; if(x>-1&amp;&amp;y>-1&amp;&amp;x&lt;lpImage->ImageWidth&amp;&amp;y&lt;lpImage->ImageHeight)

<BR>&lt;Raymond>&nbsp; {

<BR>&lt;Raymond>&nbsp;&nbsp; unsigned char *lpByte=(unsigned char*)&amp;lpImage->lpImagePixels[y*lpImage->ImageWidth+x];

<BR>&lt;Raymond>&nbsp;&nbsp; *lpByte=lpColor->B;

<BR>&lt;Raymond>&nbsp;&nbsp; lpByte++;

<BR>&lt;Raymond>&nbsp;&nbsp; *lpByte=lpColor->G;

<BR>&lt;Raymond>&nbsp;&nbsp; lpByte++;

<BR>&lt;Raymond>&nbsp;&nbsp; *lpByte=lpColor->R;

<BR>&lt;Raymond>&nbsp; }

<BR>&lt;Raymond> }

<BR>&lt;Raymond> this function writes a single 24 bit color pointer into

an existing image

<BR>&lt;rek[away]> Raymond: try pvting it to him next time (chan flood...)

<BR>&lt;snider> rek

<BR>&lt;snider> its a lecture

<BR>&lt;pitpat-> it's lecture

<BR>&lt;rek[away]> opps

<BR>&lt;Raymond> the advantage of using this fucntion over the well known

function SetPixel

<BR>&lt;Raymond> is that is is extramly fast in comparison

<BR>&lt;Raymond> SetPixel does alot of color table matching in the background

<BR>&lt;ElfQrin> hehe... luckily rek didn't kicked Raymond as a warning

;)

<BR>&lt;Raymond> and simply will not do for graphical manipulation

<BR>&lt;Raymond> hehe

<BR>&lt;Raymond> the same method can be applied to extract a pixel from

an image

<BR>&lt;Raymond> void __forceinline ReadPixel(signed long x,signed long

y,FC_Image *lpImage,FS_Color *lpColor)

<BR>&lt;Raymond> {

<BR>&lt;Raymond>&nbsp; if(x>-1&amp;&amp;y>-1&amp;&amp;x&lt;lpImage->ImageWidth&amp;&amp;y&lt;lpImage->ImageHeight)

<BR>&lt;Raymond>&nbsp; {

<BR>&lt;Raymond>&nbsp;&nbsp; unsigned char *lpByte=(unsigned char*)&amp;lpImage->lpImagePixels[y*lpImage->ImageWidth+x];

<BR>&lt;Raymond>&nbsp;&nbsp; lpColor->B=*lpByte;

<BR>&lt;Raymond>&nbsp;&nbsp; lpByte++;

<BR>&lt;Raymond>&nbsp;&nbsp; lpColor->G=*lpByte;

<BR>&lt;Raymond>&nbsp;&nbsp; lpByte++;

<BR>&lt;Raymond>&nbsp;&nbsp; lpColor->R=*lpByte;

<BR>&lt;Raymond>&nbsp; }

<BR>&lt;Raymond> }

<BR>&lt;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>&lt;Raymond> makign higher level functions that use this one, not have

to haev such a check

<BR>&lt;Raymond> one thing that i always hear people saying

<BR>&lt;Raymond> is how they want to perform animation on a window

<BR>&lt;Raymond> short of using an avi file

<BR>&lt;Raymond> you can splice together all of your animation frames

<BR>&lt;Raymond> into one bitmap

<BR>&lt;pitpat-> :)

<BR>&lt;Raymond> load it into an HBITMAP using the LoadImageFunction

<BR>&lt;Raymond> and use BitBlt to actualy clip out

<BR>&lt;Raymond> and draw

<BR>&lt;Raymond> induvidual frames

<BR>&lt;Raymond> onto a window's device context

<BR>&lt;Raymond> another common question i hear is that they want to draw

images that have certain colors extracted

<BR>&lt;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>&lt;pitpat-> ...

<BR>&lt;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>&lt;Raymond_2> sorry about that io lost my connection

<BR>&lt;Raymond_2> void ImageTint(FC_Image *lpImage,bool RedOFF,bool GreenOFF,bool

BlueOFF)

<BR>&lt;Raymond_2> {

<BR>&lt;Raymond_2>&nbsp; unsigned long i=0;

<BR>&lt;Raymond_2>&nbsp; unsigned char *lpPixelByte=(unsigned char*)lpImage->lpImagePixels;

<BR>&lt;Raymond_2>&nbsp; while(i&lt;lpImage->ImageSizePixels)

<BR>&lt;Raymond_2>&nbsp; {

<BR>&lt;blitz> its ok

<BR>&lt;Raymond_2>&nbsp;&nbsp; if(BlueOFF)*lpPixelByte=0;

<BR>&lt;Raymond_2>&nbsp;&nbsp; lpPixelByte++;

<BR>&lt;Raymond_2>&nbsp;&nbsp; if(GreenOFF)*lpPixelByte=0;

<BR>&lt;Raymond_2>&nbsp;&nbsp; lpPixelByte++;

<BR>&lt;Raymond_2>&nbsp;&nbsp; if(RedOFF)*lpPixelByte=0;

<BR>&lt;Raymond_2>&nbsp;&nbsp; lpPixelByte++;

<BR>*** Skulker is now known as Rimmag

<BR>&lt;Raymond_2>&nbsp;&nbsp; i++;

<BR>&lt;Raymond_2>&nbsp; }

<BR>&lt;Raymond_2>&nbsp; return;

<BR>&lt;Raymond_2> }

<BR>&lt;Raymond_2> this function allows you to turn off the color channels

or an image

<BR>&lt;Raymond_2> *of

<BR>*** MOOCOWMOO has joined #BSRF

<BR>&lt;Raymond_2> the function that i have that is similar to this

<BR>&lt;MOOCOWMOO> hrmm....

<BR>&lt;Raymond_2> is for alphablending

<BR>&lt;pitpat-> nice ray

<BR>&lt;MOOCOWMOO> i think i cracked that wargame thing

<BR>&lt;Raymond_2> void ImageFade(FC_Image *lpImage,FS_Color *lpColor,unsigned

char Alpha)

<BR>&lt;Raymond_2> {

<BR>&lt;Raymond_2>&nbsp; unsigned long i=0;

<BR>&lt;Raymond_2>&nbsp; unsigned char *lpByte=(unsigned char*)lpImage->lpImagePixels;

<BR>&lt;Raymond_2>&nbsp; while(i&lt;lpImage->ImageSizePixels)

<BR>&lt;Raymond_2>&nbsp; {

<BR>*** Raymond (hehe@BOX-23318.navipath.net) Quit (Ping timeout: 180 seconds)

<BR>&lt;MOOCOWMOO> ther's an ftp running on port 21

<BR>&lt;Raymond_2>&nbsp;&nbsp; *lpByte=(Alpha*(lpColor->B-*lpByte)>>8)+*lpByte;

<BR>&lt;Raymond_2>&nbsp;&nbsp; lpByte++;

<BR>&lt;Raymond_2>&nbsp;&nbsp; *lpByte=(Alpha*(lpColor->G-*lpByte)>>8)+*lpByte;

<BR>&lt;Raymond_2>&nbsp;&nbsp; lpByte++;

<BR>&lt;MOOCOWMOO> hey

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -