pax_global_header00006660000000000000000000000064122550665710014523gustar00rootroot0000000000000052 comment=0c2084f4cdd3a2a2d49c4b83b397667ade00ad72 sdlgfx-2.0.25/000077500000000000000000000000001225506657100131005ustar00rootroot00000000000000sdlgfx-2.0.25/AUTHORS000066400000000000000000000000541225506657100141470ustar00rootroot00000000000000Andreas Schiffler sdlgfx-2.0.25/COPYING000066400000000000000000000000521225506657100141300ustar00rootroot00000000000000(C) A. Schiffler, ZLIB - see file LICENSE sdlgfx-2.0.25/ChangeLog000066400000000000000000000312071225506657100146550ustar00rootroot00000000000000CHANGES/VERSION =============== Ver 2.0.25 - Sun, Oct 27, 2013 3:08:15 PM * Added patch for 32- and 64-bit GCC-compiled MMX support (contributed by Sylvain Beucler, backported from SDL2_gfx) * Fixed bug in _aaline when x1>x2 and dy==0 (found by Yannick Guesnet - thanks!) * Updated documentation. * Fixed header in SDL_gfxBlitFunc.h (reported by Jaders77 on sourceforge - thanks!) Ver 2.0.24 - Sun, Jul 22, 2012 9:27:29 AM * Removed some missed LGPL references * Fixed thick line swap bug (patch contributed by Thien-Thi) and added accuracy test for thick line * Improved interface to SDL_framerateDelay (idea contributed by Neil) * Fixed dramerate modules dependency on SDL_GetTicks returning a value >0 (issue report contributed by Douglas) * Fixed 32bpp blending function for BGRA (thanks for the test code and contributing a fix sabbetts/Jay) * Updated VS2010 solution file to use SDL-1.2 sources * Fix for pixel blend routine (patch contributes by Mitjia) Ver 2.0.23 - Sat Dec 3 22:55:04 PST 2011 * Updated sources to resolve some splint (static code analysis) issues * Updates for OpenSDK (WinCE6/ARM) build target (patch contributed itsnotabigtruck) * Added OSX Xcode3+ template files to Other Builds collection (contributed by Vasyl) * Added various fixes and improvements contributed by folks on sourceforge (thanks contributors). * Switched library and test code to zlib license. Ver 2.0.22 - Sat Sep 11 23:26:42 EDT 2010 * Fixed line width calculation for normal and textured polygons (patch contributed by Daniel (SupSuper) * Fixed version setup in configure.in * Added rounded rectangle and rounded box primitives * Updated test program for roundedbox + left/right-click support * Fixed pie calculation (line-case detection, end-angle clipping) * Updated DLL_EXPORT handling and added WIN64 test (patch contributed by tigerfishdaisy) * Added thick line primitive based on Murphy's algorithm Ver 2.0.21 - Thu May 27 21:14:37 PDT 2010 * Add VC9 project files, source code formatting, fix compiler warnings, move VC8 project files, remove leftover autoconf/m4 files * Move static transfer lookup array from .h to .c (patch contributed by Zbigniew Holdys) * Add support for VC++ compiler/MASM assembly with active USE_MMX (contributed by Markus Hossner) * Added Haiku build support in configure.in (contributed by Scott McCreary) * Added helper function that multiplies the alpha channel in a 32bit surface (contributed by Zbigniew Holdys) * Disable MMX for 64bit platforms due to lack of support for pusha/popa (contributed by Olivier Boudeville) * Update all library functions for doxygen markup. Add doxygen configuration file. * Added font rotation support and updated TestFonts sample * Fixed rotate90 for 0 degree case (contributed by Chris Allport) * Updated TestRotozoom with rotate90 case and message display * Added support for SDL 1.3 * Added doxygen generated documentation. Ver 2.0.20 - Wed Sep 23 18:42:02 PDT 2009 * Fix for 1-pixel postponement with 8bit scaling * Updates to headers and configure to allow for cross-compiling to DLL (not just static .a) and fixes for compiling on Windows using autotools * Added Visual CE Project to Other Builds * Added Symbian and Windows 64bit fix for lrint function. Ver 2.0.19 - Mon Apr 20 22:56:59 PDT 2009 * gcc43 compiler patch for asm code in image filters as per http://bugs.gentoo.org/219621 (Peter Alfredsen) * off-by-one hline patch for 1byte indexed surfaces (Manuel Lausch) * update acinclude.m4 from SDL-1.2 and moved # serial in file * applied patch to add pkg-config support for SDL_gfx (Luca Bigliardi) * changed configure.in INTERFACE_AGE and BINARY_AGE based on Debian build feedback (Barry deFreese) * fixed zoom XY-flip code and made it available for all modes in zoom and rotations * fixed edge issue on interpolated rotozoom modes * updated TestRotozoom custom test mode, added delay parameter, added tests which include flipping, included negative rotation * update libtool files * updated Makefile.mingw (Jan Leike) Ver 2.0.18 - Sun Dec 21 08:38:20 PST 2008 * libtool update for dependencies * MSVC C89 variable hoisting to enable MSVC compile (sweetlilmre) * addition of VC9 (Visual Studio 2008) project file (sweetlilmre) * update to MinGW make file (Sergio Padrino, sweetlilmre) * fix uninitialised variables in _putPixelAlpha() (Paul Pedriana) * reverted to original alpha routine in _putPixelAlpha() as new one was causing issues in 16bbp new routine #define has been renamed to EXPERIMENTAL_ALPHA_PIXEL_ROUTINE original is now DEFAULT_ALPHA_PIXEL_ROUTINE * added colorkey handling patch to rotozoom (Sergio Padrino) * downgraded optimization to -O for asm compatibility with gcc4 Ver 2.0.17 - Sun Jun 1 15:39:38 EDT 2008 * hline/vline clipping and swap-logic fixed * clipping box dimension check added and clipping-checks optimized * TestFonts program updated * Updated documentation on cross-compilation, AMD64 * Fixed circleColor overdraw * Added arcColor routine * Added polygonColorMT and polygonTextureMT routines * Updated 32bit alpha blending routine Ver 2.0.16 - Mon Feb 5 19:03:31 AST 2007 * updated config.sub to newer version * added custom RGBA blitter function that sets/maintains target alpha * added setAlpha function that sets alpha values in 32bit surfaces * added TextGfxBlit testprogram for new functions * Fixed C++ type in .h files (thanks Olivier) * Update some text in README and .spec file * Removed broken Uint filter routines from test program * "Cosmetic" changes to test programs and Automake.am Ver 2.0.15 - Fri Dec 22 08:44:31 AST 2006 * bugfixes in 32bit _putPixelAlpha/filledRectAlpha (thanks CISC) * various bugfixes in return value generation and return (thanks CISC) * lock font-surface before using it (thanks CISC) * fix some breakage in non-MMX filter routines (thanks CISC) * fix typo in TestABGR (thanks CISC) * fix double buffer flipping in Tets programs (thanks CISC) * fixed microversion in .h * fixed texturePolygon inverted bug * fixed wrong surface use in test 21 of TestRotozoom * added pitch handling in font surface (thanks CISC) Ver 2.0.14 - Tue Dec 19 08:49:02 AST 2006 * added texturedPolygon routine to library (thanks Jees) * changed iterator condition in aaellipse to add some overdraw to smooth circle * added ShrinkImage routine to rotozoom code * added TestABGR Test program (bug in SDL_gfx or SDL??) * improved TestImageFilter program (bug in Uint filters) * changed .so versioning from .so.13.0.0 to .so.0.0.14 (best is to remove all old libs before installing) * added updated MacOSX ProjectBuilder file (thanks Brian) * added info on MacOSX 10.3 build * added mingw (on cygwin) makefile (thanks Brian) * added Dev-Cpp makefile (thanks Sebastian) * removed some unused variables from gfx and rotozoom code (thanks Thi) * fixed a non-critical typecast mistake (thanks Thi) * converted all C++ comments to C comments in SDL_imageFilter Ver 2.0.13 - Tue Dec 21 08:41:25 EST 2004 * changed include back to "SDL.h" * compile fixes for OSX fink (thanks (Michael) * compile fixes for gcc3.4 (thanks Dries) * support vertical and horizontal flipping of axis in new rotozoomSurfaceXY function (thanks Victor) * updated TestRotozoom program Ver 2.0.12 - Mon Aug 30 09:04:11 EDT 2004 * piecolor naming fix * primitive API change to 'filledPie' * introduction of some const variables Ver 2.0.11 - Thu May 13 09:42:34 EDT 2004 * added pieRGBA/pieColor primitive (non filled pie) * added QNX6 build patch * use $(includedir)/SDL to automake setup * updated README * added 2x2 box & pie tests * added dynamic font setup routine * added sample font files to the Fonts directory * added font test program * string routines changed to use const char * fixed TestRotozoom clear color bug Ver 2.0.10 - Thu Dec 11 09:40:08 EST 2003 * Updated "missing" script to newer version to avoid build errors * Fixed filled polygon int32 overflow error in calculation * Updated RPM spec file for new website path * Added micro version number to .h file Ver 2.0.9 - Mon Oct 27 10:03:18 EST 2003 * Fixed "filled-box width too small by 1 bug" for A=255 * Wrong versioning in .h file Ver 2.0.8 - Wed Jul 16 16:18:13 EDT 2003 * Modified filledPolygon drawing (The edges of a filled polygon and a polyline were reported to not intersect correctly. With this fix, the edges do still do not intersect 100% due to the difference in the algorithms. But now a polygon will never draw outside of the area enclosed by a polyline.) Ver 2.0.7 - Sun Jun 8 08:17:38 EDT 2003 * Added MacOS X Project Builder code * changed SDL include to * Added bezier curve Ver 2.0.6 - Sat May 25 15:12:17 EDT 2002 * Fixed clipping code for most primitives * Added clipping code for character * Added VC7 project file Ver 2.0.5 - n/a * Removed some unused code Ver 2.0.4 - Sat Feb 9 22:09:45 EST 2002 * Fixed rectangle drawing bug on edges for A<255 * Added trigons (triangles) as wrapper calls to polygon. Ver 2.0.3 - Sat Jan 26 10:06:16 EST 2002 * Zipped VisualC directory to avoid EOL problems. * Fixed aalineColor call (y2 parameter was y1). * Fixed rotozoom bug that caused black or undefined pixels on edges. Ver 2.0.2 - Sat Jan 19 21:41:28 EST 2002 * Removed dependency from GL libraries during compile. * Added VisualC makefile. Ver 2.0.1 - Sat Jan 5 22:08:17 EST 2002 * New better quality aacircle/aaellipse code * Better locking optimization for a 4-8% speed improvement on some primitives (line, aaline, circle, ellipse) Ver 2.0 - Sat Dec 29 16:27:57 EST 2001 * Initial release of SDL_gfx based on SDL_gfxPrimitives and SDL_rotozoom code. * Added framerate code and testprogram. * Added imageFilters code and testprogram. * New distribution: source code, README, configure system etc. Previous versions ================= SDL_gfxPrimitives: ------------------ Ver 1.5 - Mon Jul 2 11:27:40 EDT 2001 * New alpha blending code for factor 4 speedups if a<255 on all functions. * Modified include file for W32 DLL support. * Added VC6 project files for DLL and static library building. * Added simple AA-circle/-ellipse routine - quality needs improvement. * Removed 32bit shift on 64bit number from aaline for better portability across platforms. * Removed a couple more compiler warnings (i.e. purely cosmetic fix). Ver 1.4 - Sun Jun 3 11:52:07 EDT 2001 * Fixed hline, vline and rectangle clipping and result codes. * Fixed AA-line arithmetic (was alpha subtraction, should be alpha ratio). * More caching on fonts for speedups. * More pointer checks in several places. * New special cases for ellipses for rx=0/ry=0. * Same sanity checks for circles/ellipses. * Same return code for polygon/filledpolygon. Ver 1.3 - Thu May 31 12:41:35 EDT 2001 * Minor cleanups and fixes (gcc -Wall is your friend). Ver 1.2 again - Thu Apr 5 07:50:57 EDT 2001 * Fixed lineRGBA and aalineRGBA calls (had coordinate-passing mixed up twice, thanks Lion for pointing this out) Ver 1.2 - Wed Apr 4 08:32:42 EDT 2001 * Changed to a dual, you-have-the-choice(TM) licencing system to accomodate GPL developments using SDL_gfxPrimitives. * Some minor fixes (thanks Karl). * All routines return proper result code now. * Clipping for aaline, circle and ellipse. Ver 1.1 - Thu Mar 22 15:28:27 EST 2001 * Added code for Alpha=255 pixel drawing through direct memory writes to all routines resulting in a much faster performance (factor 5 to 20) for non transparent pixels. * New test and benchmark program with better info and nicer look. * More info in README. Proper licence file. Comment cleanup. Ver 1.0 - Fri Mar 16 08:38:07 EST 2001 * Initial release SDL_rotozoom: ------------- Ver 1.6 - Mon Nov 19 21:19:26 EST 2001 * Added interpolation to alpha channel (simplifies code) * Ran the sourcecode through 'indent' for better readability Ver 1.5 - Sat Jul 7 13:02:07 EDT 2001 * Added project files (VisualC.zip) and modifications for VC project building. * Fixed old versioning in configure.in file. * Fixed LICENSE file and LGPL source reference. Ver 1.4 - Mon Jun 4 12:15:31 EDT 2001 * Removed SDL_SoftStretch call again in favour of an internal zoom routine. * Added new zoomSurface() function with seperate X and Y zoom factors. Ver 1.3 - Thu May 31 08:37:36 EDT 2001 * Modified code to handle RGBA or ABGR source surfaces transparently. * More error checking, source surface locking. * Slighly expanded test program with event handling. Ver 1.2 - Wed May 30 18:18:05 EDT 2001 * Fixed the completely broken 32bit routine's pointer arithmetic. * Uses SDL_SoftStretch in certain cases (angle=0, smooth=0). * Convert source surface on the fly if not 8/32bit. * Added license file - was empty before (duh). Ver 1.1 - Wed May 23 15:04:42 EDT 2001 * Added automake/autoconf scripts and testprogram. Ver 1.0 - Fri Mar 16 08:16:06 EST 2001 * Initial release sdlgfx-2.0.25/Docs/000077500000000000000000000000001225506657100137705ustar00rootroot00000000000000sdlgfx-2.0.25/Docs/Screenshots/000077500000000000000000000000001225506657100162705ustar00rootroot00000000000000sdlgfx-2.0.25/Docs/Screenshots/SDL_gfxPrimitives-thumb.jpg000066400000000000000000000043051225506657100234530ustar00rootroot00000000000000JFIFXCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 75, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!222222222222222222222222222222222222222222222222220@" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?[='YWҮcfeI9ゥXAZYj6wW,waIHGva) 2Pq]{-eɵ=@!MJSW71 \w*29h禤ݮӻ+ *Uڵ>Dش,dc#-cYZ~.mL"ȥ+xL&:ײZz5P(NgxQ|QzG,v/Y~Xh.L 'p B)i%ph 37 ί6QSu])rWVVN>,_[_y"hx  ZSo2((TNǝjLGj~'X4 ,f ###srw\ٮѵ ֮/qW]ZI4bGÜ}*swk=bAhR/irҫ)J-nCAѴk{w6n9]0`TG>o# 2 cBvЯ|ïYZGͶ$G_,ë* t{ WkN kܢC/O.wi VTi;J+]w{hV6lVj[;k xU#&DhC;\$%d9=:{Wmmq'gde;HcqAޕCZtm&{=[T7|NQ>ll?QF5{yR.J:uC;j*:npKɫ]>Z|U9I^uz5-]|WYz=1+~YQf"NU }p=9dι5%\jsYpZVozZu ?x!N 6SQ%O]QjɝFw.荈aܒ;0=rN=A`oήvtcpX<3;[=I,f&i}HƟ'{)rù%T{hu!J2 ]WuM6/6iv2}sھS 8ONi*ux^q,j=ZHY b;"̀mcWOOL񆳧VUܿ-e\=fYc0/=ar?'.AJpܺ\Ԓ(aIq88>NyQJ Ē= U5񖬍*ƿoc]:#ت>j?BT~gjs٠'eheP5y-&o5Wv%N !1AQ"aq2R34Sbr#B$C ?PAeeAD0*5egioT 6u-kQ JG9 fBi Q uT<ˍ(%*!*N#e$H9([1 EbQ"V/H}hu hZIJy#"5;-Oΰ+ե[M8yQB\8EXDVUeJQ/6.NN#m ѶGAUg~y{rfI5 S)!)TJ76[gvpJ˵SaBZU./*d.s (JUإR6_du+NHʭ k\0& y\AcRFqO4)i@O<-YD:@X)+8m.[ [1UN7[,;fgcUb\^m,Jfe&곘l=5Tp) JIRr6Fk5C2%% Z \BV( %jR 4)ZV[PV'2#Pb faP\q(H$5(H|t-djYݡqI7-$ˌ˭ˁ68"!:F(e7hK\_i;[ ь<pZ!VeRPۉZI)$H;aL4 XBK% f:IoDDֶe,?-^KFp\KBFhqh^N$*cj\3IJˊ0]}BTRd\ Lj5L e*(ŀ$cU30( qa .8$m@H$/~leyͤrvuɉLA81Jns(MMK_yUҒʒ,(P0ɽ`B>ʥaemE RI  wF+lvQO;é23.\.dc)RBRF HeZK3|Լ)d.adam֍ܽՁĀRe K =50ԼKyVmKQ6$v^aK(qR(AwEhv^gT2]MIXZ"]nKdMV}ĻO0Ëm< dVF!KlWi8lki WO$o#!q{\F?PP'q$H *-c{CǛMJy#5v!Fiqi Bokg<d6*v`H"8T %W)7WrBQ%EJ%g\tDa X\*nE*׸M;<*aR mI { 6 Gcls|+8nroLvHv͎{υ~G 0{Mi*23!63,y´.26 eS3 0BA&٩D@R; {Kbx7[t=-8)~^lBؔ/$ b&5"씬f+m+SJ+E!swUY~/:i^I r QN.V/8K}¥ikZJR905"@9=oh[J&feLܥ%#2n@ +$PT&d&eS/#8VBF"eys3mYIy s q %g!sn_DRc̥2^RXVXbUl.r |oͩmvM'fj-2*?-$+,w##}v9\nfr)*x2JPR) ŒIuJrD.c (JUإR6t';&~TTurfnũF3eC%bZ`A >g֛<Ue`'X faP\q(H$5(H|iXYA[k(Qmĭ$lBH$ojldz]}J&&&T`' BVMOs6!;iPeUI\x4MM)aƜRBb°Jl.{u)Ȕ*v8EԩiڂYCjYeJZ\O2dwL(k}9Jʎ%7 m*m斦  B0Ej6GjvRzu{hb]ei6ĥcuNBp+O ~%«pv{exRvz\?Na"._m CIA*P*J|!/TNKҬlU6FǢHlI}əS2][ƻNcUWK\dUMR2Rfm%JTwPe@&Å`6BGV;wMku7XT%d%eIL3J*"EsErZQڢe)yWD*JJr$ @\Q*;EWbJƔb’ N-}vڹZ4~;MʰHy8TJtQN"܆$]!LNVYל(ru6,i)m`ۅQ U JFT눚vE%>AJœN8Mv=9=6%HKӎ!6SU9 ԣd /4 M ج"XjU˘P A9! %bQ"V/H}hu hZIJy#"5!ʦfan,!%MR $7^}Wj5'54E>F^.qԙgTB(XX&?T[hTdM4KR[H8ZlGK7NV"F:}4:k-kBmTP UI7u\t*?d6vI9Qr;:Ħ ʜKRTP\%79or=Hm<˳u%p"zjq*iRFa9 %*Raun"DBgpb'sk^^#A!AOw疽9yu@lxyk`!:ZXAOw疽9yu@lxyk`!:ZXAOw疽9yu@lxyk`!:ZXAOw疽9yusrI=&Յw;0J;nnv69yulxykb5D\JQN3JIZ F7tM:l;zcded(rN̺4Y.>Q8.@T!:ZX8w疽/{QTEQ#4yecpJ[Jot#/*/hsgNR4>kVxA*EBq͐s-{sd;\^[3.R&bE5iEO+)<6uNN8Ԭ qI )J+$q͐s-{sd;\^(4W:>3Jbh<ĵ>[+2X]S ReY*3-vbTZJM S2ܼ8n*Uro¢q͐s-{sd;\^; $v~.ԂV&䙝rAbr̺̔y@(^{=;Saۙe^TS9c+*?<׺6Cugc f*m34l="sҐx0p儋BA6Cu-).mk-ExBP%44a p@§]ָ/j >50p^׶"m{ g{7&aMTN,˒ lMkhT -َ*j!H ēdXڽɹ)?Yg-ZbI3KUi @\Jm`&G3KUi @\Jm`&JTrb]is2dnƔHJ6;\DA@A!ADA@n?ۯifjA@A!ADA@DuZGT.5"P%^SJ)6%$\ O E=hmJ-HPn!$MJ5GjV(<ͦiaէ,܎Jr'pl3 NBP󸔔R rR7b1*dl/{WGv4+K-) 䤜J"6IuZGT.5"P%^SJ)6%$\ Kgj^rbm33yY8 aaL/UY'[X{_ ϔ=j|OH*'HbueBʋy@Xk{@TvjfZrK"whJ5GjV(<ͦiaէ,܎Jr'p͞mm A1R_mD;bpXls+B;=9Srn~m-+ZQim2kM>HrJR2Km ,VXq͐s-{sd;\^?kj>Ma7-2nvLR%z/t=6H.)Hc u(z<׺6Cuim2kM>HrJR2Km ,VXv [Un 1i9yulxyk`B;&N5X3$vO2mijAIJq Y 4g<+_mkCl w\UAaKYU<?${DK&7.?E;C^oڃ=a/=<_ t~'9Rh{KQݑC8T5*=q2]t.4HQ$x-#̎*fGM@c`o}7mȘiw®2н*Y}TϷbj{J]ʱ d9;*C8[3UD%s.l>rͳ7}>goLqiq|T53r nN>$,Xu@('l\1iEoڎRT&ԵJH'^~S>K)ׂqI{ϫq6LߵiEoڎ?x8?{#hQvhԠIQ6r?}2=#/1/c,p}ǼY <>'ܾem͐|aVV?3Tzͧ7)pA>;G7А~L\4\﵊J\V?3TzAy߽/uX~gc?G:$y߽T m̷.̒K$M5ʭ ;k_LqwN#fw6@I_4}v׼y3FxOWr/}>[i{| 7gۏTˬaD* 7NdTm k0q}m_?طlin.d!%J/,O=W=WT{Qҕb6^PAk#m; ^XBQS Y)Ēmk$n>LGF$f'&kܹؽVߵ .iNߵM! ؞ؒ|&%050(#;߹qk}3~xvBG3(δ-[Tĺ\7U㯀F_Q^rZyAk,]l5FG i_!)Gm4EgۏVUy/3_7˶YϹ\_})#K<7N_+K>ꮾ:I$=~4RI),xv+hF7>ߵG\鯩XEg/+4C&JMV'd԰:l-6t+1$vx.;t榥lؕ 04 #vA,`hh~ Ao SUahٛF#yfOI/M`%KaJH]g`ICԫ q$[8ލ9Drz9so`>_'GOI 0IPPƁ'1 $OO񎑕18\9]Tn>1ׯ)[I!e27žu8%Pm, !hRpKmt[HrR܏( 9xU^nPRT0JEYŒ R%eIi Btzw+X[I8=HI9 A{-i ` o·XYm~ܢ@;#%|cziZX !*ec#!C$NggC"* W4p9&kVYXز/qoLDuq& j JnX_=<€ qX& ^m/I( &b65j + *;D:ӎUBlVӛYmi@/lzbEXN\5?h$@ےT;_H()!C1NzTuA.T/hPRAEFT>1v&>1 Ѧ^8{$? @ ˘Q_F& [j7i|>6*K Ļ{t!7r֔%KZu(:LWg]/&V︰`])6g|ɵ\]L¸Ԋ"8C:}HY 75UW[ C-pa b5q8?~V@sۋ*"k۲v`|jcŎώH"FߠTxm7DvmlD[u\/)&6^1v%':'$(1 1UWG_ȥ w$[Tn ԦUPu$%K~ ,ssTQl4Z55Tۆ5nu```\i L8ߖJDq%FJH'22Ef]636`*|Ji{4!W3F.댎T2LSR"ZT3݇ B7_w ӈZAn#uC.uLM I8CdD8҉q-\Q9Vx:2cfAYkN3`[&'fp{G=wx4iZ()* y'qT̚9 7#m`toD r@+8"?̆?TjR\).8 <&2&hX*&# Cp)%7GLStem'qN8RculUŶ Mc[arͤ$oH5Cg)͌- w,\tcHEeqhaS<$I)6 DEbJJcĚ7And}*ꜴaoK [NA~s: mML]x݌jYS[RlLp0'<"BRQj$d4:7=3A3ʡ^.廥'My=NVP9,X3#| &5 ;U\NתK2Rs;ͣHe)Iˡ\ 9u"{ڬN$P؋iӭ]i-9*AV{KGsRl$rVuOXC/6\r{fRz3z~R,B9^ÜrBsin1l\c{2YEMTf),GAن'18cz#h$s M'y9)Jy9 iN{Irlɺ賊!6BrobRHP Pꍳ.oGrEw;1:梱SٚTYiukbqxH}玃%NG-.uWu:7ħeH/"Yl<ҴdtvB7$HXIUE>/HG/6`~th}RI.bmASB(nm-5Z#Z䜆W1ectV0>:ݝz1|ړlck z~ =2N'Om-ˡ`@멌)2"J  Q$hU[$(6qI%ޞZwUZ%2)6u@B  7iE;:neN&AJ{\cr"b>wB[HK}ys.xөv汁)tA)]!8DAi6Q y_rO-hZ˝vJ]9 x"H$R]lmϠZ+,_CzbPN-p:7"JiQ4_BUv]aiOS j7F9}ĴuOXN}*q\_3ÙO^x8,_8[grM?f7_p_\g?IsLj\QY?~q4}3أ CUh AJ0‚q!@*IC;O}1NcxM14hlojUr%D%?o9ݧj5Za̭!! -a78R ݝf!}(q6]sGHd Oq8miuP vEpL$)6cˣ>{m {A"Y!/ h Ѓm^@HVl:Hyy[뽯;kKh+ZR1!EP&#ڍF2`>)CeXr^Lb ZXVR %G#Hc1Uf0RZA eyww4׊Td3C[xx6Ε9e޺xvLγ)t,㌨h˜eW,Mr,)] %9d^ItI7hzr16\toZ4K>ii-++_ ޘPb: ϓ\g&L &ѐ`xN@+ZB]z"L᧰kቡ H. J M`WI<2c1"mkh(Ó7XW6G e(i' W_L. ϞL70SܨHgwHTeUeK3dojjxPrYmncnD*% e\{ zO"A)YܖMu qjlB2+g jmԺMg|/wP!X4PKxTϢ0oݗ|y|8KgN׍JJ@"H7Hp3pƁp\sxMɻNfQoL0KIR/ѼRUM Ppwl#MQrasDKpY9DFr’kuDjPqmUFڥj^7NLBT:)t,4W"10q啺-ښNzWAy!1PүhZ;刟O Fj_OOoVtS@l6dրbkSqiq o NvqCR7 V7?gb7#q2M(сꍉ!I ""F-N@\Öfmn1xOls݅#&8tCPM5/K7Qi ,sHb&l[sv.:iZǬjc{3ux(1/u`Z>! Fٔ1֜?t*d*uBY4%f$ռ4]u9j-II@#)r'E0 x Osof^Ki QKi! nlCO,qh2\m_uVEʰJA$$3F{22jOJe"6P"-s2E)|8@PPY^;PB[Y Rynt*H#=!qڏcaS4ʕҴI5[':.c?W[KK6YRlNB#S>?θH$WWnRp[nY+%48_,]KGGLk{j )SJH#"3-!.V__-5nPN+)o-Xl8`ޓ$UCMnqk(5StIK  X-Qx" *C@䎞gTIvu"* + ;aV \g%@-6}**ʌ#n+()dqWV*v*})z-18e [^~kNT%H-b*EI4[R0FȀ#]iI5TdϼCY*ќ¼O Fi*)2_yDPI4FiVqVnxޙI-]k&z;P/ ;'馔ٍ+/6 Ҏ9 h J |dufZD>,]Vm=lRi $ )Z#ͦ`pݙ 'm:#O|?mi30Pͤ[;P 5g"pkic뎧elkdmwWt5F eJ(f-g7\4eұ'Hq9YH`:b5 ~e4.A&;π~Ezmêqgy:ta 6n 7W M&# 3">ٜC*oC?"ëSvVk&ŋI,e-ZklV_Yڪ- :Y3PX?(1*:vgq*"#!IW)yITtavJdX\(GL#u (7 *E2G$/!ҧmE,i¥1l1-Μ։T$?kz/'SS!v{t><|c5%ŠFY(z\39_7dļ D{c =-BaНLN66$CiRoprD/)Ӂ666 *ۚ2Fr'r[6PI pilqW%;S[>~aq_./VBSFn *rx[֤H x2ϼ ƛ7-;UI%ż'[F7\_ .BIͱR$fO'v]zMM%k_Jt7Dx$tkÔi[}[.swiBo\o8P9XlnBZa >cՐPosxZM:Jd;{aPvboŘh 9s <գᙠIݹ}~$_)Nc1UgF0ݿl|1}LNya!?\-O9\#@y?|n@rr'2̍^ U4rxSi';ϋqD~mÊqWtOji k»g³Ɉhw] +b9sE?"_?u|#~S,7UgF__8;f~S~Q 9AggU>s/p-:u >gqT*Z1nbvG c(HV6Ӥk#LG v zltUA#Uf)#d[|I$J ؆oUNNfJB($.I.sOjMdjS ܨ:ޣժ)96̪DC\eUqVvEɸ>/0,  x53%<" F QNcxG,"rccrbgސY8xD\6k֋aZ]"Hy9Nw̵s Ǡn3LaS.4lt힙^Tl`xA߉ݕ磭4 7JfN:Hm,Hm\`]'ũv A9GBj.lЬ j=^c=.cgV&T_>PDedr1s6Xe)'QPqGC};8lͿp,줣\irMi Ko2Ҥ(Օ,c?y)VeN.oŖkq!o!jyQv発 (Qפǖn3kUO1ڟ)JS#q,,qJ*% $gќzhnARo]cpTV0x-)ÊǺH}WlgC,idt]A<>e?ۯifjlMiY*u`/UmP~Vد/1a`ZP[!iq ZN_TjS־(VYF'TމEBakFFKCV0mhRۘT9BֱM19+58JLc6@ %iZo&f lV4ۼ#b򍻲!K{Vh]Ԥf37T7yW{d5K.<@ϐoZK|ǀl_u @*:oxbS2k sxdvZNZߦ)9PJ@ܡKK8J$ŇЂLqPXF=69x"rF(T֐P u"`^5MZ]V-LsPʬ:) p6$\sYok56,-bK=-L6ԡ. o+۟@:tF!lWݟ_ IDf{Lh lIҐRwgkuM WFC։@YǜN)SE"ĜczI˭jRGs{뻣$\<#>`=,|Xl؀HFe`/n@i J A@RA6ەlcV +ƷѮ "bM։. 1H끨#;7#+6x`߬0 ln'|sp#V/WzC5i>!0~{fYK2m8GFX wD,]$NdpU@X ;dK3I9>nLB/Emds6АF] z$m-5bANŢM ʕ{Y9ƴO4txdX/GOjܹjEDMS/q,&X(: uT0Ue%j\z%G;0ÅoKQ*'; 45m׵3ӑ,b+J$gCm)J xrD>٫T2\Gj6-%G]Šh嶥k NnFR2 rd \(Z_Z\EQ)a r9g59>]cVG2w#nX)âqim)g x)$`7}q#KstGksmoLq:';`/sͿ?(54c@6=z49#V4&Ђ-o(o6+n!%m- E Mƽoft$I?"[*IU|0u-J%G4J:R0N+u-ru$Z .[֝#7:h{GdSm|Eφ6hu*dA9*p "P7eHU0p(Y):~:[39 X'1WBf__&sJv31Cgf,K)iRA 6HCh%)t4EO +q,lWF.JIKlG?USlGOLrOy}*Rld_TXgTA?_T>ٗ,jV`\wJ>(ZJB`J&-_Tmi9֍)u fr89 %hKh¥cFۀwkT+3@S^9`s n3ׯjlPǍe_;}"&K6,fH䆘цA$ŊȺH9kB&i ;}zǑTa%6lGc 3mLDj㱛e=6vHCT)/@QĢFxǔm4kB`_&Y1D 5-*K()͞.7<*<%93œy7Miyhee$TMW^i=t0uP8*E-bh㖩ORR˧^vG׌%kXoX[h.^h(+;ČO*]5aJ78r6SV6 YnjZ0I-׮_^jTl]!D|6RJl'폟6cg$1TY)i"6-XizRYb唛sBͬVORq٧%qONDX_|M<_|I 54VG9E|&\uca$j:cZf㑜@=UՌ"ܶm2=1m}1V Yx [sH oe!CHwx`#"s4X\S07q cr<TJ*K[? tAaq R #Zo9|#߻IH+A$曜C͑{F#|O,xͮТ0&#?'5 oӮQy7 N9N*-)cjmn@1#V?]1!ëUu/zvVk:SGd1(u`/U(3-&\N&$_w*!Mձ 8M0Ȝ"(4:[-0ɧas!W[ LM$)C+:)a'Sw@`%?$ M%myIM7nn0[ux 9# xۄ& REq[򸾇/\%aأCK'Գq"CQ,da48dM8-XzD4K-c-M9(]&S2ăksNJ*O'.PU¥oŇ;pbj tPBrGMĵ8,E[%.=Op\% F[ +}6jY^,􇅶`sI8&FYYS5-T]zcYUiD5zF7:z"Zr>Hq-:^4j^-&ڎKK(:oٷ+N-.l[Є )F(sׁe  Uh]}Qu76aզF sLr-L< jm5\MprIIȒ2fb|&#' ʦ*ϼo.(io&V1$닝BI#,Oq_WL9 Obe./|/Lxaؔb".]N%Gʲ"o9Hq#7,!M+1c/P0˭0q4 s7Ti)ݾVBQ$4Ҵ)*: bl/]џ#JL"m:,u;IGycňupsq GtN|]ېcݪI[Kk?Cڿ:eWgzW\u m޸f'AtR2fm($]J÷ød-C2HKl [ckgx).QRm'~1\hF|H.|'^Dz~!u)& .\vDNhLUzɡ\kzJye$򍉲荄m ^Qz؆՚$n ~<% tgY|`H76IpBT>3JSB7DICĕ\^Go*H 1\X[_9W=[opiomǚ$_n3߾ ,6kAR&aMވ[Jqf/8À ek^JQ9xɈ ) \%i ZA#GQ&F8@m\[l"qN?ņi+PmV/su{To  h/2WnQ\>xhJa)i H81`I=ָո'ByO>Q Y6IQp䠼"ڏ"ۗRH"_vnEW0>Fɽqצ8HBJ!,.kѭj'X˔E\m&2$5۲8ⰷ>, (ܓD:ne R!z+D߿K"ڱJ61F9-rOaN aR՚D6Tm+ZJRpme$J9h: s lź#ڰAY&6?)뤡>VFo,#0V]ep1 _^|l5v=yMcrН9snRof<>S_PyxT.tUksnOy7 lI{1#m?dEƞC *kfpnvVkTIjW'![0IIZy7cO_ х%4Yftk*Yג'qrwX-t"Gt]', nn@pVsbU/$U&WEK;҇#숊J[xR k[|!EaL0J՞\R[; =1=d%C b!Ec8B9ISM(,/hځ\MEbRD gI/C˶jh4pn>&vPO^p8'v-6Ep*9Ic2uH XycXR~H]c]AB+sj`,qÒ`ƺ!iVi1]-TF\s8Ɉn U]crE9.#W!nY*7? ( #P m~6$qvE࢚XwǠ؋_Zgqr!Oa3jMRqwu])).=ΑtnYR[Bĸ =#0W6v?*X&<呋ʞ+JU@}<}m4R2 >'$fiϖf[.-6v/xҫDܛwĖX(K-3 eV#;^w Nc=0 zM.Е`m#maY]8!][L&4') TG$[#,HB@[bҜF.Ifx XmeyI }wy7D+iA]Z?!SXD,P+d}~C'[(|i hK-l<"_i؎)t/s{xuoZ/54l#t鄌,I߮xwa{b 3XYG7'zc]d)'=t˄MQA38|ʥڿ:e|vCni=4\ķ %EI "Sx%M,U- \uvg+(}?2.HJldt;^P%'dTKPT,r_T9>NZG9ĴzjGk[iN9l;ewhGFؚ}Wn`vaU]Rۉ:`A迏9lͭ2nrBx$TOOQk&ۥ>⾤(\웶 <ſf]LϱL@8ӯO:g>q~?3F$tEk (:ol#Fl!5PKBF:~\|x?(cܫ ~w.j&a`ܹںj1]˾RS5,rEDzc6hW8e?tvc/ɧ;ݛ#gK߽ sgpF;^t}vW̤}/]Mׂq~Yo{1#mZRj[&ˆ2G>˱56.eX_?nlNqņ6Qmhef:**ANӦ4Y.؉@'Ed|LʆMܕ,Ul.Dmҡ%)ăs.7[D>{g %8qVM~ttw61azi̕t|'+ף<roGɷMfM"ƾODZKɕ5B!UkKML4i{+MO6G-,?$/1Ak(_vMH_Adc، ]vrFFvmu im$JobpoaΗ/Թ|Ģ\8p.69_";[m2kp.ؓYf}УBf6n)UL uY]PpH<6H"_G*V OTj:sF뿟} =Mmk<ܺ$랷yQ^) \s&wDο-uZm(N$$ 8$m$ I7yީ{˵=rI:ĶnPQ;ŭy#8GjS.n.׳jj {1]ݑP;F1ؑ5!Gm6OvFv;lh[MA!֏v"_T u`/U"5cNP q_#n{mDQ;0MODke+^PLbUAF$e}ֿ<$zplVctW`ɇj)7>ijEFo3-WNOX^F-v X܊U46> mAj$GnBƥ@D渐rY8.΋e|c5JnoM;oHj6߳nvUHE$ңk7+ݤkG4Br+ߟ}=;c^I~7,9q]\e*ʉQ :$cEf6d ^%YPfw?zʇ3kϖT?xAO^|3g}Aש,3;vLeCw@g*S>YPfw!?zʇ3kϖT?xA}UF5ÌzCM12RyE Sd0Hg*S>YPfwϴ[Nok%SuVYȪyl[Ħ[jY{LVOkӳʇ}Yl,,p$aQ kϖT?x;^|t-bN7W˽=/Q B8^VʁQ5DMVvVdfs |$䊚uK8xyIDzʇ3kϖT?x*>Ud|~UJS"i_RO' ;=+0KePn$HP6 }S>YPfwzʇ3 66Nmfr_uXZV:,Qu$k3IJKh_٪\02%x%[qULeCwg*YPfwzʇ3v;KP[+XY50D1+%.$\U)5JtK!,qRehQi7@߹Rr)S>YPfwzʇ3;@i۔aqӍJI%ygsaU؍WTd|LJ!o%aҤPKM@*"#g*S>YPfw::+/+la2M4q)A*hx22G n,SK`Gm:Y5&v[vY 2Ӌ 0 6b3g*S>YPfwbl'!g'exmC%PMB6!?zʇ3kϖT?xAO^|3g}Aש,3;vLeCw@g*S>YPfw!?zʇ3kϖT?xAWS۝u{WGakLM8R u\.4ȑL#zʇ3X;K+5UBLeCwg* 'S>YPfwzʇ3 kϖT?x;^| B3g}ש,3;LeCwg* 'S>YPfwzʇ3feZ Щ_*m+|򐐵RC)mAĄYRpJ)}1~o<:gm!/zʇ3kϖT?x6gi{-*5™$.7EAL*WH|{ep x9 W˺})S>YPfwzʇ3hc2Lq%d2ڍ.h%vZG(IK$-:RW{g*S>YPfw5[9)h]rFW,3TmM-|WR)XGr#VSש,3;vLeCwC2s:+KrD#4ڤeԐִ틑d%U+Z[6]Ɇ䭓pPʹ )&Ô.l!W;^|3g}GFڊ *97@ٗfV}n%fd\N_8S>YPfwzʇ3:c&dtVjMFiI˩!-iC!Q 9#;D)j7TEwe.9wK 2H$BW3g}ש,3;cv2fN~GEinV߄fTL֔;]r3DMOavL= w)O ҂JR%JpbO!'zʇ3kϖT?xAO^|3g}Aש,3;vLeCw@g*S>YPfw!?zʇ3kϖT?xAO^|ƷTeuWG}hARZm;.t́D$'Z`kJ< h_V};E7 B.yfvs0%kowك]+\{ 'Z`kJ< h_V}mԼģ;?mLD7N$eX/V 5u=q9 &6ܡ7$\ HP#Qx_[U![ c| ^>S B_|!6ǎ\xNb 󶗍m{&3Tv?kQPyK3!է,\Jr'pd!\أEbtЫXZffL+I<" a ͵vbcf>qIM'|W %uLnnCgVey7дl.. 8'c5GjSٴ2ZrK"whA. /V|'Ờ=ݱw9kQOdjj*#ifd:咗kNDL+2=&&ٔfp!p'j_HO.yfAKe68܆woi @\\*wf;Qe=GvzB]GV@َ};l{>j,A?ҏHV~h1ϧwڃ gӻE<Q wZf;Pvw}J=!Y#⹦]2$>]m,!”rIsf4Kl~OcU$MZRS q(?h6⨍|gR$ͯ:bWK<%q%q6?'0q6?'1C-q eG1 eG1 eG1 eG1 eG13,rRQe gs ޫ}p8?* ƶ&#@5%õċ *#!vXy޹RZm45je:}q (P9Ch҂ӑ{ 3CNVXqV1e";bF]}~Q.kHG 7ktɹfa_2J+ۤA :bNL9[r bb2Il\uf;kIaifߤGdJ ŁBxlR?3X/O R.;L Ql댍\$WALjnxx%K v*=Be чO"!ؓ J}IZ@Uʼ0{IGraE!I"$HX?I~Yժ&R?1QR{;UV14[eВ)wIc{C_G' 訂 B  " Ų?2͎%%*uHO6l7מJ%AIP ё&.+;f>k干K@i+ ^n "  B jMҦ^iME b:_9E[ftkalrS0/=c2$@' iy?$l UR =u B  "  B9_\*z¨+<>.Mõb5C=- "+g]-mrwo26,7uFYަlORoB\J.p3'vC-(삑Lg[ $s-'%<Бspnxcl-{hGolrp_ ȝzʌt-Aҟ$?Օz4LT-G/U_oa1iN:x _-s$~D]_XûC_3"z*  "  B!D YfEﱶ 6Fr;lRJvIJ%AIP  0 "  B#BV%B"22  ;]MFu,((ZCUM2qT,1 g;b3h϶ UCpx#^ȳ4FA̔Psk~ZK8e;zmSru]UluqgpDAiA!ADAϽWT5~/Gy]rnUv- GmkT'W-#ϬU W ^lzW[o<.E6鈭k&$alejk׉6!lKdWlC|q[@> nāsQAUJ;9cS!g#ctCTH].5[賍W2Vh qmYғ}сġR;gsSd&%@=ț!{.r3ǚ" )JD+q :D-<5Cejx XrAW4qn&emŸr:cXRVa#KxAWsaDm r\MDaT1\jjm/˥H]7(VO?4!3 q J'3Ve)sfI;IuƊI&ƆC+"Rn#x7yeTn sZaKxkZFE3P6Y,kk^XZ1NlN>fŒ\MƎ č4dGG6yC!"E/K_)6B(b׏ :+Đ3ROk%( ̌Mɪ,:# ж ұqo]XىWLqsdzu )gfW.e[6RU0<@YX<9+'̺Ts$I߿8!O)j#+Dۭ`k0 ѡq%6[pMVHOM_$Vbህ E ך0]J,6M(he8Kaŕ͹@:+Ϟl4_u>LT*q-e@%_w\9 9B[\H)&HCSNp*BII~x9C4tj)i#vcEYN8q't*kUC3)Tk{V:다XC,TQ&t.CѴ3LWARlGuM_칱kvPV l.7+i NX.w}/1HBKSh~VHyZPADA@A!GJJ6 a 2r`ةMZ#G=qJhгT` vq",fj̋-D-yTkT m(K \}]16)j@pmͥl[Ӽn="  "  B  {U[4ZA[*HtfsÙhe,y OB46jSYI,_PsUUuwGɸ=Uض*Í-y8}޹XWKm<:d[s=Iu#lA-<LLa|Xavv"TNE9#g%6#6N% 9[D _( SP"aŚ/ buJm77%4u=;q ŭl*Վ;يc%TNVb1(RH $y"!`OA!Ӹd(hiӌʞektv #L[8o;Nq l~2sDAW6ǯLX$d7$omMg0ϯ#68}_ z7nѦ6 Z 4ܛ|8(8N"MS)*"-w`.ޘb!H n~d kq`U=tz8-ҌhJme .L`N|=1?[\nw,ɵndg5=y1ystfTNz#Inau&P<[z"Tu|-۲A$GN.nQZܹ@b9I,ýfOv (T!(^Z*+r(aJ'K78y7t>VRj)t9Me!ivjSٺ!%sRA#G)rFZZmMJ7q_lzb*늶%T$D½8dn} SPXp.$IE䔃Xt5N7+(YÄZ8k$!Lac|z!M+hnhV%]GuRY,Y+95<89u2@!Mu X{:J.eIR9,RnԘvw?Ky.!Zg ,':(( 5 > tU h9J9C^PyLSQ8A`DA@A!h~/CYϽWTyוߞg&WbڏhLL9ڏhT|+|yT+Xs#3կ5F@sn,ZLF-`A!7[xo,Ix,eH!)7zG:;Iu9ОP5KZDF|OsWdPLǑSOK_U-זM@ R*ܡמ>, +kFSsKjD.go!JsR JV@bUdZR9U%h7#oצ#) o"z 8(eYe]|@m}$O :,U;HsJ,1o`5x`mcK#3uM/ӻqW;rnR=&" YG(L-:œY9ʹV$fEqP4#+ \<&ZV/"'.N7a Fir> ksNk|6+Lk(XF:HXf|ւn4L9eN|qN_J7 LɾE6%JRD ^C) YK`)F߶뫱#| HE/u' *Ҁ,Wap³;-)GⲓMo(Zn,Tɾd- lf>,e a#̀kyc}6׮Q狀3Q,p,rq AVZ$"uY!+lTOhpLukXGuļ*&[cji[hNJݗ0}|:F[棦whM"kXJׇ IVPG??KSJԵkQRjQ7qxrt"1Llc kp5b뼟p09Т IWȂ B  -z¨k9_\*:#{Q[Z 呉l-oT0ڏhb y=z|rr ަtĶ{hDJ(lu% peJU3BBFZD$u3f LTo ZxU$eFi{Fٛp4_1\;::RX6y&3spӂ}"DK*_(~nlI(@!#Mi.dӡTrI?\lĶd_lׂp(VV6REGtxNYo^&I)-@ "6 ܳZ)[hry#:_ quJxVILTԦ+k*)f2=7Q]wi.-̎QDL6 { RL9u=sWa{A&ـgt]Q1&c[OO&is)X*'HkMryiky evVęZ%LPbaSFL8f"(1mޟ/iM uӨaŚP4"JО"$-gy!m>88\uZdP 4*Va'/I'.+J)Dִt[˻qx!1I_QrmpE?fo%}PXdz6.? /_b}/1!OũA Q@A!ADA(uʙy$~!mwdn*鶭#*v;Ax]!HqZByeHzQjZzo^S8>M(6;>і#צ"%L "  B  $S:-Ze*.{M#o+iM-vR\ 9e $YҜ^Y;]La]r պ  " Dޫ}p} μ?7~?EDשQ[Z .n9i5JiSW)sIwslr7\F70ƃڊlw(_#KZĂ:CǼ-x Au! ru￧@1H]&,a`' pܝϯjNV_ .,p6݃bç]! fUҲ@w.R/ͯ_ۑyh FyuJ<:IjDԾEEashbQ%䃧oTJ%dBah,c Ӟ`slЪpkX mk"<:,-A ߕ:GJ 1mJM%ӊʰwWe]`\؛ km=q Ħ'[5JK<8P9Tm1kӚa1[db y˨2o|k~:h[(mDG=,# *&E¸KesX(F\il12涺q9W Q(3?6<iJ"|h_(2Ud} .(4GCEC<x17zjSR֢(ܩFxaĸƊBG92%vvLځJ͆n-,8M+-ձm7(Se/{booW@{ WY:-~U9U-G| Е)iJ+& ԘuK4HV>UCb]Ҍֳt ˕๱,yKH-k ҉m!<".(~2\&ycڻ@O)drmLܲh/^X:Fy{ e`VA Hf":3"|"WʔV<#8Γf?őXwUF.? /_b}/1CoOũA Q@A!ADA@eQ})o MgfL4$Z+K'q=uuSpkK7ZﹿV0 \:  " [cª|5.F% qVr6-\Uj͠ X\onrrlWy6Ó3 0p:O5Qn)H*@5OHH"v~ R^}闔UQQ;1=kbtTR ʸh-f՝q:ZM.=_G+A!ADA@sUU g>_Q^W~y|\]i~ˮj? +?ߟh ]sBVp9fߟ^Fw_8 ɵ3VMjʱ܃㍧2s,%VVJs3Dd/UJAN@E+,ΐ+]kPG gĀDBV rd}D#{j&4r֍rC6Qr k6iФst?BXbsՇ.72S3|^-F))Mդ)*^pJm Ros|͢Q*IݟLJAZ96`r3BۜTu;rI%cX#FNMXHϞ6M1:0apPך"g}ߝዽL8n|ʝ(Js\ qkEeұko42!.b.*bcs4ol6쇄LJ\S.%_;Iq}QpЊ0GSu!Go#~BJZIpynACVKHBrʍ,wX,p:EK]O{کA=`uXtFX47%t/cc62- R>^MAUTh@I~B)ӇŇig)?"96no4Lp|T5Ow;g%KR"В*cOũA Q@A!ADA@T()*)RM23"rE FETľddJtwn~z^C+{paa֤AVUADA@BN,pbzI=;\4#BGlԫS.KLlIV.ݑ$̤mAmn-ڐNk`AvtUpp 2^GQ06^?AnDA@A!AZ'>_PsUUuwGɸ=UvV=EB&G]gO$bDq.W:n#?DxIO\j;mp6)tĔ: 3ﮑN= PZ!CsjYn}̜+R NXZۮ-]a)jMUCIRlL!)73Or<!eDW) E[ۙpdkǨt9~q (-SAeo2B- I_!$1nӼ*:təѩSS$fuJwҕt"]A$\)`9`^&"Nx vQSa+arCri%׆=<B/k^XQ.7MF)M-L:ۀ؂slh͜=i!A傕k[M:!ztLtOTX;U ^}ckOX?1RmW`3q׭96LQ8ɶ+sFm; sm1'|[Z>1(0}Zy+ONWƔ M- tXF$l7EV̛fu;gW]vHFH:gQ]G%$7w [+۽gۚ0'pHw687fVEOlV^Mjt1yA*]_X".? /_c:Uג??pAT/EDA@A!ADD;<=^Uxk9rZTF4umSOB @yC}Zν.;ճWTsw}!H#T  "  BvCcQq" }*VN` z"D Hm)u'.c]LjF[DADA@A!AZ'>_PsUUuwGɸ=UJí+~gaܹzֳbre1i˨7Ui"^ۺJ#Hڱ%'|1)H6Q[m!8ZSXBrT9@ߛ_X% fۊpxY$+/%i|\ѡ) 5s.SսHa9X[0rth:"RF7-mHR]D1*O>]*ԓ8 7eע%;@p[n^Uͳ pIbK'%ݾ3i(nBZ3+N7^q(s5E}@>(-9]9xaNVک&e1/634@@ؤa ]^ݲrsJRM0UskZ6^%rf.TL_E*V-+u!\-$k c.9o#EےaVҤ̶rJ,;GWI[#iܓtd4uӨ߳N '(2oNb<Ў,VJI6=E{N Kf >NAɒRwW? /sWE !\?fChC@IP *IPl6|xsֵqjZJN/NǡnpOd뢀'XUv^)WsὼqvdWr34e4mp6,Ø:E)&TZgPppcY|q /#)oɸp7D^z"U  " Dޫ}p} μ?7>=EBekvϏ'"9乇yj653^WY|%~}GKP?ta.>٘7@ S i^-CF9h8@o$:킗ѫ!I(:HHA+lξ^;`ujE"q?~uww킗ѫlξ^A~R:5z킗ѫ |\O߹{߶ __FTR:5z#oaһKꃶ __FTR q?~WW{ ?]J%&gH gh~=f;1 dؔ;'pcfSZU09;w];wcAwhU~ӻG|fc@B=M;x#bwh];wcA)vLQN };َq 7?iݣvc@o1?wَ!<1G;x.w`f;1 ӻG?(v+{w@z8̬ Ҏ Yrd >(qz *:Z 7%'Kn [ܬ(T-׎1OA1OAPEuw ׎1OA1OAPA]]7S^8=8=Auwr Mx8U{50eu%+AGh˴% [+'y84\~3dƲ MFc[}~$/䷉k_lA)P>X\EHgoܮfΧBF\cs/Lon*|O?SKd 6 JO1'ꄆ~Jl|cY鋟7tHpsn#`v~ڪ0g/m^K}S1 P{v)b,Gr#h%L[QIM9F!^_Y_Y<{Ț^rI\^Vc/E3Jrc%8gF[<@cii w|Zo~)T཭G/3ណX ܶ?!yhaܺ7!t 3AivcZc5^NX&j_#5/v#Q)#<&b] i7m~͢MՙG=Ro1LFٴG)W3YpkDm%PEYƘ9p`l~#1p,vo+g/C -vӁʞsRIW18o<3,_#Y)"Wu+Z쁲)@OGz߫'.ɋ9|Xq?,hvt8ɽtPfec ?,{XEŠ.%vlb:< +ܧp7EEqLڽQ@,Ae.jiaw^A.= I+:[wsvm~j_@&.D8mzlhushdU˅"w!|2MRk=Rk2 hṢ .HeIeDy wya 9%}?%R5q󈙬`YMCk6 2\h;p|O1ɸܷ A8k7*qO x]hPLK͗XF.B9 s7-_ff]Rd(33kHLqZҿsdlgfx-2.0.25/Docs/Screenshots/SDL_rotozoom-thumb.jpg000066400000000000000000000021141225506657100224770ustar00rootroot00000000000000JFIFZ CREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 75, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!222222222222222222222222222222222222222222222222220@" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?(AEZ;$)71V?9ZJ(QEP$4SnH6ַpIu\[@I[=}ӭz:>m ֺ͸#-+ %py8|NV9vFEz0 ^zOpNRQ;/o^rvn8|,'ddG^G=>I pnϵqwH㏆`sX8rr+е mEIs1̳JX+nwa\3H;)SV# JTGOErFa֛OYM2}QHdb:84(R_ёc/?5hð͓ׯ9VvdQEf3sdlgfx-2.0.25/Docs/Screenshots/SDL_rotozoom.jpg000066400000000000000000000342321225506657100213700ustar00rootroot00000000000000JFIFXCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 75, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?(AEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPE(N((fm"vnQ@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@XL[zѶ#O5(B{OOZfeg$@_ͿZn=UOq:ICZlA&]T<3,|=Ek͠`_l[&8%NQdTQE@Š(((((((((((((((((((((((((((((((((( ͙1Yv i?WL]nȖ)<8W$y,LQIͅi>uU@W HYU,]g5' /pGcTko1d"9ZscyT-A= i.x"l_-WTe^c"A7m>*Ym涔4OX`.R0YYN} %n4aCqUNF STخc2%p^jJŭp) (((((((((((((((((((((((((((((((<ɔvi] Ч~%\K2NOASY횳KkE knO5*ڞ}Uv@*ʉn+n2io" EtfGCm"^͂Jt4so"\q]VЖEKusp8Y }u=*9#u[[rIIAk]q=ڱS}q%^M5Ym[ZY LųNST5-P˺Au," jH`%?,c۟h Ce5 +^HNzhG0tFQPE,ziejyL6#9 IӽzU;gYpwqz"S}&asUI 95e^ܻIKu qW!.CEfЫBpIo鬮 HEziraU%ϵg,eF4y]sd7kSGdn rO R.Zf,6٢d>㊊kFXQE(((((((((((((((((((((((((((*a < $WҶ&9#-V㷤*]Ba*&曕YiB:Y&Ck#Ƶa}6Ф5wׅ^'Rl-O1Hw^\W*]8j!s֧ZyחIӦ2;z_Z_EsXMV vCVQQZh{]V@Y3`>vP./!xcn$5$3U"/<3m!&1ʤA3G*t885q5qQYKkR%u^[/GBcwDᇡSdW4zBEh6dPEdiWv&=;5:Bԓ)QA84VEQ@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Gp{/5TlcyƵ#\kl&p5BFIފzFX"g'-BB`yE[H[ Cc(6=ž*ϙpn]\io$8HRǰ15?d.e'#?p~z}+H#=Y sZ3p ki[͒]O.O6XXu*f~夂6'?J?xLJ7ZkK[xqA&4t>mZL3ZɞrmnX{5eFce<]4^CzZ_^0-ͼ6yljy5mVËgx)"j"&,*q!;N9O0Z 8?!ZOlϖ-l.dFiYOƺӯ/)Қ<GԖQ<#ZJW/VSխ%I:y쟰LwǯLV,z>ۻw8ձjvAGM+Ar 4Î {,y' 5Ym-v=:]!ED"m<#𨭭-ؚHw 8IJIikjhn/Z41j d]U\'g=L]wt>z٬" $T$~+9"{rš_ikVpY[bxղ3qYiwǶ'8SۥD(1^kkk%su>>.BM`k FJc&HEWeVY,{'Xk"x#Кl ȊN0A?ҹ%*۹!s-8ZĻ$q&z}u-X9"ThM  ZBoqV]Ha?Lb.med>+S6&2TrE(D`kb5jRh̰K?#|𨿵g^Bù51X;࡫Cw Ԩ|/Uu<,o[XE8IV?rqޫKWG0%uRFԭz<_ߌy f,N:ǜ/қv:98u~VI6!ض-4Ŵ-ޫ ԕbqF׵ ږŐ=k2]{ N6ֵe>ShF%d9$ϏʣlWJUvӟ犩B5$հM NBAaVwzy_JӴ!im@Hnpݳ\Rw:N0N >XVh`A \OP3ߧj[ʬW+9s%!.4rp UT%>q]J?I6Չ8YFVSΐT%lK#Cz SkTZص"3ʜ=WiQE!Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@h&ĞdԮݓ!񚴫jqVbAVz DjE7ݧ=MPE9j偪+[a}Nrrifo-8ڹE>msXm20 \k 6/MB mO\_/ 7K:݀S=Q:5ݖv}Hj n`[&Z/~A]|HԵY%F%Vy94MVv;We-7'h^6y~Si /eUDyκkzN~ bTB;+h8MZf^Y`zqCj&jiVhen̸fxWQ [:5h{:5uaĽ̈́AVr1Q5gEmm\3FmFiʹ5;LYgOnTS [|pxƪ[Arf\QWCZ2hg8uk[}k|U'|7X^RZ~rZV:i/@?*' zwBc55 BꏳQH*i|S-u!㸭7ZGމeUlԴ)ҹ;y1_WNԖ\Av0UVa Y'5I.&G8=#cZ֙5W5t=Q=3ImB-I| Dk>ɦ[ΰ[UfBr jxu`<,Q3gwZ]Ѡ?Lij/'|~mķeue'´,;? ҈ Jv`n۶F(R`zU9'񮅪>#$֟>&,~1~x@4"R Ԛ/v? hisNެ{~aRdt 4T@T`TdRlIW1Ie|*^?s\rs^HwF8LvTkd5xAn#8OדW!oaXz{kx!Hq*pbV5Rjq^PgEedɴmQU ~aJᵛ'#N?NyEb[ҹ+H R/'1tk=FNpRY#ǡm5OFg~ޕSLִ,`ggtG'x9QxwM[xfA]9]yp~ ̃ڻ`A]y}R^[-`cQfAlx601ˁ4̸x5!n;Ik*cŻ}UHXڝű׷kCQnnµfrz+iNQ0ʓ1V;?ľ]K5[j72Ezt>A՟Úߍf=וn|-ve/ʡÖa= 4wRk)|\Vkfg\sk&'Ў͔Ki&#i=kKξNm; ?Ytj3~W?JzН6-n%mCwI2Y݂ͦyNWȼbsߘtsaus%<۩JoشCsOGicE˷fV=[pXɪUV*((̠(((((((((((((((`M(95\L!s߁Wy ]FeJ]Br)I+&y BAZRApwy=ںLIVJu*(YFUpH7k#YCD2>WI(F?c[2ݔ\ wDl|]\;W^Ms^H'~гo, z6?u*1l԰[?(23oU5 Ȼ,玣+7|He>վaeN i$?KVj5TcpuJKyMpV_ [4O2>8 4ckgE{YPӭ~iՖ»xel`@"qK=7%)kVEg#'۵yS>̤)˷q$CAyl$C\pìN!Cpعom iI_Q(-r3ոn#m85[QLVeQIZ$+FesSSX}* #j1,d'Yaꢧ5{۫n2J0a@·/S+ekEdڵnuIW}0)'p*+WܮdM &V1ޱNd0M gS}SDݕQM6+hQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQE O-U՛@$ \'&kR5R/\0{>jEfh)I$y r9ܵibR;R53.ꉓs֦U}j'isǻZ5}H8Qb) tF@0Ev_/P!n~V?y[WW /׸ U*_Fyq^=:WEέyLǜ.d+DCڢ/*J̖dRT~SȖ7CRC q[ٮUx2N9Zwn$F=+ 4ՆNrvZDHMcjGi"OW޵_3gO=:K楻>3?±m4N0 :G}V>O^VRI ޺kxbacPe,얞^K.rGKw-֡oAOf_ 2VrvEٮV&znr =efIxVG|9:݇ZFIv܀ҳZ[{:|ʵMoVW!d¼ͱ ^k_[֍܅E\jKףRoɰF6xٱFFsQg_WtQNcgR=FPZ6ӻ<)Ikҩu$`[x޵Y T'ξ >`Gp* QAvBgjД">n+妁JE7V{ -d>fEi8ڠ,]=k%Z Ҧ u5agb-A$XcwFf PT*MJ/RcIٺ6+׌l[y`Ĭ ),vP[Z2Zgn*:W_>$dvTnmx֫{X8nuqڧ_v ~Ys"JmKP'>ұRj5UHvw's¡kL8 ,OtrWoJ-P#>{e~#sW5 J55}KF3*RѓTf) ꧟f5Y؇;UAe8a\1H=zgO֜!6Ԕӂ+mg?gOsT5V\-lQEf0(((((((((((((((((((((w{sVc`̢YG qp~^aEY) ոu)$8_κ!_hu;=`1(xgZqʓ e` 8fCMnHb3HاsQVyr*"rl>=F"B[Յ.p{ZwшZXOYaF*Qy"hՔ&pi7ǷwZգl,{4Q3WpAzsnۦ.[{|E|f}8hV3R2SQJ "DWsjjYl3wI\G 7>֫IXSVrEI9'&(2Š((((((((((((((((((((((((y`mHsZk[k!u/v H5[93VO\13yz'x7/nm"?ZpkE_CbЇu1ޡXk:m>Ewmqu,N65(ҺRB;HLS.$e#֙>*}r̝ :ۦ7sZ8rm:}Q'o {VQO5~84铠W1KR+GfBҶi)°㊉a0<;f Gu5M[n je =c fR0⽎aoCN}>SbE+ځL0Ēx̯&%9 >)%͑L6 ף uwLP'1Ei geܯ7Ys; j;wj1  ~.%ñ>بNdk"F= POCVѩNDY}O !ϥ4^w&u1Tzmagœ{_g]sBCRE^X]ޚ\  Q;Zd&jyĭ'U<*Zvٗh袲64+EhQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQELS'XK8>Q5$dj,X%NA .OQML%{VV%eHeAl-d&F; Uf @3YlŘNkFBc,QAEV%Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@=%xQZe'`- |0ŃfQZ[ȞO2sVmaER((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((sdlgfx-2.0.25/Docs/framerate-thumb.png000066400000000000000000000022541225506657100175640ustar00rootroot00000000000000PNG  IHDR26 ]gAMA abKGD pHYs L LOtIME  )IDATx՘K2]sS XXO wn-@7Q Z4-B#1T\"kc̼1WG,xn|Ι9*QF J5@f>V+ATisACн=Ee>Aij! 7bnQuݱXLE(a5KMMh+|>R~R)JE"DQT<yVEQeY! q www333>aX\0yRbyɴ+-Nx`ddA`fhhHE闢\.h$I`Y..P -<p'xvvv.-e8 q^Қj ]ϋL&ߛ^ Ͽ3-FzX,F"zD"Gqzss0 6=:==- Nsttӱ_DKӴJZ>Oti巷 <8P8-׫jjy:>>r:naaAr̈́h(j߿JҽMZ`0J y=Daj6 ݮ-˅8q(MAiAp_]] tZFVAjjEQi'J!{6_l^+Ҍd,qwi ^h6{БV2L,nooNHZPT*l^|?h|>$Kn?99IRfltJ1 3jL&(0&Q'h Xp$^|MK Iv? !EQ`WZ xeRyh#~=?_˲A8^VU*ZnSmdEIENDB`sdlgfx-2.0.25/Docs/framerate.fig000066400000000000000000000043701225506657100164310ustar00rootroot00000000000000#FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 1200 2 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 1650 6675 75 75 1650 6675 1725 6675 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 2250 6300 75 75 2250 6300 2325 6300 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 2700 5100 75 75 2700 5100 2700 5175 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 3150 4800 75 75 3150 4800 3225 4800 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 3600 4650 75 75 3600 4650 3600 4725 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 4125 4425 75 75 4125 4425 4125 4500 1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 1500 2100 75 75 1500 2100 1575 2100 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 900 6900 2700 5700 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 1 900 3825 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 1 3 0 0 1.00 60.00 120.00 0 0 1.00 60.00 120.00 900 1200 900 6900 6000 6900 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 1575 6300 1725 6300 1725 6450 1575 6450 1575 6300 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 2175 5925 2325 5925 2325 6075 2175 6075 2175 5925 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 2625 5625 2775 5625 2775 5775 2625 5775 2625 5625 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 3075 4725 3225 4725 3225 4875 3075 4875 3075 4725 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 3525 4350 3675 4350 3675 4500 3525 4500 3525 4350 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 4050 3975 4200 3975 4200 4125 4050 4125 4050 3975 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 1650 6375 1650 6675 1725 6675 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 2250 6000 2250 6300 2325 6300 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 3600 4425 3600 4650 3675 4650 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 4125 4050 4125 4425 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 4125 4425 4200 4425 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 1425 2625 1575 2625 1575 2775 1425 2775 1425 2625 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 1500 3225 1500 3525 1575 3525 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 2700 5100 4500 3825 4 0 0 50 0 0 12 0.0000 4 180 2340 1800 2175 Time after drawing is complete\001 4 0 0 50 0 0 12 0.0000 4 135 375 450 1875 Time\001 4 0 0 50 0 0 12 0.0000 4 135 900 4800 7200 Framecount\001 4 0 0 50 0 0 12 0.0000 4 180 450 1800 3450 Delay\001 4 0 0 50 0 0 12 0.0000 4 180 1395 2850 5475 Interpolation reset\001 4 0 0 50 0 0 12 0.0000 4 180 1770 1800 2775 Interpolated frame time\001 sdlgfx-2.0.25/Docs/framerate.png000066400000000000000000000134101225506657100164430ustar00rootroot00000000000000PNG  IHDR,Y pHYs M MέNtEXtSoftwareGNU Ghostscript 6.51IIDATxњ8Q : ! ؒXqٸß-T8M>ޫ}<);U!I#B86qW&>BF0 4,*&!ˆaD0|ϕxaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆa1iL!o&6g8qۧi2puoɝt˵ͯut;;nY[E&V4 8r#Ehn*a97Fhaާp3ЖGh-9lnLvsҡVK$ lL F#B!ˆaD0"@ F#B![b73g-z|pP|fiJ~m>~PAg%Ҽk~}dozuZ{ g5Mr=ᑳX /WF>+rGϸ%zXau5JDF3ZU;.k1 jsbzJ~i-zXL>OztK~mYԲro*yX.cN[~gͲ4gkɯ\ڜ3?׵KD^*/){fc\_LBMjiڏJ%d};zqq*>̃g.s}K2_(&".c;OwT*<†6"qEJA?ZV`$m}g⏋`BJ}\Ө|u]x<=o@ { s |a\9\k򧎰BNjPqNA k֏mWlݜ2{3&t?}fV6ߜή}^K>B|99:VD-"K]XU[ hqV8pMr6Bp-m~g1h1f#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ ̿ЀqO3"T+gf#B4fG&tr\6'.2-w}|qi;TϷe>zb4MS}DNԹBuQwhhN@:~i0ׄ?^n__&;}}|Me1ӕUeUlwB֯wڏ&/msMڧڳ,l}p\c._<8}T/Ͽ=g d2\~S叧Ϫ6y_վXߝðyZ!Bip&%f;mrX#J+|7~Տ/pՑ<<엤\ G s(£pd)<_u?ԩk_G9G'Od%ݸ9-ڙgOp樒O4|UlA/y:X-#1ƁX#B U˥ I0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆq>aD0"@ F#B!ˆaD0FiG 4Mө//?@PxL̿-|: BXRSnPtkBiSo3pɻm.Ϳ<$Զq&.ɻ?{ ̦Is.?B#VzfGP'Pcɲp}1x5pBFp"Ԓ~-9lX5J7 ocޱ͆\I<Ty2޾x4'Y I j>&F @8Ы$@ 帟O_G#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆaD0"@ F#B!ˆa8ч@*"4MS!ѿ\oYǿ\!B@6sDJ%3"T%bc@ cPDN26 %@!:8@!"Y_zewP4( oޓ-9/$B@{&DR3 }Gdf,1x$eb&B @"<D3qmv pMG&!Kpf LBAWS,Q !25ׄXo^~8KӦi/Y "c pqkPDMD1q+wL-Kp TY?|Y;u`WZ&!2Mr]!A,6S%G.kfR32jlF4m~|3fjM^iI/'y$OfG&!^dYڜ鏡윾^+nNMSvzy(_!M;:ص_'j8ײI/6µDr;~קz0Gk "/ol1HQKe^C|`zwUgY58yэC~\ \sEK|t#r!<\raD0" WêpKApaD0"@ F#B!ˆac8^8޶: BT+޽ `90"@ F#B!57?'Dq=:@"D] @* Q!` I6ox'ׄɏ 6"Da^H` X!c6D'$v q#'B|$B\!.fʉ1g0_!~e&BB8 su @Da8Ӓ= >Yq%8Z"Dq @\3n"BXn%B2w!wlL`k@LB+@DPi|ͩx@3^g @ 8 4䞆!wMB (B{=P Pe x#>p 7 P^vuvr_PV2 i$_nr)e:TA$Bu@UPmڎPZMFЇ"dIK2t@ @:B !@j%inx>匿t%>IH~:>'T$%B8:^D0"@ F#B!ˆaD0"@ F2p.$B 4$''`9Ǡ+B CАg98$ԭ'e`sѪgt}A&o_^3LB9O̹~?y[n?zxp<$s4vP~>) 411\!"wf)qrUVXƲ} -! 1l. =!_c]yGsUjPj=Gi=3h2Ozvv>@%IENDB`sdlgfx-2.0.25/Docs/html.doxyfile000066400000000000000000002315651225506657100165150ustar00rootroot00000000000000# Doxyfile 1.8.0 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = SDL_gfx # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 2.0.25 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = . # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. The create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = .. # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.d \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.mm \ *.dox \ *.py \ *.f90 \ *.f \ *.vhd \ *.vhdl \ README # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = .. # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://www.mathjax.org/mathjax # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES sdlgfx-2.0.25/Docs/html/000077500000000000000000000000001225506657100147345ustar00rootroot00000000000000sdlgfx-2.0.25/Docs/html/_r_e_a_d_m_e.html000066400000000000000000000035211225506657100201520ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/README File Reference
I:/Sources/sdlgfx/README File Reference
sdlgfx-2.0.25/Docs/html/_r_e_a_d_m_e_source.html000066400000000000000000000036051225506657100215350ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/README Source File
I:/Sources/sdlgfx/README
sdlgfx-2.0.25/Docs/html/_s_d_l__framerate_8c.html000066400000000000000000000310221225506657100216160ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.c File Reference
I:/Sources/sdlgfx/SDL_framerate.c File Reference
#include "SDL_framerate.h"

Go to the source code of this file.

Functions

Uint32 _getTicks ()
 Internal wrapper to SDL_GetTicks that ensures a non-zero return value.
void SDL_initFramerate (FPSmanager *manager)
 Initialize the framerate manager.
int SDL_setFramerate (FPSmanager *manager, Uint32 rate)
 Set the framerate in Hz.
int SDL_getFramerate (FPSmanager *manager)
 Return the current target framerate in Hz.
int SDL_getFramecount (FPSmanager *manager)
 Return the current framecount.
Uint32 SDL_framerateDelay (FPSmanager *manager)
 Delay execution to maintain a constant framerate and calculate fps.

Function Documentation

Uint32 _getTicks ( )

Internal wrapper to SDL_GetTicks that ensures a non-zero return value.

Returns:
The tick count.

Definition at line 37 of file SDL_framerate.c.

Uint32 SDL_framerateDelay ( FPSmanager manager)

Delay execution to maintain a constant framerate and calculate fps.

Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.

Parameters:
managerPointer to the framerate manager.
Returns:
The time that passed since the last call to the function in ms. May return 0.

Definition at line 146 of file SDL_framerate.c.

int SDL_getFramecount ( FPSmanager manager)

Return the current framecount.

Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.

Parameters:
managerPointer to the framerate manager.
Returns:
Current frame count or -1 for error.

Definition at line 126 of file SDL_framerate.c.

int SDL_getFramerate ( FPSmanager manager)

Return the current target framerate in Hz.

Get the currently set framerate of the manager.

Parameters:
managerPointer to the framerate manager.
Returns:
Current framerate in Hz or -1 for error.

Definition at line 107 of file SDL_framerate.c.

void SDL_initFramerate ( FPSmanager manager)

Initialize the framerate manager.

Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.

Parameters:
managerPointer to the framerate manager.

Definition at line 62 of file SDL_framerate.c.

int SDL_setFramerate ( FPSmanager manager,
Uint32  rate 
)

Set the framerate in Hz.

Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.

Parameters:
managerPointer to the framerate manager.
rateThe new framerate in Hz (frames per second).
Returns:
0 for sucess and -1 for error.

Definition at line 86 of file SDL_framerate.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__framerate_8c_source.html000066400000000000000000000405411225506657100232040ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.c Source File
I:/Sources/sdlgfx/SDL_framerate.c
Go to the documentation of this file.
00001 /*
00002 
00003 SDL_framerate.c: framerate manager
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #include "SDL_framerate.h"
00031 
00037 Uint32 _getTicks()
00038 {
00039         Uint32 ticks = SDL_GetTicks();
00040 
00041         /* 
00042         * Since baseticks!=0 is used to track initialization
00043         * we need to ensure that the tick count is always >0 
00044         * since SDL_GetTicks may not have incremented yet and
00045         * return 0 depending on the timing of the calls.
00046         */
00047         if (ticks == 0) {
00048                 return 1;
00049         } else {
00050                 return ticks;
00051         }
00052 }
00053 
00062 void SDL_initFramerate(FPSmanager * manager)
00063 {
00064         /*
00065         * Store some sane values 
00066         */
00067         manager->framecount = 0;
00068         manager->rate = FPS_DEFAULT;
00069         manager->rateticks = (1000.0f / (float) FPS_DEFAULT);
00070         manager->baseticks = _getTicks();
00071         manager->lastticks = manager->baseticks;
00072 
00073 }
00074 
00086 int SDL_setFramerate(FPSmanager * manager, Uint32 rate)
00087 {
00088         if ((rate >= FPS_LOWER_LIMIT) && (rate <= FPS_UPPER_LIMIT)) {
00089                 manager->framecount = 0;
00090                 manager->rate = rate;
00091                 manager->rateticks = (1000.0f / (float) rate);
00092                 return (0);
00093         } else {
00094                 return (-1);
00095         }
00096 }
00097 
00107 int SDL_getFramerate(FPSmanager * manager)
00108 {
00109         if (manager == NULL) {
00110                 return (-1);
00111         } else {
00112                 return ((int)manager->rate);
00113         }
00114 }
00115 
00126 int SDL_getFramecount(FPSmanager * manager)
00127 {
00128         if (manager == NULL) {
00129                 return (-1);
00130         } else {
00131                 return ((int)manager->framecount);
00132         }
00133 }
00134 
00146 Uint32 SDL_framerateDelay(FPSmanager * manager)
00147 {
00148         Uint32 current_ticks;
00149         Uint32 target_ticks;
00150         Uint32 the_delay;
00151         Uint32 time_passed = 0;
00152 
00153         /*
00154         * No manager, no delay
00155         */
00156         if (manager == NULL) {
00157                 return 0;
00158         }
00159 
00160         /*
00161         * Initialize uninitialized manager 
00162         */
00163         if (manager->baseticks == 0) {
00164                 SDL_initFramerate(manager);
00165         }
00166 
00167         /*
00168         * Next frame 
00169         */
00170         manager->framecount++;
00171 
00172         /*
00173         * Get/calc ticks 
00174         */
00175         current_ticks = _getTicks();
00176         time_passed = current_ticks - manager->lastticks;
00177         manager->lastticks = current_ticks;
00178         target_ticks = manager->baseticks + (Uint32) ((float) manager->framecount * manager->rateticks);
00179 
00180         if (current_ticks <= target_ticks) {
00181                 the_delay = target_ticks - current_ticks;
00182                 SDL_Delay(the_delay);
00183         } else {
00184                 manager->framecount = 0;
00185                 manager->baseticks = _getTicks();
00186         }
00187 
00188         return time_passed;
00189 }
sdlgfx-2.0.25/Docs/html/_s_d_l__framerate_8h.html000066400000000000000000000422761225506657100216400ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.h File Reference
I:/Sources/sdlgfx/SDL_framerate.h File Reference
#include "SDL.h"

Go to the source code of this file.

Data Structures

struct  FPSmanager
 Structure holding the state and timing information of the framerate controller. More...

Defines

#define FPS_UPPER_LIMIT   200
 Highest possible rate supported by framerate controller in Hz (1/s).
#define FPS_LOWER_LIMIT   1
 Lowest possible rate supported by framerate controller in Hz (1/s).
#define FPS_DEFAULT   30
 Default rate of framerate controller in Hz (1/s).
#define SDL_FRAMERATE_SCOPE   extern

Functions

SDL_FRAMERATE_SCOPE void SDL_initFramerate (FPSmanager *manager)
 Initialize the framerate manager.
SDL_FRAMERATE_SCOPE int SDL_setFramerate (FPSmanager *manager, Uint32 rate)
 Set the framerate in Hz.
SDL_FRAMERATE_SCOPE int SDL_getFramerate (FPSmanager *manager)
 Return the current target framerate in Hz.
SDL_FRAMERATE_SCOPE int SDL_getFramecount (FPSmanager *manager)
 Return the current framecount.
SDL_FRAMERATE_SCOPE Uint32 SDL_framerateDelay (FPSmanager *manager)
 Delay execution to maintain a constant framerate and calculate fps.

Define Documentation

#define FPS_DEFAULT   30

Default rate of framerate controller in Hz (1/s).

Definition at line 57 of file SDL_framerate.h.

#define FPS_LOWER_LIMIT   1

Lowest possible rate supported by framerate controller in Hz (1/s).

Definition at line 52 of file SDL_framerate.h.

#define FPS_UPPER_LIMIT   200

Highest possible rate supported by framerate controller in Hz (1/s).

Definition at line 47 of file SDL_framerate.h.

#define SDL_FRAMERATE_SCOPE   extern

Definition at line 82 of file SDL_framerate.h.


Function Documentation

Delay execution to maintain a constant framerate and calculate fps.

Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.

Parameters:
managerPointer to the framerate manager.
Returns:
The time that passed since the last call to the function in ms. May return 0.

Definition at line 146 of file SDL_framerate.c.

Return the current framecount.

Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.

Parameters:
managerPointer to the framerate manager.
Returns:
Current frame count or -1 for error.

Definition at line 126 of file SDL_framerate.c.

Return the current target framerate in Hz.

Get the currently set framerate of the manager.

Parameters:
managerPointer to the framerate manager.
Returns:
Current framerate in Hz or -1 for error.

Definition at line 107 of file SDL_framerate.c.

Initialize the framerate manager.

Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.

Parameters:
managerPointer to the framerate manager.

Definition at line 62 of file SDL_framerate.c.

SDL_FRAMERATE_SCOPE int SDL_setFramerate ( FPSmanager manager,
Uint32  rate 
)

Set the framerate in Hz.

Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.

Parameters:
managerPointer to the framerate manager.
rateThe new framerate in Hz (frames per second).
Returns:
0 for sucess and -1 for error.

Definition at line 86 of file SDL_framerate.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__framerate_8h_source.html000066400000000000000000000310631225506657100232100ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.h Source File
I:/Sources/sdlgfx/SDL_framerate.h
Go to the documentation of this file.
00001 /*
00002 
00003 SDL_framerate.h: framerate manager
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL_framerate_h
00031 #define _SDL_framerate_h
00032 
00033 /* Set up for C function definitions, even when using C++ */
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038         /* --- */
00039 
00040 #include "SDL.h"
00041 
00042         /* --------- Definitions */
00043 
00047 #define FPS_UPPER_LIMIT         200
00048 
00052 #define FPS_LOWER_LIMIT         1
00053 
00057 #define FPS_DEFAULT             30
00058 
00062         typedef struct {
00063                 Uint32 framecount;
00064                 float rateticks;
00065                 Uint32 baseticks;
00066                 Uint32 lastticks;
00067                 Uint32 rate;
00068         } FPSmanager;
00069 
00070         /* ---- Function Prototypes */
00071 
00072 #ifdef _MSC_VER
00073 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
00074 #    define SDL_FRAMERATE_SCOPE __declspec(dllexport)
00075 #  else
00076 #    ifdef LIBSDL_GFX_DLL_IMPORT
00077 #      define SDL_FRAMERATE_SCOPE __declspec(dllimport)
00078 #    endif
00079 #  endif
00080 #endif
00081 #ifndef SDL_FRAMERATE_SCOPE
00082 #  define SDL_FRAMERATE_SCOPE extern
00083 #endif
00084 
00085         /* Functions return 0 or value for sucess and -1 for error */
00086 
00087         SDL_FRAMERATE_SCOPE void SDL_initFramerate(FPSmanager * manager);
00088         SDL_FRAMERATE_SCOPE int SDL_setFramerate(FPSmanager * manager, Uint32 rate);
00089         SDL_FRAMERATE_SCOPE int SDL_getFramerate(FPSmanager * manager);
00090         SDL_FRAMERATE_SCOPE int SDL_getFramecount(FPSmanager * manager);
00091         SDL_FRAMERATE_SCOPE Uint32 SDL_framerateDelay(FPSmanager * manager);
00092 
00093         /* --- */
00094 
00095         /* Ends C function definitions when using C++ */
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 
00100 #endif                          /* _SDL_framerate_h */
sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_blit_func_8c.html000066400000000000000000000354331225506657100224730ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.c File Reference
I:/Sources/sdlgfx/SDL_gfxBlitFunc.c File Reference
#include "SDL_gfxBlitFunc.h"

Go to the source code of this file.

Functions

void _SDL_gfxBlitBlitterRGBA (SDL_gfxBlitInfo *info)
 Internal blitter using adjusted destination alpha during RGBA->RGBA blits.
int _SDL_gfxBlitRGBACall (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 Internal blitter setup wrapper for RGBA->RGBA blits.
int SDL_gfxBlitRGBA (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 Blitter for RGBA->RGBA blits with alpha adjustment.
int SDL_gfxSetAlpha (SDL_Surface *src, Uint8 a)
 Sets the alpha channel in a 32 bit surface.
int SDL_gfxMultiplyAlpha (SDL_Surface *src, Uint8 a)
 Multiply the alpha channel in a 32bit surface.

Variables

const unsigned int GFX_ALPHA_ADJUST_ARRAY [256]
 Alpha adjustment table for custom blitter.

Function Documentation

Internal blitter using adjusted destination alpha during RGBA->RGBA blits.

Performs the blit based on the 'info' structure and applies the transfer function to the destination 'a' values.

Parameters:
infoThe blit info to use.

Definition at line 306 of file SDL_gfxBlitFunc.c.

int _SDL_gfxBlitRGBACall ( SDL_Surface *  src,
SDL_Rect *  srcrect,
SDL_Surface *  dst,
SDL_Rect *  dstrect 
)

Internal blitter setup wrapper for RGBA->RGBA blits.

Sets up the blitter info based on the 'src' and 'dst' surfaces and rectangles.

Parameters:
srcThe source surface.
srcrectThe source rectangle.
dstThe destination surface.
dstrectThe destination rectangle.
Returns:
Returns 1 if blit was performed, 0 otherwise.

Definition at line 356 of file SDL_gfxBlitFunc.c.

int SDL_gfxBlitRGBA ( SDL_Surface *  src,
SDL_Rect *  srcrect,
SDL_Surface *  dst,
SDL_Rect *  dstrect 
)

Blitter for RGBA->RGBA blits with alpha adjustment.

Verifies the input 'src' and 'dst' surfaces and rectangles and performs blit. The destination clip rectangle is honored.

Parameters:
srcThe source surface.
srcrectThe source rectangle.
dstThe destination surface.
dstrectThe destination rectangle.
Returns:
Returns 1 if blit was performed, 0 otherwise, or -1 if an error occured.

Definition at line 411 of file SDL_gfxBlitFunc.c.

int SDL_gfxMultiplyAlpha ( SDL_Surface *  src,
Uint8  a 
)

Multiply the alpha channel in a 32bit surface.

Helper function that multiplies the alpha channel in a 32 bit surface with a constant value. The final alpha is always scaled to the range 0-255 (i.e. the factor is a/256).

Only 32 bit surfaces can be used with this function.

Parameters:
srcPointer to the target surface to change.
aThe alpha value to multiply with. When a is 255, this function is a NoOp.
Returns:
Returns 1 if alpha was changed, 0 otherwise. Returns -1 if input surface is invalid.

Definition at line 587 of file SDL_gfxBlitFunc.c.

int SDL_gfxSetAlpha ( SDL_Surface *  src,
Uint8  a 
)

Sets the alpha channel in a 32 bit surface.

Helper function that sets the alpha channel in a 32 bit surface to a constant value. Only 32 bit surfaces can be used with this function.

Parameters:
srcPointer to the target surface to change.
aThe alpha value to set.
Returns:
Returns 1 if alpha was changed, -1 otherwise.

Definition at line 524 of file SDL_gfxBlitFunc.c.


Variable Documentation

const unsigned int GFX_ALPHA_ADJUST_ARRAY[256]

Alpha adjustment table for custom blitter.

The table provides values for a modified, non-linear transfer function which maintain brightness.

Definition at line 39 of file SDL_gfxBlitFunc.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_blit_func_8c_source.html000066400000000000000000001446241225506657100240560ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.c Source File
I:/Sources/sdlgfx/SDL_gfxBlitFunc.c
Go to the documentation of this file.
00001 /* 
00002 
00003 SDL_gfxBlitFunc.c: custom blitters
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #include "SDL_gfxBlitFunc.h"
00031 
00039 const unsigned int GFX_ALPHA_ADJUST_ARRAY[256] = {
00040         0,  /* 0 */
00041         15,  /* 1 */
00042         22,  /* 2 */
00043         27,  /* 3 */
00044         31,  /* 4 */
00045         35,  /* 5 */
00046         39,  /* 6 */
00047         42,  /* 7 */
00048         45,  /* 8 */
00049         47,  /* 9 */
00050         50,  /* 10 */
00051         52,  /* 11 */
00052         55,  /* 12 */
00053         57,  /* 13 */
00054         59,  /* 14 */
00055         61,  /* 15 */
00056         63,  /* 16 */
00057         65,  /* 17 */
00058         67,  /* 18 */
00059         69,  /* 19 */
00060         71,  /* 20 */
00061         73,  /* 21 */
00062         74,  /* 22 */
00063         76,  /* 23 */
00064         78,  /* 24 */
00065         79,  /* 25 */
00066         81,  /* 26 */
00067         82,  /* 27 */
00068         84,  /* 28 */
00069         85,  /* 29 */
00070         87,  /* 30 */
00071         88,  /* 31 */
00072         90,  /* 32 */
00073         91,  /* 33 */
00074         93,  /* 34 */
00075         94,  /* 35 */
00076         95,  /* 36 */
00077         97,  /* 37 */
00078         98,  /* 38 */
00079         99,  /* 39 */
00080         100,  /* 40 */
00081         102,  /* 41 */
00082         103,  /* 42 */
00083         104,  /* 43 */
00084         105,  /* 44 */
00085         107,  /* 45 */
00086         108,  /* 46 */
00087         109,  /* 47 */
00088         110,  /* 48 */
00089         111,  /* 49 */
00090         112,  /* 50 */
00091         114,  /* 51 */
00092         115,  /* 52 */
00093         116,  /* 53 */
00094         117,  /* 54 */
00095         118,  /* 55 */
00096         119,  /* 56 */
00097         120,  /* 57 */
00098         121,  /* 58 */
00099         122,  /* 59 */
00100         123,  /* 60 */
00101         124,  /* 61 */
00102         125,  /* 62 */
00103         126,  /* 63 */
00104         127,  /* 64 */
00105         128,  /* 65 */
00106         129,  /* 66 */
00107         130,  /* 67 */
00108         131,  /* 68 */
00109         132,  /* 69 */
00110         133,  /* 70 */
00111         134,  /* 71 */
00112         135,  /* 72 */
00113         136,  /* 73 */
00114         137,  /* 74 */
00115         138,  /* 75 */
00116         139,  /* 76 */
00117         140,  /* 77 */
00118         141,  /* 78 */
00119         141,  /* 79 */
00120         142,  /* 80 */
00121         143,  /* 81 */
00122         144,  /* 82 */
00123         145,  /* 83 */
00124         146,  /* 84 */
00125         147,  /* 85 */
00126         148,  /* 86 */
00127         148,  /* 87 */
00128         149,  /* 88 */
00129         150,  /* 89 */
00130         151,  /* 90 */
00131         152,  /* 91 */
00132         153,  /* 92 */
00133         153,  /* 93 */
00134         154,  /* 94 */
00135         155,  /* 95 */
00136         156,  /* 96 */
00137         157,  /* 97 */
00138         158,  /* 98 */
00139         158,  /* 99 */
00140         159,  /* 100 */
00141         160,  /* 101 */
00142         161,  /* 102 */
00143         162,  /* 103 */
00144         162,  /* 104 */
00145         163,  /* 105 */
00146         164,  /* 106 */
00147         165,  /* 107 */
00148         165,  /* 108 */
00149         166,  /* 109 */
00150         167,  /* 110 */
00151         168,  /* 111 */
00152         168,  /* 112 */
00153         169,  /* 113 */
00154         170,  /* 114 */
00155         171,  /* 115 */
00156         171,  /* 116 */
00157         172,  /* 117 */
00158         173,  /* 118 */
00159         174,  /* 119 */
00160         174,  /* 120 */
00161         175,  /* 121 */
00162         176,  /* 122 */
00163         177,  /* 123 */
00164         177,  /* 124 */
00165         178,  /* 125 */
00166         179,  /* 126 */
00167         179,  /* 127 */
00168         180,  /* 128 */
00169         181,  /* 129 */
00170         182,  /* 130 */
00171         182,  /* 131 */
00172         183,  /* 132 */
00173         184,  /* 133 */
00174         184,  /* 134 */
00175         185,  /* 135 */
00176         186,  /* 136 */
00177         186,  /* 137 */
00178         187,  /* 138 */
00179         188,  /* 139 */
00180         188,  /* 140 */
00181         189,  /* 141 */
00182         190,  /* 142 */
00183         190,  /* 143 */
00184         191,  /* 144 */
00185         192,  /* 145 */
00186         192,  /* 146 */
00187         193,  /* 147 */
00188         194,  /* 148 */
00189         194,  /* 149 */
00190         195,  /* 150 */
00191         196,  /* 151 */
00192         196,  /* 152 */
00193         197,  /* 153 */
00194         198,  /* 154 */
00195         198,  /* 155 */
00196         199,  /* 156 */
00197         200,  /* 157 */
00198         200,  /* 158 */
00199         201,  /* 159 */
00200         201,  /* 160 */
00201         202,  /* 161 */
00202         203,  /* 162 */
00203         203,  /* 163 */
00204         204,  /* 164 */
00205         205,  /* 165 */
00206         205,  /* 166 */
00207         206,  /* 167 */
00208         206,  /* 168 */
00209         207,  /* 169 */
00210         208,  /* 170 */
00211         208,  /* 171 */
00212         209,  /* 172 */
00213         210,  /* 173 */
00214         210,  /* 174 */
00215         211,  /* 175 */
00216         211,  /* 176 */
00217         212,  /* 177 */
00218         213,  /* 178 */
00219         213,  /* 179 */
00220         214,  /* 180 */
00221         214,  /* 181 */
00222         215,  /* 182 */
00223         216,  /* 183 */
00224         216,  /* 184 */
00225         217,  /* 185 */
00226         217,  /* 186 */
00227         218,  /* 187 */
00228         218,  /* 188 */
00229         219,  /* 189 */
00230         220,  /* 190 */
00231         220,  /* 191 */
00232         221,  /* 192 */
00233         221,  /* 193 */
00234         222,  /* 194 */
00235         222,  /* 195 */
00236         223,  /* 196 */
00237         224,  /* 197 */
00238         224,  /* 198 */
00239         225,  /* 199 */
00240         225,  /* 200 */
00241         226,  /* 201 */
00242         226,  /* 202 */
00243         227,  /* 203 */
00244         228,  /* 204 */
00245         228,  /* 205 */
00246         229,  /* 206 */
00247         229,  /* 207 */
00248         230,  /* 208 */
00249         230,  /* 209 */
00250         231,  /* 210 */
00251         231,  /* 211 */
00252         232,  /* 212 */
00253         233,  /* 213 */
00254         233,  /* 214 */
00255         234,  /* 215 */
00256         234,  /* 216 */
00257         235,  /* 217 */
00258         235,  /* 218 */
00259         236,  /* 219 */
00260         236,  /* 220 */
00261         237,  /* 221 */
00262         237,  /* 222 */
00263         238,  /* 223 */
00264         238,  /* 224 */
00265         239,  /* 225 */
00266         240,  /* 226 */
00267         240,  /* 227 */
00268         241,  /* 228 */
00269         241,  /* 229 */
00270         242,  /* 230 */
00271         242,  /* 231 */
00272         243,  /* 232 */
00273         243,  /* 233 */
00274         244,  /* 234 */
00275         244,  /* 235 */
00276         245,  /* 236 */
00277         245,  /* 237 */
00278         246,  /* 238 */
00279         246,  /* 239 */
00280         247,  /* 240 */
00281         247,  /* 241 */
00282         248,  /* 242 */
00283         248,  /* 243 */
00284         249,  /* 244 */
00285         249,  /* 245 */
00286         250,  /* 246 */
00287         250,  /* 247 */
00288         251,  /* 248 */
00289         251,  /* 249 */
00290         252,  /* 250 */
00291         252,  /* 251 */
00292         253,  /* 252 */
00293         253,  /* 253 */
00294         254,  /* 254 */
00295         255   /* 255 */
00296 };
00297 
00306 void _SDL_gfxBlitBlitterRGBA(SDL_gfxBlitInfo * info)
00307 {
00308         int       width = info->d_width;
00309         int       height = info->d_height;
00310         Uint8    *src = info->s_pixels;
00311         int       srcskip = info->s_skip;
00312         Uint8    *dst = info->d_pixels;
00313         int       dstskip = info->d_skip;
00314         SDL_PixelFormat *srcfmt = info->src;
00315         SDL_PixelFormat *dstfmt = info->dst;
00316         Uint8       srcbpp = srcfmt->BytesPerPixel;
00317         Uint8       dstbpp = dstfmt->BytesPerPixel;
00318 
00319         while (height--) {
00320                 GFX_DUFFS_LOOP4( {
00321                         Uint32 pixel;
00322                         unsigned sR;
00323                         unsigned sG;
00324                         unsigned sB;
00325                         unsigned sA;
00326                         unsigned dR;
00327                         unsigned dG;
00328                         unsigned dB;
00329                         unsigned dA;
00330                         unsigned sAA;
00331                         GFX_DISASSEMBLE_RGBA(src, srcbpp, srcfmt, pixel, sR, sG, sB, sA);
00332                         GFX_DISASSEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
00333                         sAA=GFX_ALPHA_ADJUST_ARRAY[sA & 255];
00334                         GFX_ALPHA_BLEND(sR, sG, sB, sAA, dR, dG, dB);
00335                         dA |= sAA;
00336                         GFX_ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
00337                         src += srcbpp; dst += dstbpp;
00338                 }, width);
00339                 src += srcskip;
00340                 dst += dstskip;
00341         }
00342 }
00343 
00356 int _SDL_gfxBlitRGBACall(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
00357 {
00358         /*
00359         * Set up source and destination buffer pointers, then blit 
00360         */
00361         if (srcrect->w && srcrect->h) {
00362                 SDL_gfxBlitInfo info;
00363 
00364                 /*
00365                 * Set up the blit information 
00366                 */
00367 #if (SDL_MINOR_VERSION == 3)
00368                 info.s_pixels = (Uint8 *) src->pixels               + (Uint16) srcrect->y * src->pitch + (Uint16) srcrect->x * src->format->BytesPerPixel;
00369 #else
00370                 info.s_pixels = (Uint8 *) src->pixels + src->offset + (Uint16) srcrect->y * src->pitch + (Uint16) srcrect->x * src->format->BytesPerPixel;
00371 #endif
00372                 info.s_width = srcrect->w;
00373                 info.s_height = srcrect->h;
00374                 info.s_skip = (int)(src->pitch - info.s_width * src->format->BytesPerPixel);
00375 #if (SDL_MINOR_VERSION == 3)
00376                 info.d_pixels = (Uint8 *) dst->pixels               + (Uint16) dstrect->y * dst->pitch + (Uint16) dstrect->x * dst->format->BytesPerPixel;
00377 #else
00378                 info.d_pixels = (Uint8 *) dst->pixels + dst->offset + (Uint16) dstrect->y * dst->pitch + (Uint16) dstrect->x * dst->format->BytesPerPixel;
00379 #endif
00380                 info.d_width = dstrect->w;
00381                 info.d_height = dstrect->h;
00382                 info.d_skip = (int)(dst->pitch - info.d_width * dst->format->BytesPerPixel);
00383                 info.aux_data = NULL;
00384                 info.src = src->format;
00385                 info.table = NULL;
00386                 info.dst = dst->format;
00387 
00388                 /*
00389                 * Run the actual software blitter 
00390                 */
00391                 _SDL_gfxBlitBlitterRGBA(&info);
00392                 return 1;
00393         }
00394 
00395         return (0);
00396 }
00397 
00411 int SDL_gfxBlitRGBA(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
00412 {
00413         SDL_Rect  sr, dr;
00414         int       srcx, srcy, w, h;
00415 
00416         /*
00417         * Make sure the surfaces aren't locked 
00418         */
00419         if (!src || !dst) {
00420                 SDL_SetError("SDL_UpperBlit: passed a NULL surface");
00421                 return (-1);
00422         }
00423         if ((src->locked) || (dst->locked)) {
00424                 SDL_SetError("Surfaces must not be locked during blit");
00425                 return (-1);
00426         }
00427 
00428         /*
00429         * If the destination rectangle is NULL, use the entire dest surface 
00430         */
00431         if (dstrect == NULL) {
00432                 dr.x = dr.y = 0;
00433                 dr.w = dst->w;
00434                 dr.h = dst->h;
00435         } else {
00436                 dr = *dstrect;
00437         }
00438 
00439         /*
00440         * Clip the source rectangle to the source surface 
00441         */
00442         if (srcrect) {
00443                 int       maxw, maxh;
00444 
00445                 srcx = srcrect->x;
00446                 w = srcrect->w;
00447                 if (srcx < 0) {
00448                         w += srcx;
00449                         dr.x -= srcx;
00450                         srcx = 0;
00451                 }
00452                 maxw = src->w - srcx;
00453                 if (maxw < w)
00454                         w = maxw;
00455 
00456                 srcy = srcrect->y;
00457                 h = srcrect->h;
00458                 if (srcy < 0) {
00459                         h += srcy;
00460                         dr.y -= srcy;
00461                         srcy = 0;
00462                 }
00463                 maxh = src->h - srcy;
00464                 if (maxh < h)
00465                         h = maxh;
00466 
00467         } else {
00468                 srcx = srcy = 0;
00469                 w = src->w;
00470                 h = src->h;
00471         }
00472 
00473         /*
00474         * Clip the destination rectangle against the clip rectangle 
00475         */
00476         {
00477                 SDL_Rect *clip = &dst->clip_rect;
00478                 int       dx, dy;
00479 
00480                 dx = clip->x - dr.x;
00481                 if (dx > 0) {
00482                         w -= dx;
00483                         dr.x += dx;
00484                         srcx += dx;
00485                 }
00486                 dx = dr.x + w - clip->x - clip->w;
00487                 if (dx > 0)
00488                         w -= dx;
00489 
00490                 dy = clip->y - dr.y;
00491                 if (dy > 0) {
00492                         h -= dy;
00493                         dr.y += dy;
00494                         srcy += dy;
00495                 }
00496                 dy = dr.y + h - clip->y - clip->h;
00497                 if (dy > 0)
00498                         h -= dy;
00499         }
00500 
00501         if (w > 0 && h > 0) {
00502                 sr.x = srcx;
00503                 sr.y = srcy;
00504                 sr.w = dr.w = w;
00505                 sr.h = dr.h = h;
00506                 return (_SDL_gfxBlitRGBACall(src, &sr, dst, &dr));
00507         }
00508 
00509         return 0;
00510 }
00511 
00524 int SDL_gfxSetAlpha(SDL_Surface *src, Uint8 a)
00525 {
00526 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
00527         const int alpha_offset = 0;
00528 #else
00529         const int alpha_offset = 3;
00530 #endif
00531         int i, j, row_skip;
00532         Uint8 *pixels;
00533 
00534         /* Check if we have a 32bit surface */
00535         if ( (src==NULL) || 
00536                 (src->format==NULL) || 
00537                 (src->format->BytesPerPixel!=4) ) {
00538                         SDL_SetError("SDL_gfxSetAlpha: Invalid input surface.");
00539                         return -1;
00540         }
00541 
00542         /*
00543         * Lock the surface 
00544         */
00545         if (SDL_MUSTLOCK(src)) {
00546                 if (SDL_LockSurface(src) < 0) {
00547                         return (-1);
00548                 }
00549         }
00550 
00551         /* Process */
00552         pixels = (Uint8 *)src->pixels;
00553         row_skip = (src->pitch - (4*src->w));
00554         pixels += alpha_offset;
00555         for ( i=0; i<src->h; i++ ) {
00556                 for ( j=0; j<src->w; j++  ) {
00557                         *pixels = a; 
00558                         pixels += 4;
00559                 }
00560                 pixels += row_skip;
00561         }
00562 
00563         /*
00564         * Unlock surface 
00565         */
00566         if (SDL_MUSTLOCK(src)) {
00567                 SDL_UnlockSurface(src);
00568         }
00569 
00570         return 1; 
00571 }
00572 
00587 int SDL_gfxMultiplyAlpha(SDL_Surface *src, Uint8 a)
00588 {
00589 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
00590         const int alpha_offset = 0;
00591 #else
00592         const int alpha_offset = 3;
00593 #endif
00594         int i, j, row_skip;
00595         Uint8 *pixels;
00596 
00597         /* Check if we have a 32bit surface */
00598         if ( (src==NULL) || 
00599                 (src->format==NULL) || 
00600                 (src->format->BytesPerPixel!=4) ) {
00601                         SDL_SetError("SDL_gfxMultiplyAlpha: Invalid input surface.");
00602                         return -1;
00603         }
00604 
00605         /* Check if multiplication is needed */
00606         if (a==255) {
00607                 return 0;
00608         }
00609 
00610         /*
00611         * Lock the surface 
00612         */
00613         if (SDL_MUSTLOCK(src)) {
00614                 if (SDL_LockSurface(src) < 0) {
00615                         return (-1);
00616                 }
00617         }
00618 
00619         /* Process */
00620         pixels = (Uint8 *)src->pixels;
00621         row_skip = (src->pitch - (4*src->w));
00622         pixels += alpha_offset;
00623         for ( i=0; i<src->h; i++ ) {
00624                 for ( j=0; j<src->w; j++  ) {
00625                         *pixels = (Uint8)(((int)(*pixels)*a)>>8);
00626                         pixels += 4;
00627                 }
00628                 pixels += row_skip;
00629         }
00630 
00631         /*
00632         * Unlock surface 
00633         */
00634         if (SDL_MUSTLOCK(src)) {
00635                 SDL_UnlockSurface(src);
00636         }
00637 
00638         return 1;
00639 }
sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_blit_func_8h.html000066400000000000000000000725001225506657100224740ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.h File Reference
I:/Sources/sdlgfx/SDL_gfxBlitFunc.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
#include "SDL_video.h"

Go to the source code of this file.

Data Structures

struct  SDL_gfxBlitInfo
 The structure passed to the low level blit functions. More...

Defines

#define SDL_GFXBLITFUNC_SCOPE   extern
#define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a)
 Unwrap RGBA values from a pixel using mask, shift and loss for surface.
#define GFX_DISASSEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a)
 Disassemble buffer pointer into a pixel and separate RGBA values.
#define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a)
 Wrap a pixel from RGBA values using mask, shift and loss for surface.
#define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
 Assemble pixel into buffer pointer from separate RGBA values.
#define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)
 Blend the RGB values of two pixels based on a source alpha value.
#define GFX_DUFFS_LOOP4(pixel_copy_increment, width)
 4-times unrolled DUFFs loop.

Functions

SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
 Blitter for RGBA->RGBA blits with alpha adjustment.
SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha (SDL_Surface *src, Uint8 a)
 Sets the alpha channel in a 32 bit surface.
SDL_GFXBLITFUNC_SCOPE int SDL_gfxMultiplyAlpha (SDL_Surface *src, Uint8 a)
 Multiply the alpha channel in a 32bit surface.

Variables

const unsigned int GFX_ALPHA_ADJUST_ARRAY [256]
 Alpha adjustment table for custom blitter.

Define Documentation

#define GFX_ALPHA_BLEND (   sR,
  sG,
  sB,
  A,
  dR,
  dG,
  dB 
)
Value:
do {                                            \
        dR = (((sR-dR)*(A))/255)+dR;            \
        dG = (((sG-dG)*(A))/255)+dG;            \
        dB = (((sB-dB)*(A))/255)+dB;            \
        } while(0)

Blend the RGB values of two pixels based on a source alpha value.

Definition at line 138 of file SDL_gfxBlitFunc.h.

#define GFX_ASSEMBLE_RGBA (   buf,
  bpp,
  fmt,
  r,
  g,
  b,
 
)
Value:
{                                                                       \
        Uint32 pixel;                                   \
	\
	GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);   \
        *((Uint32 *)(buf)) = pixel;                     \
        }

Assemble pixel into buffer pointer from separate RGBA values.

Definition at line 127 of file SDL_gfxBlitFunc.h.

#define GFX_DISASSEMBLE_RGBA (   buf,
  bpp,
  fmt,
  pixel,
  r,
  g,
  b,
 
)
Value:
do {                                                                       \
        pixel = *((Uint32 *)(buf));                                        \
        GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a);                       \
        pixel &= ~fmt->Amask;                                              \
        } while(0)

Disassemble buffer pointer into a pixel and separate RGBA values.

Definition at line 106 of file SDL_gfxBlitFunc.h.

#define GFX_DUFFS_LOOP4 (   pixel_copy_increment,
  width 
)
Value:
{ int n = (width+3)/4;                                                  \
        switch (width & 3) {                                            \
        case 0: do {    pixel_copy_increment;                           \
        case 3:         pixel_copy_increment;                           \
        case 2:         pixel_copy_increment;                           \
        case 1:         pixel_copy_increment;                           \
        } while ( --n > 0 );                                    \
        }                                                               \
        }

4-times unrolled DUFFs loop.

This is a very useful loop for optimizing blitters.

Definition at line 150 of file SDL_gfxBlitFunc.h.

#define GFX_PIXEL_FROM_RGBA (   pixel,
  fmt,
  r,
  g,
  b,
 
)
Value:
{                                                                       \
        pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|                         \
        ((g>>fmt->Gloss)<<fmt->Gshift)|                         \
        ((b>>fmt->Bloss)<<fmt->Bshift)|                         \
        ((a<<fmt->Aloss)<<fmt->Ashift);                         \
        }

Wrap a pixel from RGBA values using mask, shift and loss for surface.

Definition at line 116 of file SDL_gfxBlitFunc.h.

#define GFX_RGBA_FROM_PIXEL (   pixel,
  fmt,
  r,
  g,
  b,
 
)
Value:
{                                                                       \
        r = ((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss;              \
        g = ((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss;              \
        b = ((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss;              \
        a = ((pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;              \
        }

Unwrap RGBA values from a pixel using mask, shift and loss for surface.

Definition at line 95 of file SDL_gfxBlitFunc.h.

#define SDL_GFXBLITFUNC_SCOPE   extern

Definition at line 59 of file SDL_gfxBlitFunc.h.


Function Documentation

SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA ( SDL_Surface *  src,
SDL_Rect *  srcrect,
SDL_Surface *  dst,
SDL_Rect *  dstrect 
)

Blitter for RGBA->RGBA blits with alpha adjustment.

Verifies the input 'src' and 'dst' surfaces and rectangles and performs blit. The destination clip rectangle is honored.

Parameters:
srcThe source surface.
srcrectThe source rectangle.
dstThe destination surface.
dstrectThe destination rectangle.
Returns:
Returns 1 if blit was performed, 0 otherwise, or -1 if an error occured.

Definition at line 411 of file SDL_gfxBlitFunc.c.

SDL_GFXBLITFUNC_SCOPE int SDL_gfxMultiplyAlpha ( SDL_Surface *  src,
Uint8  a 
)

Multiply the alpha channel in a 32bit surface.

Helper function that multiplies the alpha channel in a 32 bit surface with a constant value. The final alpha is always scaled to the range 0-255 (i.e. the factor is a/256).

Only 32 bit surfaces can be used with this function.

Parameters:
srcPointer to the target surface to change.
aThe alpha value to multiply with. When a is 255, this function is a NoOp.
Returns:
Returns 1 if alpha was changed, 0 otherwise. Returns -1 if input surface is invalid.

Definition at line 587 of file SDL_gfxBlitFunc.c.

SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha ( SDL_Surface *  src,
Uint8  a 
)

Sets the alpha channel in a 32 bit surface.

Helper function that sets the alpha channel in a 32 bit surface to a constant value. Only 32 bit surfaces can be used with this function.

Parameters:
srcPointer to the target surface to change.
aThe alpha value to set.
Returns:
Returns 1 if alpha was changed, -1 otherwise.

Definition at line 524 of file SDL_gfxBlitFunc.c.


Variable Documentation

const unsigned int GFX_ALPHA_ADJUST_ARRAY[256]

Alpha adjustment table for custom blitter.

The table provides values for a modified, non-linear transfer function which maintain brightness.

Definition at line 39 of file SDL_gfxBlitFunc.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_blit_func_8h_source.html000066400000000000000000000471541225506657100240630ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxBlitFunc.h Source File
I:/Sources/sdlgfx/SDL_gfxBlitFunc.h
Go to the documentation of this file.
00001 /* 
00002 
00003 SDL_gfxBlitFunc.h: custom blitters
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL_gfxBlitFunc_h
00031 #define _SDL_gfxBlitFunc_h
00032 
00033 /* Set up for C function definitions, even when using C++ */
00034 #ifdef __cplusplus
00035 extern    "C" {
00036 #endif
00037 
00038 #include <stdio.h>
00039 #include <stdlib.h>
00040 
00041 #include "SDL.h"
00042 #include "SDL_video.h"
00043 
00044 
00045         extern const unsigned int GFX_ALPHA_ADJUST_ARRAY[256];
00046 
00047         /* ---- Function Prototypes */
00048 
00049 #ifdef _MSC_VER
00050 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
00051 #    define SDL_GFXBLITFUNC_SCOPE __declspec(dllexport)
00052 #  else
00053 #    ifdef LIBSDL_GFX_DLL_IMPORT
00054 #      define SDL_GFXBLITFUNC_SCOPE __declspec(dllimport)
00055 #    endif
00056 #  endif
00057 #endif
00058 #ifndef SDL_GFXBLITFUNC_SCOPE
00059 #  define SDL_GFXBLITFUNC_SCOPE extern
00060 #endif
00061 
00062 
00063         SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect);
00064 
00065         SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha(SDL_Surface * src, Uint8 a);
00066 
00067         SDL_GFXBLITFUNC_SCOPE int SDL_gfxMultiplyAlpha(SDL_Surface * src, Uint8 a);
00068 
00069         /* -------- Macros */
00070 
00071         /* Define SDL macros locally as a substitute for an #include "SDL_blit.h", */
00072         /* which doesn't work since the include file doesn't get installed.       */
00073 
00077         typedef struct {
00078                 Uint8    *s_pixels;
00079                 int       s_width;
00080                 int       s_height;
00081                 int       s_skip;
00082                 Uint8    *d_pixels;
00083                 int       d_width;
00084                 int       d_height;
00085                 int       d_skip;
00086                 void     *aux_data;
00087                 SDL_PixelFormat *src;
00088                 Uint8    *table;
00089                 SDL_PixelFormat *dst;
00090         } SDL_gfxBlitInfo;
00091 
00095 #define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a)                             \
00096         {                                                                       \
00097         r = ((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss;              \
00098         g = ((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss;              \
00099         b = ((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss;              \
00100         a = ((pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;              \
00101         }
00102 
00106 #define GFX_DISASSEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a)                     \
00107         do {                                                                       \
00108         pixel = *((Uint32 *)(buf));                                        \
00109         GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a);                       \
00110         pixel &= ~fmt->Amask;                                              \
00111         } while(0)
00112 
00116 #define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a)                             \
00117         {                                                                       \
00118         pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|                         \
00119         ((g>>fmt->Gloss)<<fmt->Gshift)|                         \
00120         ((b>>fmt->Bloss)<<fmt->Bshift)|                         \
00121         ((a<<fmt->Aloss)<<fmt->Ashift);                         \
00122         }
00123 
00127 #define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)                    \
00128         {                                                                       \
00129         Uint32 pixel;                                   \
00130         \
00131         GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);    \
00132         *((Uint32 *)(buf)) = pixel;                     \
00133         }
00134 
00138 #define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)      \
00139         do {                                            \
00140         dR = (((sR-dR)*(A))/255)+dR;            \
00141         dG = (((sG-dG)*(A))/255)+dG;            \
00142         dB = (((sB-dB)*(A))/255)+dB;            \
00143         } while(0)
00144 
00150 #define GFX_DUFFS_LOOP4(pixel_copy_increment, width)                    \
00151         { int n = (width+3)/4;                                                  \
00152         switch (width & 3) {                                            \
00153         case 0: do {    pixel_copy_increment;                           \
00154         case 3:         pixel_copy_increment;                           \
00155         case 2:         pixel_copy_increment;                           \
00156         case 1:         pixel_copy_increment;                           \
00157         } while ( --n > 0 );                                    \
00158         }                                                               \
00159         }
00160 
00161 
00162 
00163         /* Ends C function definitions when using C++ */
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167 
00168 #endif /* _SDL_gfxBlitFunc_h */
sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_primitives_8c.html000066400000000000000000011600451225506657100227200ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.c File Reference
I:/Sources/sdlgfx/SDL_gfxPrimitives.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_rotozoom.h"
#include "SDL_gfxPrimitives_font.h"
#include "SDL_gfxBlitFunc.h"

Go to the source code of this file.

Data Structures

struct  SDL_gfxBresenhamIterator
 The structure passed to the internal Bresenham iterator. More...
struct  SDL_gfxMurphyIterator
 The structure passed to the internal Murphy iterator. More...

Defines

#define DEFAULT_ALPHA_PIXEL_ROUTINE
#define ALPHA_PIXEL_ADDITIVE_BLEND
#define clip_xmin(surface)   surface->clip_rect.x
#define clip_xmax(surface)   surface->clip_rect.x+surface->clip_rect.w-1
#define clip_ymin(surface)   surface->clip_rect.y
#define clip_ymax(surface)   surface->clip_rect.y+surface->clip_rect.h-1
#define CLIP_LEFT_EDGE   0x1
#define CLIP_RIGHT_EDGE   0x2
#define CLIP_BOTTOM_EDGE   0x4
#define CLIP_TOP_EDGE   0x8
#define CLIP_INSIDE(a)   (!a)
#define CLIP_REJECT(a, b)   (a&b)
#define CLIP_ACCEPT(a, b)   (!(a|b))
#define ABS(a)   (((a)<0) ? -(a) : (a))
#define AAlevels   256
#define AAbits   8
#define HYPOT(x, y)   sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))

Functions

int fastPixelColorNolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Internal pixel drawing - fast, no blending, no locking, clipping.
int fastPixelColorNolockNoclip (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Internal pixel drawing - fast, no blending, no locking, no clipping.
int fastPixelColor (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Internal pixel drawing - fast, no blending, locking, clipping.
int fastPixelRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Internal pixel drawing - fast, no blending, locking, RGB input.
int fastPixelRGBANolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Internal pixel drawing - fast, no blending, no locking RGB input.
int _putPixelAlpha (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)
 Internal pixel drawing function with alpha blending where input color in in destination format.
int pixelColor (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Pixel draw with blending enabled if a<255.
int pixelColorNolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Pixel draw with blending enabled if a<255 - no surface locking.
int _filledRectAlpha (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha)
 Internal function to draw filled rectangle with alpha blending.
int filledRectAlpha (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw filled rectangle of RGBA color with alpha blending.
int _HLineAlpha (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Internal function to draw horizontal line of RGBA color with alpha blending.
int _VLineAlpha (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Internal function to draw vertical line of RGBA color with alpha blending.
int pixelColorWeight (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
 Pixel draw with blending enabled and using alpha weight on color.
int pixelColorWeightNolock (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
 Pixel draw with blending enabled and using alpha weight on color - no locking.
int pixelRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Pixel draw with blending enabled if a<255.
int hlineColorStore (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line without blending;.
int hlineRGBAStore (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line without blending.
int hlineColor (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line with blending.
int hlineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line with blending.
int vlineColor (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Draw vertical line with blending.
int vlineRGBA (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw vertical line with blending.
int rectangleColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw rectangle with blending.
int rectangleRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rectangle with blending.
int roundedRectangleColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner rectangle with blending.
int roundedRectangleRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner rectangle with blending.
int roundedBoxColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner box (filled rectangle) with blending.
int roundedBoxRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner box (filled rectangle) with blending.
int boxColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw box (filled rectangle) with blending.
int boxRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw box (filled rectangle) with blending.
int lineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw line with alpha blending.
int lineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw line with alpha blending.
int _aalineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, int draw_endpoint)
 Internal function to draw anti-aliased line with alpha blending and endpoint control.
int aalineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Ddraw anti-aliased line with alpha blending.
int aalineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased line with alpha blending.
int circleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw circle with blending.
int circleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw circle with blending.
int arcColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Arc with blending.
int arcRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Arc with blending.
int aacircleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw anti-aliased circle with blending.
int aacircleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased circle with blending.
int filledCircleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw filled circle with blending.
int filledCircleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled circle with blending.
int ellipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw ellipse with blending.
int ellipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw ellipse with blending.
int aaellipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw anti-aliased ellipse with blending.
int aaellipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased ellipse with blending.
int filledEllipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw filled ellipse with blending.
int filledEllipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled ellipse with blending.
int _pieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 filled)
 Internal float (low-speed) pie-calc implementation by drawing polygons.
int pieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw pie (outline) with alpha blending.
int pieRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pie (outline) with alpha blending.
int filledPieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw filled pie with alpha blending.
int filledPieRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled pie with alpha blending.
int trigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw trigon (triangle outline) with alpha blending.
int trigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw trigon (triangle outline) with alpha blending.
int aatrigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
int aatrigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
int filledTrigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw filled trigon (triangle) with alpha blending.
int filledTrigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled trigon (triangle) with alpha blending.
int polygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw polygon with alpha blending.
int polygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw polygon with alpha blending.
int aapolygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw anti-aliased polygon with alpha blending.
int aapolygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased polygon with alpha blending.
int _gfxPrimitivesCompareInt (const void *a, const void *b)
 Internal helper qsort callback functions used in filled polygon drawing.
int filledPolygonColorMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
int filledPolygonRGBAMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
int filledPolygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw filled polygon with alpha blending.
int filledPolygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled polygon with alpha blending.
int _HLineTextured (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface *texture, int texture_dx, int texture_dy)
 Internal function to draw a textured horizontal line.
int texturedPolygonMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)
 Draws a polygon filled with the given texture (Multi-Threading Capable).
int texturedPolygon (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
 Draws a polygon filled with the given texture.
void gfxPrimitivesSetFont (const void *fontdata, Uint32 cw, Uint32 ch)
 Sets or resets the current global font data.
void gfxPrimitivesSetFontRotation (Uint32 rotation)
 Sets current global font character rotation steps.
int characterColor (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint32 color)
 Draw a character of the currently set font.
int characterRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a character of the currently set font.
int stringColor (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint32 color)
 Draw a string in the currently set font.
int stringRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a string in the currently set font.
double _evaluateBezier (double *data, int ndata, double t)
 Internal function to calculate bezier interpolator of data array with ndata values at position 't'.
int bezierColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
 Draw a bezier curve with alpha blending.
int bezierRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a bezier curve with alpha blending.
int _bresenhamInitialize (SDL_gfxBresenhamIterator *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
 Internal function to initialize the Bresenham line iterator.
int _bresenhamIterate (SDL_gfxBresenhamIterator *b)
 Internal function to move Bresenham line iterator to the next position.
void _murphyParaline (SDL_gfxMurphyIterator *m, Sint16 x, Sint16 y, int d1)
 Internal function to to draw parallel lines with Murphy algorithm.
void _murphyIteration (SDL_gfxMurphyIterator *m, Uint8 miter, Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)
 Internal function to to draw one iteration of the Murphy algorithm.
void _murphyWideline (SDL_gfxMurphyIterator *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)
 Internal function to to draw wide lines with Murphy algorithm.
int thickLineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
 Draw a thick line with alpha blending.
int thickLineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a thick line with alpha blending.

Define Documentation

#define AAbits   8

Definition at line 2567 of file SDL_gfxPrimitives.c.

#define AAlevels   256

Definition at line 2566 of file SDL_gfxPrimitives.c.

#define ABS (   a)    (((a)<0) ? -(a) : (a))

Definition at line 2333 of file SDL_gfxPrimitives.c.

Definition at line 44 of file SDL_gfxPrimitives.c.

#define CLIP_ACCEPT (   a,
 
)    (!(a|b))

Definition at line 1991 of file SDL_gfxPrimitives.c.

#define CLIP_BOTTOM_EDGE   0x4

Definition at line 1987 of file SDL_gfxPrimitives.c.

#define CLIP_INSIDE (   a)    (!a)

Definition at line 1989 of file SDL_gfxPrimitives.c.

#define CLIP_LEFT_EDGE   0x1

Definition at line 1985 of file SDL_gfxPrimitives.c.

#define CLIP_REJECT (   a,
 
)    (a&b)

Definition at line 1990 of file SDL_gfxPrimitives.c.

#define CLIP_RIGHT_EDGE   0x2

Definition at line 1986 of file SDL_gfxPrimitives.c.

#define CLIP_TOP_EDGE   0x8

Definition at line 1988 of file SDL_gfxPrimitives.c.

#define clip_xmax (   surface)    surface->clip_rect.x+surface->clip_rect.w-1

Definition at line 73 of file SDL_gfxPrimitives.c.

#define clip_xmin (   surface)    surface->clip_rect.x

Definition at line 72 of file SDL_gfxPrimitives.c.

#define clip_ymax (   surface)    surface->clip_rect.y+surface->clip_rect.h-1

Definition at line 75 of file SDL_gfxPrimitives.c.

#define clip_ymin (   surface)    surface->clip_rect.y

Definition at line 74 of file SDL_gfxPrimitives.c.

Definition at line 42 of file SDL_gfxPrimitives.c.

#define HYPOT (   x,
 
)    sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))

Definition at line 6606 of file SDL_gfxPrimitives.c.


Function Documentation

int _aalineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color,
int  draw_endpoint 
)

Internal function to draw anti-aliased line with alpha blending and endpoint control.

This implementation of the Wu antialiasing code is based on Mike Abrash's DDJ article which was reprinted as Chapter 42 of his Graphics Programming Black Book, but has been optimized to work with SDL and utilizes 32-bit fixed-point arithmetic by A. Schiffler. The endpoint control allows the supression to draw the last pixel useful for rendering continous aa-lines with alpha<255.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
draw_endpointFlag indicating if the endpoint should be drawn; draw if non-zero.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2589 of file SDL_gfxPrimitives.c.

int _bresenhamInitialize ( SDL_gfxBresenhamIterator b,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2 
)

Internal function to initialize the Bresenham line iterator.

Example of use: SDL_gfxBresenhamIterator b; _bresenhamInitialize (&b, x1, y1, x2, y2); do { plot(b.x, b.y); } while (_bresenhamIterate(&b)==0);

Parameters:
bPointer to struct for bresenham line drawing state.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6323 of file SDL_gfxPrimitives.c.

Internal function to move Bresenham line iterator to the next position.

Maybe updates the x and y coordinates of the iterator struct.

Parameters:
bPointer to struct for bresenham line drawing state.
Returns:
Returns 0 on success, 1 if last point was reached, 2 if moving past end-of-line, -1 on failure.

Definition at line 6385 of file SDL_gfxPrimitives.c.

double _evaluateBezier ( double *  data,
int  ndata,
double  t 
)

Internal function to calculate bezier interpolator of data array with ndata values at position 't'.

Parameters:
dataArray of values.
ndataSize of array.
tPosition for which to calculate interpolated value. t should be between [0, ndata].
Returns:
Interpolated value at position t, value[0] when t<0, value[n-1] when t>n.

Definition at line 6162 of file SDL_gfxPrimitives.c.

int _filledRectAlpha ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color,
Uint8  alpha 
)

Internal function to draw filled rectangle with alpha blending.

Assumes color is in destination format.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first corner (upper left) of the rectangle.
y1Y coordinate of the first corner (upper left) of the rectangle.
x2X coordinate of the second corner (lower right) of the rectangle.
y2Y coordinate of the second corner (lower right) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
alphaAlpha blending amount for pixels.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 595 of file SDL_gfxPrimitives.c.

int _gfxPrimitivesCompareInt ( const void *  a,
const void *  b 
)

Internal helper qsort callback functions used in filled polygon drawing.

Parameters:
aThe surface to draw on.
bVertex array containing X coordinates of the points of the polygon.
Returns:
Returns 0 if a==b, a negative number if a<b or a positive number if a>b.

Definition at line 5163 of file SDL_gfxPrimitives.c.

int _HLineAlpha ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Internal function to draw horizontal line of RGBA color with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 905 of file SDL_gfxPrimitives.c.

int _HLineTextured ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Internal function to draw a textured horizontal line.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
textureThe texture surface to retrieve color information from.
texture_dxThe X offset for the texture lookup.
texture_dyThe Y offset for the textured lookup.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5437 of file SDL_gfxPrimitives.c.

void _murphyIteration ( SDL_gfxMurphyIterator m,
Uint8  miter,
Uint16  ml1bx,
Uint16  ml1by,
Uint16  ml2bx,
Uint16  ml2by,
Uint16  ml1x,
Uint16  ml1y,
Uint16  ml2x,
Uint16  ml2y 
)

Internal function to to draw one iteration of the Murphy algorithm.

Parameters:
mPointer to struct for murphy iterator.
miterIteration count.
ml1bxX coordinate of a point.
ml1byY coordinate of a point.
ml2bxX coordinate of a point.
ml2byY coordinate of a point.
ml1xX coordinate of a point.
ml1yY coordinate of a point.
ml2xX coordinate of a point.
ml2yY coordinate of a point.

Definition at line 6490 of file SDL_gfxPrimitives.c.

void _murphyParaline ( SDL_gfxMurphyIterator m,
Sint16  x,
Sint16  y,
int  d1 
)

Internal function to to draw parallel lines with Murphy algorithm.

Parameters:
mPointer to struct for murphy iterator.
xX coordinate of point.
yY coordinate of point.
d1Direction square/diagonal.

Definition at line 6428 of file SDL_gfxPrimitives.c.

void _murphyWideline ( SDL_gfxMurphyIterator m,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  miter 
)

Internal function to to draw wide lines with Murphy algorithm.

Draws lines parallel to ideal line.

Parameters:
mPointer to struct for murphy iterator.
x1X coordinate of first point.
y1Y coordinate of first point.
x2X coordinate of second point.
y2Y coordinate of second point.
widthWidth of line.
miterIteration count.

Definition at line 6622 of file SDL_gfxPrimitives.c.

int _pieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color,
Uint8  filled 
)

Internal float (low-speed) pie-calc implementation by drawing polygons.

Note: Determines vertex array and uses polygon or filledPolygon drawing routines to render.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
filledFlag indicating if the pie should be filled (=1) or not (=0).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4553 of file SDL_gfxPrimitives.c.

int _putPixelAlpha ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color,
Uint8  alpha 
)

Internal pixel drawing function with alpha blending where input color in in destination format.

Contains two alternative 32 bit alpha blending routines which can be enabled at the source level with the defines DEFAULT_ALPHA_PIXEL_ROUTINE or EXPERIMENTAL_ALPHA_PIXEL_ROUTINE. Only the bits up to the surface depth are significant in the color value.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
alphaThe blend factor to apply while drawing.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 286 of file SDL_gfxPrimitives.c.

int _VLineAlpha ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Internal function to draw vertical line of RGBA color with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (top) of the line.
y2Y coordinate of the second point (bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 921 of file SDL_gfxPrimitives.c.

int aacircleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw anti-aliased circle with blending.

Note: The AA-circle routine is based on AA-ellipse with identical radii.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
colorThe color value of the aa-circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3512 of file SDL_gfxPrimitives.c.

int aacircleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
rThe red value of the aa-circle to draw.
gThe green value of the aa-circle to draw.
bThe blue value of the aa-circle to draw.
aThe alpha value of the aa-circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3531 of file SDL_gfxPrimitives.c.

int aaellipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw anti-aliased ellipse with blending.

Note: Based on code from Anders Lindstroem, which is based on code from sge library, which is based on code from TwinLib.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
colorThe color value of the aa-ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4088 of file SDL_gfxPrimitives.c.

int aaellipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
rThe red value of the aa-ellipse to draw.
gThe green value of the aa-ellipse to draw.
bThe blue value of the aa-ellipse to draw.
aThe alpha value of the aa-ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4328 of file SDL_gfxPrimitives.c.

int aalineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Ddraw anti-aliased line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2828 of file SDL_gfxPrimitives.c.

int aalineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
rThe red value of the aa-line to draw.
gThe green value of the aa-line to draw.
bThe blue value of the aa-line to draw.
aThe alpha value of the aa-line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2848 of file SDL_gfxPrimitives.c.

int aapolygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the aa-polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5077 of file SDL_gfxPrimitives.c.

int aapolygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the aa-polygon to draw.
gThe green value of the aa-polygon to draw.
bThe blue value of the aa-polygon to draw.
aThe alpha value of the aa-polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5145 of file SDL_gfxPrimitives.c.

int aatrigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
colorThe color value of the aa-trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4859 of file SDL_gfxPrimitives.c.

int aatrigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
rThe red value of the aa-trigon to draw.
gThe green value of the aa-trigon to draw.
bThe blue value of the aa-trigon to draw.
aThe alpha value of the aa-trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4891 of file SDL_gfxPrimitives.c.

int arcColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Arc with blending.

Note Arc drawing is based on circle algorithm by A. Schiffler and written by D. Raber. Calculates which octants arc goes through and renders pixels accordingly.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
colorThe color value of the arc to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3117 of file SDL_gfxPrimitives.c.

int arcRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Arc with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
rThe red value of the arc to draw.
gThe green value of the arc to draw.
bThe blue value of the arc to draw.
aThe alpha value of the arc to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3488 of file SDL_gfxPrimitives.c.

int bezierColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint32  color 
)

Draw a bezier curve with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
colorThe color value of the bezier curve to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6221 of file SDL_gfxPrimitives.c.

int bezierRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a bezier curve with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
rThe red value of the bezier curve to draw.
gThe green value of the bezier curve to draw.
bThe blue value of the bezier curve to draw.
aThe alpha value of the bezier curve to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6296 of file SDL_gfxPrimitives.c.

int boxColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2107 of file SDL_gfxPrimitives.c.

int boxRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2319 of file SDL_gfxPrimitives.c.

int characterColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
char  c,
Uint32  color 
)

Draw a character of the currently set font.

On first call for a particular character and color combination, the function needs to generate the character surface (slower. Subsequent calls blit a cached surface (fast). Uses alpha blending if A<255 in color.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
colorThe color value of the character to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5908 of file SDL_gfxPrimitives.c.

int characterRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
char  c,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a character of the currently set font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6077 of file SDL_gfxPrimitives.c.

int circleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw circle with blending.

Note: Circle drawing routine is based on an algorithms from the sge library, but modified by A. Schiffler for multiple pixel-draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
colorThe color value of the circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2872 of file SDL_gfxPrimitives.c.

int circleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
rThe red value of the circle to draw.
gThe green value of the circle to draw.
bThe blue value of the circle to draw.
aThe alpha value of the circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3090 of file SDL_gfxPrimitives.c.

int ellipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw ellipse with blending.

Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-pixel draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
colorThe color value of the ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3709 of file SDL_gfxPrimitives.c.

int ellipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
rThe red value of the ellipse to draw.
gThe green value of the ellipse to draw.
bThe blue value of the ellipse to draw.
aThe alpha value of the ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4023 of file SDL_gfxPrimitives.c.

int fastPixelColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Internal pixel drawing - fast, no blending, locking, clipping.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 190 of file SDL_gfxPrimitives.c.

int fastPixelColorNolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Internal pixel drawing - fast, no blending, no locking, clipping.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 87 of file SDL_gfxPrimitives.c.

int fastPixelColorNolockNoclip ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Internal pixel drawing - fast, no blending, no locking, no clipping.

Function is faster but dangerous since no clipping check is done. Code needs to make sure we stay in surface bounds before calling.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 144 of file SDL_gfxPrimitives.c.

int fastPixelRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Internal pixel drawing - fast, no blending, locking, RGB input.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
rThe red value of the pixel to draw.
gThe green value of the pixel to draw.
bThe blue value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 228 of file SDL_gfxPrimitives.c.

int fastPixelRGBANolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Internal pixel drawing - fast, no blending, no locking RGB input.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
rThe red value of the pixel to draw.
gThe green value of the pixel to draw.
bThe blue value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 256 of file SDL_gfxPrimitives.c.

int filledCircleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw filled circle with blending.

Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-hline draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
colorThe color value of the filled circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3556 of file SDL_gfxPrimitives.c.

int filledCircleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
rThe red value of the filled circle to draw.
gThe green value of the filled circle to draw.
bThe blue value of the filled circle to draw.
aThe alpha value of the filled circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3683 of file SDL_gfxPrimitives.c.

int filledEllipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw filled ellipse with blending.

Note: Based on algorithm from sge library with multiple-hline draw removal and other speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
colorThe color value of the filled ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4358 of file SDL_gfxPrimitives.c.

int filledEllipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
rThe red value of the filled ellipse to draw.
gThe green value of the filled ellipse to draw.
bThe blue value of the filled ellipse to draw.
aThe alpha value of the filled ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4526 of file SDL_gfxPrimitives.c.

int filledPieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw filled pie with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
colorThe color value of the filled pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4747 of file SDL_gfxPrimitives.c.

int filledPieRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled pie with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
rThe red value of the filled pie to draw.
gThe green value of the filled pie to draw.
bThe blue value of the filled pie to draw.
aThe alpha value of the filled pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4768 of file SDL_gfxPrimitives.c.

int filledPolygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw filled polygon with alpha blending.

Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5394 of file SDL_gfxPrimitives.c.

int filledPolygonColorMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5197 of file SDL_gfxPrimitives.c.

int filledPolygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5416 of file SDL_gfxPrimitives.c.

int filledPolygonRGBAMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5372 of file SDL_gfxPrimitives.c.

int filledRectAlpha ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw filled rectangle of RGBA color with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first corner (upper left) of the rectangle.
y1Y coordinate of the first corner (upper left) of the rectangle.
x2X coordinate of the second corner (lower right) of the rectangle.
y2Y coordinate of the second corner (lower right) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 856 of file SDL_gfxPrimitives.c.

int filledTrigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
colorThe color value of the filled trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4925 of file SDL_gfxPrimitives.c.

int filledTrigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
rThe red value of the filled trigon to draw.
gThe green value of the filled trigon to draw.
bThe blue value of the filled trigon to draw.
aThe alpha value of the filled trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4959 of file SDL_gfxPrimitives.c.

void gfxPrimitivesSetFont ( const void *  fontdata,
Uint32  cw,
Uint32  ch 
)

Sets or resets the current global font data.

The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]

Parameters:
fontdataPointer to array of font data. Set to NULL, to reset global font to the default 8x8 font.
cwWidth of character in bytes. Ignored if fontdata==NULL.
chHeight of character in bytes. Ignored if fontdata==NULL.

Definition at line 5815 of file SDL_gfxPrimitives.c.

void gfxPrimitivesSetFontRotation ( Uint32  rotation)

Sets current global font character rotation steps.

Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.

Parameters:
rotationNumber of 90deg clockwise steps to rotate

Definition at line 5861 of file SDL_gfxPrimitives.c.

int hlineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1204 of file SDL_gfxPrimitives.c.

int hlineColorStore ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line without blending;.

Just stores the color value (including the alpha component) without blending. Only the same number of bits of the destination surface are transfered from the input color value.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1041 of file SDL_gfxPrimitives.c.

int hlineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1373 of file SDL_gfxPrimitives.c.

int hlineRGBAStore ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line without blending.

Just stores the color value (including the alpha component) without blending. Function should only be used for 32 bit target surfaces.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1185 of file SDL_gfxPrimitives.c.

int lineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2347 of file SDL_gfxPrimitives.c.

int lineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2556 of file SDL_gfxPrimitives.c.

int pieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw pie (outline) with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4703 of file SDL_gfxPrimitives.c.

int pieRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pie (outline) with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
rThe red value of the pie to draw.
gThe green value of the pie to draw.
bThe blue value of the pie to draw.
aThe alpha value of the pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4726 of file SDL_gfxPrimitives.c.

int pixelColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Pixel draw with blending enabled if a<255.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 509 of file SDL_gfxPrimitives.c.

int pixelColorNolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Pixel draw with blending enabled if a<255 - no surface locking.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 557 of file SDL_gfxPrimitives.c.

int pixelColorWeight ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color,
Uint32  weight 
)

Pixel draw with blending enabled and using alpha weight on color.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
weightThe weight multiplied into the alpha value of the pixel.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 937 of file SDL_gfxPrimitives.c.

int pixelColorWeightNolock ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color,
Uint32  weight 
)

Pixel draw with blending enabled and using alpha weight on color - no locking.

Parameters:
dstThe surface to draw on.
xThe horizontal coordinate of the pixel.
yThe vertical position of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
weightThe weight multiplied into the alpha value of the pixel.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 965 of file SDL_gfxPrimitives.c.

int pixelRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Pixel draw with blending enabled if a<255.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
rThe red color value of the pixel to draw.
gThe green color value of the pixel to draw.
bThe blue color value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 995 of file SDL_gfxPrimitives.c.

int polygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4988 of file SDL_gfxPrimitives.c.

int polygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the polygon to draw.
gThe green value of the polygon to draw.
bThe blue value of the polygon to draw.
aThe alpha value of the polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5056 of file SDL_gfxPrimitives.c.

int rectangleColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1580 of file SDL_gfxPrimitives.c.

int rectangleRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1663 of file SDL_gfxPrimitives.c.

int roundedBoxColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1837 of file SDL_gfxPrimitives.c.

int roundedBoxRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1970 of file SDL_gfxPrimitives.c.

int roundedRectangleColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1685 of file SDL_gfxPrimitives.c.

int roundedRectangleRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1815 of file SDL_gfxPrimitives.c.

int stringColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
const char *  s,
Uint32  color 
)

Draw a string in the currently set font.

The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
colorThe color value of the string to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6099 of file SDL_gfxPrimitives.c.

int stringRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
const char *  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a string in the currently set font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
rThe red value of the string to draw.
gThe green value of the string to draw.
bThe blue value of the string to draw.
aThe alpha value of the string to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6143 of file SDL_gfxPrimitives.c.

int texturedPolygon ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Draws a polygon filled with the given texture.

This standard version is calling multithreaded versions with NULL cache parameters.

Parameters:
dstthe destination surface,
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5741 of file SDL_gfxPrimitives.c.

int texturedPolygonMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy,
int **  polyInts,
int *  polyAllocated 
)

Draws a polygon filled with the given texture (Multi-Threading Capable).

This operation use internally SDL_BlitSurface for lines of the source texture. It supports alpha drawing.

To get the best performance of this operation you need to make sure the texture and the dst surface have the same format (see http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html). The last two parameters are optional, but required for multithreaded operation. When set to NULL, uses global static temp array.

Parameters:
dstthe destination surface,
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
polyIntspreallocated temp array storage for vertex sorting (used for multi-threaded operation)
polyAllocatedflag indicating oif the temp array was allocated (used for multi-threaded operation)
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5574 of file SDL_gfxPrimitives.c.

int thickLineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint32  color 
)

Draw a thick line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6808 of file SDL_gfxPrimitives.c.

int thickLineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a thick line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6847 of file SDL_gfxPrimitives.c.

int trigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses polygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
colorThe color value of the trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4793 of file SDL_gfxPrimitives.c.

int trigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw trigon (triangle outline) with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
rThe red value of the trigon to draw.
gThe green value of the trigon to draw.
bThe blue value of the trigon to draw.
aThe alpha value of the trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4825 of file SDL_gfxPrimitives.c.

int vlineColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Draw vertical line with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1392 of file SDL_gfxPrimitives.c.

int vlineRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw vertical line with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1560 of file SDL_gfxPrimitives.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_primitives_8c_source.html000066400000000000000000017622041225506657100243050ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.c Source File
I:/Sources/sdlgfx/SDL_gfxPrimitives.c
Go to the documentation of this file.
00001 /* 
00002 
00003 SDL_gfxPrimitives.c: graphics primitives for SDL surfaces
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 #include <math.h>
00033 #include <string.h>
00034 
00035 #include "SDL_gfxPrimitives.h"
00036 #include "SDL_rotozoom.h"
00037 #include "SDL_gfxPrimitives_font.h"
00038 #include "SDL_gfxBlitFunc.h"
00039 
00040 /* -===================- */
00041 
00042 #define DEFAULT_ALPHA_PIXEL_ROUTINE
00043 #undef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
00044 #define ALPHA_PIXEL_ADDITIVE_BLEND
00045 
00046 /* ---- Structures */
00047 
00051 typedef struct {
00052         Sint16 x, y;
00053         int dx, dy, s1, s2, swapdir, error;
00054         Uint32 count;
00055 } SDL_gfxBresenhamIterator;
00056 
00060 typedef struct {
00061         Uint32 color;
00062         SDL_Surface *dst;
00063         int u, v;               /* delta x , delta y */
00064         int ku, kt, kv, kd;     /* loop constants */
00065         int oct2;
00066         int quad4;
00067         Sint16 last1x, last1y, last2x, last2y, first1x, first1y, first2x, first2y, tempx, tempy;
00068 } SDL_gfxMurphyIterator;
00069 
00070 /* ----- Defines for pixel clipping tests */
00071 
00072 #define clip_xmin(surface) surface->clip_rect.x
00073 #define clip_xmax(surface) surface->clip_rect.x+surface->clip_rect.w-1
00074 #define clip_ymin(surface) surface->clip_rect.y
00075 #define clip_ymax(surface) surface->clip_rect.y+surface->clip_rect.h-1
00076 
00087 int fastPixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
00088 {
00089         int bpp;
00090         Uint8 *p;
00091 
00092         /*
00093         * Honor clipping setup at pixel level 
00094         */
00095         if ((x >= clip_xmin(dst)) && (x <= clip_xmax(dst)) && (y >= clip_ymin(dst)) && (y <= clip_ymax(dst))) {
00096 
00097                 /*
00098                 * Get destination format 
00099                 */
00100                 bpp = dst->format->BytesPerPixel;
00101                 p = (Uint8 *) dst->pixels + y * dst->pitch + x * bpp;
00102                 switch (bpp) {
00103                 case 1:
00104                         *p = color;
00105                         break;
00106                 case 2:
00107                         *(Uint16 *) p = color;
00108                         break;
00109                 case 3:
00110                         if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
00111                                 p[0] = (color >> 16) & 0xff;
00112                                 p[1] = (color >> 8) & 0xff;
00113                                 p[2] = color & 0xff;
00114                         } else {
00115                                 p[0] = color & 0xff;
00116                                 p[1] = (color >> 8) & 0xff;
00117                                 p[2] = (color >> 16) & 0xff;
00118                         }
00119                         break;
00120                 case 4:
00121                         *(Uint32 *) p = color;
00122                         break;
00123                 }                       /* switch */
00124 
00125 
00126         }
00127 
00128         return (0);
00129 }
00130 
00144 int fastPixelColorNolockNoclip(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
00145 {
00146         int bpp;
00147         Uint8 *p;
00148 
00149         /*
00150         * Get destination format 
00151         */
00152         bpp = dst->format->BytesPerPixel;
00153         p = (Uint8 *) dst->pixels + y * dst->pitch + x * bpp;
00154         switch (bpp) {
00155         case 1:
00156                 *p = color;
00157                 break;
00158         case 2:
00159                 *(Uint16 *) p = color;
00160                 break;
00161         case 3:
00162                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
00163                         p[0] = (color >> 16) & 0xff;
00164                         p[1] = (color >> 8) & 0xff;
00165                         p[2] = color & 0xff;
00166                 } else {
00167                         p[0] = color & 0xff;
00168                         p[1] = (color >> 8) & 0xff;
00169                         p[2] = (color >> 16) & 0xff;
00170                 }
00171                 break;
00172         case 4:
00173                 *(Uint32 *) p = color;
00174                 break;
00175         }                               /* switch */
00176 
00177         return (0);
00178 }
00179 
00190 int fastPixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
00191 {
00192         int result;
00193 
00194         /*
00195         * Lock the surface 
00196         */
00197         if (SDL_MUSTLOCK(dst)) {
00198                 if (SDL_LockSurface(dst) < 0) {
00199                         return (-1);
00200                 }
00201         }
00202 
00203         result = fastPixelColorNolock(dst, x, y, color);
00204 
00205         /*
00206         * Unlock surface 
00207         */
00208         if (SDL_MUSTLOCK(dst)) {
00209                 SDL_UnlockSurface(dst);
00210         }
00211 
00212         return (result);
00213 }
00214 
00228 int fastPixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00229 {
00230         Uint32 color;
00231 
00232         /*
00233         * Setup color 
00234         */
00235         color = SDL_MapRGBA(dst->format, r, g, b, a);
00236 
00237         /*
00238         * Draw 
00239         */
00240         return (fastPixelColor(dst, x, y, color));
00241 }
00242 
00256 int fastPixelRGBANolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00257 {
00258         Uint32 color;
00259 
00260         /*
00261         * Setup color 
00262         */
00263         color = SDL_MapRGBA(dst->format, r, g, b, a);
00264 
00265         /*
00266         * Draw 
00267         */
00268         return (fastPixelColorNolock(dst, x, y, color));
00269 }
00270 
00286 int _putPixelAlpha(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)
00287 {
00288         SDL_PixelFormat *format;
00289         Uint32 Rmask, Gmask, Bmask, Amask;
00290         Uint32 Rshift, Gshift, Bshift, Ashift;
00291         Uint32 sR, sG, sB;
00292         Uint32 dR, dG, dB, dA;
00293 
00294         if (dst == NULL)
00295         {
00296                 return (-1);
00297         }
00298 
00299         if (x >= clip_xmin(dst) && x <= clip_xmax(dst) && 
00300                 y >= clip_ymin(dst) && y <= clip_ymax(dst)) 
00301         {
00302 
00303                 format = dst->format;
00304 
00305                 switch (format->BytesPerPixel) {
00306                 case 1:
00307                         {               /* Assuming 8-bpp */
00308                                 Uint8 *pixel = (Uint8 *) dst->pixels + y * dst->pitch + x;
00309                                 if (alpha == 255) {
00310                                         *pixel = color;
00311                                 } else {
00312                                         Uint8 R, G, B;
00313                                         SDL_Palette *palette = format->palette;
00314                                         SDL_Color *colors = palette->colors;
00315                                         SDL_Color dColor = colors[*pixel];
00316                                         SDL_Color sColor = colors[color];
00317                                         dR = dColor.r;
00318                                         dG = dColor.g;
00319                                         dB = dColor.b;
00320                                         sR = sColor.r;
00321                                         sG = sColor.g;
00322                                         sB = sColor.b;
00323 
00324                                         R = dR + ((sR - dR) * alpha >> 8);
00325                                         G = dG + ((sG - dG) * alpha >> 8);
00326                                         B = dB + ((sB - dB) * alpha >> 8);
00327 
00328                                         *pixel = SDL_MapRGB(format, R, G, B);
00329                                 }
00330                         }
00331                         break;
00332 
00333                 case 2:
00334                         {               /* Probably 15-bpp or 16-bpp */
00335                                 Uint16 *pixel = (Uint16 *) dst->pixels + y * dst->pitch / 2 + x;
00336                                 if (alpha == 255) {
00337                                         *pixel = color;
00338                                 } else {
00339                                         Uint16 R, G, B, A;
00340                                         Uint16 dc = *pixel;
00341 
00342                                         Rmask = format->Rmask;
00343                                         Gmask = format->Gmask;
00344                                         Bmask = format->Bmask;
00345                                         Amask = format->Amask;
00346 
00347                                         dR = (dc & Rmask);
00348                                         dG = (dc & Gmask);
00349                                         dB = (dc & Bmask);
00350 
00351                                         R = (dR + (((color & Rmask) - dR) * alpha >> 8)) & Rmask;
00352                                         G = (dG + (((color & Gmask) - dG) * alpha >> 8)) & Gmask;
00353                                         B = (dB + (((color & Bmask) - dB) * alpha >> 8)) & Bmask;
00354                                         *pixel = R | G | B;
00355                                         if (Amask!=0) {
00356                                                 dA = (dc & Amask);
00357                                                 A = (dA + (((color & Amask) - dA) * alpha >> 8)) & Amask;
00358                                                 *pixel |= A;
00359                                         }
00360                                 }
00361                         }
00362                         break;
00363 
00364                 case 3: 
00365                         {               /* Slow 24-bpp mode, usually not used */
00366                                 Uint8 R, G, B;
00367                                 Uint8 Rshift8, Gshift8, Bshift8;
00368                                 Uint8 *pixel = (Uint8 *) dst->pixels + y * dst->pitch + x * 3;
00369 
00370                                 Rshift = format->Rshift;
00371                                 Gshift = format->Gshift;
00372                                 Bshift = format->Bshift;
00373 
00374                                 Rshift8 = Rshift >> 3;
00375                                 Gshift8 = Gshift >> 3;
00376                                 Bshift8 = Bshift >> 3;
00377 
00378                                 sR = (color >> Rshift) & 0xFF;
00379                                 sG = (color >> Gshift) & 0xFF;
00380                                 sB = (color >> Bshift) & 0xFF;
00381 
00382                                 if (alpha == 255) {
00383                                         *(pixel + Rshift8) = sR;
00384                                         *(pixel + Gshift8) = sG;
00385                                         *(pixel + Bshift8) = sB;
00386                                 } else {
00387                                         dR = *((pixel) + Rshift8);
00388                                         dG = *((pixel) + Gshift8);
00389                                         dB = *((pixel) + Bshift8);
00390 
00391                                         R = dR + ((sR - dR) * alpha >> 8);
00392                                         G = dG + ((sG - dG) * alpha >> 8);
00393                                         B = dB + ((sB - dB) * alpha >> 8);
00394 
00395                                         *((pixel) + Rshift8) = R;
00396                                         *((pixel) + Gshift8) = G;
00397                                         *((pixel) + Bshift8) = B;
00398                                 }
00399                         }
00400                         break;
00401 
00402 #ifdef DEFAULT_ALPHA_PIXEL_ROUTINE
00403 
00404                 case 4:
00405                         {               /* Probably :-) 32-bpp */
00406                                 Uint32 R, G, B, A;
00407                                 Uint32 *pixel = (Uint32 *) dst->pixels + y * dst->pitch / 4 + x;
00408                                 if (alpha == 255) {
00409                                         *pixel = color;
00410                                 } else {
00411                                         Uint32 dc = *pixel;
00412 
00413                                         Rmask = format->Rmask;
00414                                         Gmask = format->Gmask;
00415                                         Bmask = format->Bmask;
00416                                         Amask = format->Amask;
00417 
00418                                         Rshift = format->Rshift;
00419                                         Gshift = format->Gshift;
00420                                         Bshift = format->Bshift;
00421                                         Ashift = format->Ashift;
00422 
00423                                         dR = (dc & Rmask) >> Rshift;
00424                                         dG = (dc & Gmask) >> Gshift;
00425                                         dB = (dc & Bmask) >> Bshift;
00426 
00427 
00428                                         R = ((dR + ((((color & Rmask) >> Rshift) - dR) * alpha >> 8)) << Rshift) & Rmask;
00429                                         G = ((dG + ((((color & Gmask) >> Gshift) - dG) * alpha >> 8)) << Gshift) & Gmask;
00430                                         B = ((dB + ((((color & Bmask) >> Bshift) - dB) * alpha >> 8)) << Bshift) & Bmask;
00431                                         *pixel = R | G | B;
00432                                         if (Amask!=0) {
00433                                                 dA = (dc & Amask) >> Ashift;
00434 
00435 #ifdef ALPHA_PIXEL_ADDITIVE_BLEND
00436                                                 A = (dA | GFX_ALPHA_ADJUST_ARRAY[alpha & 255]) << Ashift; // make destination less transparent...
00437 #else
00438                                                 A = ((dA + ((((color & Amask) >> Ashift) - dA) * alpha >> 8)) << Ashift) & Amask;
00439 #endif
00440                                                 *pixel |= A;
00441                                         }
00442                                 }
00443                         }
00444                         break;
00445 #endif
00446 
00447 #ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
00448 
00449                 case 4:{                /* Probably :-) 32-bpp */
00450                         if (alpha == 255) {
00451                                 *((Uint32 *) dst->pixels + y * dst->pitch / 4 + x) = color;
00452                         } else {
00453                                 Uint32 *pixel = (Uint32 *) dst->pixels + y * dst->pitch / 4 + x;
00454                                 Uint32 dR, dG, dB, dA;
00455                                 Uint32 dc = *pixel;
00456 
00457                                 Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
00458                                 Uint32 aTmp;
00459 
00460                                 Rmask = format->Rmask;
00461                                 Gmask = format->Gmask;
00462                                 Bmask = format->Bmask;
00463                                 Amask = format->Amask;
00464 
00465                                 dR = (color & Rmask);
00466                                 dG = (color & Gmask);
00467                                 dB = (color & Bmask);
00468                                 dA = (color & Amask);
00469 
00470                                 Rshift = format->Rshift;
00471                                 Gshift = format->Gshift;
00472                                 Bshift = format->Bshift;
00473                                 Ashift = format->Ashift;
00474 
00475                                 preMultR = (alpha * (dR >> Rshift));
00476                                 preMultG = (alpha * (dG >> Gshift));
00477                                 preMultB = (alpha * (dB >> Bshift));
00478 
00479                                 surfaceAlpha = ((dc & Amask) >> Ashift);
00480                                 aTmp = (255 - alpha);
00481                                 if (A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 )) {
00482                                         aTmp *= surfaceAlpha;
00483                                         R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
00484                                         G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
00485                                         B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
00486                                 }
00487                                 *pixel = R | G | B | (A << Ashift & Amask);
00488 
00489                         }
00490                            }
00491                            break;
00492 #endif
00493                 }
00494         }
00495 
00496         return (0);
00497 }
00498 
00509 int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
00510 {
00511         Uint8 alpha;
00512         Uint32 mcolor;
00513         int result = 0;
00514 
00515         /*
00516         * Lock the surface 
00517         */
00518         if (SDL_MUSTLOCK(dst)) {
00519                 if (SDL_LockSurface(dst) < 0) {
00520                         return (-1);
00521                 }
00522         }
00523 
00524         /*
00525         * Setup color 
00526         */
00527         alpha = color & 0x000000ff;
00528         mcolor =
00529                 SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
00530                 (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
00531 
00532         /*
00533         * Draw 
00534         */
00535         result = _putPixelAlpha(dst, x, y, mcolor, alpha);
00536 
00537         /*
00538         * Unlock the surface 
00539         */
00540         if (SDL_MUSTLOCK(dst)) {
00541                 SDL_UnlockSurface(dst);
00542         }
00543 
00544         return (result);
00545 }
00546 
00557 int pixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
00558 {
00559         Uint8 alpha;
00560         Uint32 mcolor;
00561         int result = 0;
00562 
00563         /*
00564         * Setup color 
00565         */
00566         alpha = color & 0x000000ff;
00567         mcolor =
00568                 SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
00569                 (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
00570 
00571         /*
00572         * Draw 
00573         */
00574         result = _putPixelAlpha(dst, x, y, mcolor, alpha);
00575 
00576         return (result);
00577 }
00578 
00579 
00595 int _filledRectAlpha(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha)
00596 {
00597         SDL_PixelFormat *format;
00598         Uint32 Rmask, Gmask, Bmask, Amask;
00599         Uint32 Rshift, Gshift, Bshift, Ashift;
00600         Uint32 sR, sG, sB, sA;
00601         Uint32 dR, dG, dB, dA;
00602         Sint16 x, y;
00603 
00604         if (dst == NULL) {
00605                 return (-1);
00606         }
00607 
00608         format = dst->format;
00609         switch (format->BytesPerPixel) {
00610         case 1:
00611                 {                       /* Assuming 8-bpp */
00612                         Uint8 *row, *pixel;
00613                         Uint8 R, G, B;
00614                         SDL_Color *colors = format->palette->colors;
00615                         SDL_Color dColor;
00616                         SDL_Color sColor = colors[color];
00617                         sR = sColor.r;
00618                         sG = sColor.g;
00619                         sB = sColor.b;
00620 
00621                         for (y = y1; y <= y2; y++) {
00622                                 row = (Uint8 *) dst->pixels + y * dst->pitch;
00623                                 for (x = x1; x <= x2; x++) {
00624                                         if (alpha == 255) {
00625                                                 *(row + x) = color;
00626                                         } else {
00627                                                 pixel = row + x;
00628 
00629                                                 dColor = colors[*pixel];
00630                                                 dR = dColor.r;
00631                                                 dG = dColor.g;
00632                                                 dB = dColor.b;
00633 
00634                                                 R = dR + ((sR - dR) * alpha >> 8);
00635                                                 G = dG + ((sG - dG) * alpha >> 8);
00636                                                 B = dB + ((sB - dB) * alpha >> 8);
00637 
00638                                                 *pixel = SDL_MapRGB(format, R, G, B);
00639                                         }
00640                                 }
00641                         }
00642                 }
00643                 break;
00644 
00645         case 2:
00646                 {                       /* Probably 15-bpp or 16-bpp */
00647                         Uint16 *row, *pixel;
00648                         Uint16 R, G, B, A;
00649                         Uint16 dc;
00650                         Rmask = format->Rmask;
00651                         Gmask = format->Gmask;
00652                         Bmask = format->Bmask;
00653                         Amask = format->Amask;
00654 
00655                         sR = (color & Rmask); 
00656                         sG = (color & Gmask);
00657                         sB = (color & Bmask);
00658                         sA = (color & Amask);
00659 
00660                         for (y = y1; y <= y2; y++) {
00661                                 row = (Uint16 *) dst->pixels + y * dst->pitch / 2;
00662                                 for (x = x1; x <= x2; x++) {
00663                                         if (alpha == 255) {
00664                                                 *(row + x) = color;
00665                                         } else {
00666                                                 pixel = row + x;
00667                                                 dc = *pixel;
00668 
00669                                                 dR = (dc & Rmask);
00670                                                 dG = (dc & Gmask);
00671                                                 dB = (dc & Bmask);
00672 
00673                                                 R = (dR + ((sR - dR) * alpha >> 8)) & Rmask;
00674                                                 G = (dG + ((sG - dG) * alpha >> 8)) & Gmask;
00675                                                 B = (dB + ((sB - dB) * alpha >> 8)) & Bmask;
00676                                                 *pixel = R | G | B;
00677                                                 if (Amask!=0) {
00678                                                         dA = (dc & Amask);
00679                                                         A = (dA + ((sA - dA) * alpha >> 8)) & Amask;
00680                                                         *pixel |= A;
00681                                                 } 
00682                                         }
00683                                 }
00684                         }
00685                 }
00686                 break;
00687 
00688         case 3:
00689                 {                       /* Slow 24-bpp mode, usually not used */
00690                         Uint8 *row, *pixel;
00691                         Uint8 R, G, B;
00692                         Uint8 Rshift8, Gshift8, Bshift8;
00693 
00694                         Rshift = format->Rshift;
00695                         Gshift = format->Gshift;
00696                         Bshift = format->Bshift;
00697 
00698                         Rshift8 = Rshift >> 3;
00699                         Gshift8 = Gshift >> 3;
00700                         Bshift8 = Bshift >> 3;
00701 
00702                         sR = (color >> Rshift) & 0xff;
00703                         sG = (color >> Gshift) & 0xff;
00704                         sB = (color >> Bshift) & 0xff;
00705 
00706                         for (y = y1; y <= y2; y++) {
00707                                 row = (Uint8 *) dst->pixels + y * dst->pitch;
00708                                 for (x = x1; x <= x2; x++) {
00709                                         pixel = row + x * 3;
00710 
00711                                         if (alpha == 255) {
00712                                                 *(pixel + Rshift8) = sR;
00713                                                 *(pixel + Gshift8) = sG;
00714                                                 *(pixel + Bshift8) = sB;
00715                                         } else {
00716                                                 dR = *((pixel) + Rshift8);
00717                                                 dG = *((pixel) + Gshift8);
00718                                                 dB = *((pixel) + Bshift8);
00719 
00720                                                 R = dR + ((sR - dR) * alpha >> 8);
00721                                                 G = dG + ((sG - dG) * alpha >> 8);
00722                                                 B = dB + ((sB - dB) * alpha >> 8);
00723 
00724                                                 *((pixel) + Rshift8) = R;
00725                                                 *((pixel) + Gshift8) = G;
00726                                                 *((pixel) + Bshift8) = B;
00727                                         }
00728                                 }
00729                         }
00730                 }
00731                 break;
00732 
00733 #ifdef DEFAULT_ALPHA_PIXEL_ROUTINE
00734         case 4:
00735                 {                       /* Probably :-) 32-bpp */
00736                         Uint32 *row, *pixel;
00737                         Uint32 R, G, B, A;
00738                         Uint32 dc;
00739                         Rmask = format->Rmask;
00740                         Gmask = format->Gmask;
00741                         Bmask = format->Bmask;
00742                         Amask = format->Amask;
00743 
00744                         Rshift = format->Rshift;
00745                         Gshift = format->Gshift;
00746                         Bshift = format->Bshift;
00747                         Ashift = format->Ashift;
00748 
00749                         sR = (color & Rmask) >> Rshift;
00750                         sG = (color & Gmask) >> Gshift;
00751                         sB = (color & Bmask) >> Bshift;
00752                         sA = (color & Amask) >> Ashift;
00753 
00754                         for (y = y1; y <= y2; y++) {
00755                                 row = (Uint32 *) dst->pixels + y * dst->pitch / 4;
00756                                 for (x = x1; x <= x2; x++) {
00757                                         if (alpha == 255) {
00758                                                 *(row + x) = color;
00759                                         } else {
00760                                                 pixel = row + x;
00761                                                 dc = *pixel;
00762 
00763                                                 dR = (dc & Rmask) >> Rshift;
00764                                                 dG = (dc & Gmask) >> Gshift;
00765                                                 dB = (dc & Bmask) >> Bshift;
00766 
00767                                                 R = ((dR + ((sR - dR) * alpha >> 8)) << Rshift) & Rmask;
00768                                                 G = ((dG + ((sG - dG) * alpha >> 8)) << Gshift) & Gmask;
00769                                                 B = ((dB + ((sB - dB) * alpha >> 8)) << Bshift) & Bmask;
00770                                                 *pixel = R | G | B;
00771                                                 if (Amask!=0) {
00772                                                         dA = (dc & Amask) >> Ashift;
00773 #ifdef ALPHA_PIXEL_ADDITIVE_BLEND
00774                                                         A = (dA | GFX_ALPHA_ADJUST_ARRAY[sA & 255]) << Ashift; // make destination less transparent...
00775 #else
00776                                                         A = ((dA + ((sA - dA) * alpha >> 8)) << Ashift) & Amask;
00777 #endif
00778                                                         *pixel |= A;
00779                                                 }
00780                                         }
00781                                 }
00782                         }
00783                 }
00784                 break;
00785 #endif
00786 
00787 #ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
00788         case 4:{                        /* Probably :-) 32-bpp */
00789                 Uint32 *row, *pixel;
00790                 Uint32 dR, dG, dB, dA;
00791                 Uint32 dc;
00792                 Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
00793                 Uint32 aTmp;
00794 
00795                 Rmask = format->Rmask;
00796                 Gmask = format->Gmask;
00797                 Bmask = format->Bmask;
00798                 Amask = format->Amask;
00799 
00800                 dR = (color & Rmask);
00801                 dG = (color & Gmask);
00802                 dB = (color & Bmask);
00803                 dA = (color & Amask);
00804 
00805                 Rshift = format->Rshift;
00806                 Gshift = format->Gshift;
00807                 Bshift = format->Bshift;
00808                 Ashift = format->Ashift;
00809 
00810                 preMultR = (alpha * (dR >> Rshift));
00811                 preMultG = (alpha * (dG >> Gshift));
00812                 preMultB = (alpha * (dB >> Bshift));
00813 
00814                 for (y = y1; y <= y2; y++) {
00815                         row = (Uint32 *) dst->pixels + y * dst->pitch / 4;
00816                         for (x = x1; x <= x2; x++) {
00817                                 if (alpha == 255) {
00818                                         *(row + x) = color;
00819                                 } else {
00820                                         pixel = row + x;
00821                                         dc = *pixel;
00822 
00823                                         surfaceAlpha = ((dc & Amask) >> Ashift);
00824                                         aTmp = (255 - alpha);
00825                                         if (A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 )) {
00826                                                 aTmp *= surfaceAlpha;
00827                                                 R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
00828                                                 G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
00829                                                 B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
00830                                         }
00831                                         *pixel = R | G | B | (A << Ashift & Amask);
00832                                 }
00833                         }
00834                 }
00835                    }
00836                    break;
00837 #endif
00838 
00839         }
00840 
00841         return (0);
00842 }
00843 
00856 int filledRectAlpha(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
00857 {
00858         Uint8 alpha;
00859         Uint32 mcolor;
00860         int result = 0;
00861 
00862         /*
00863         * Lock the surface 
00864         */
00865         if (SDL_MUSTLOCK(dst)) {
00866                 if (SDL_LockSurface(dst) < 0) {
00867                         return (-1);
00868                 }
00869         }
00870 
00871         /*
00872         * Setup color 
00873         */
00874         alpha = color & 0x000000ff;
00875         mcolor =
00876                 SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
00877                 (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
00878 
00879         /*
00880         * Draw 
00881         */
00882         result = _filledRectAlpha(dst, x1, y1, x2, y2, mcolor, alpha);
00883 
00884         /*
00885         * Unlock the surface 
00886         */
00887         if (SDL_MUSTLOCK(dst)) {
00888                 SDL_UnlockSurface(dst);
00889         }
00890 
00891         return (result);
00892 }
00893 
00905 int _HLineAlpha(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
00906 {
00907         return (filledRectAlpha(dst, x1, y, x2, y, color));
00908 }
00909 
00921 int _VLineAlpha(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
00922 {
00923         return (filledRectAlpha(dst, x, y1, x, y2, color));
00924 }
00925 
00937 int pixelColorWeight(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
00938 {
00939         Uint32 a;
00940 
00941         /*
00942         * Get alpha 
00943         */
00944         a = (color & (Uint32) 0x000000ff);
00945 
00946         /*
00947         * Modify Alpha by weight 
00948         */
00949         a = ((a * weight) >> 8);
00950 
00951         return (pixelColor(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a));
00952 }
00953 
00965 int pixelColorWeightNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
00966 {
00967         Uint32 a;
00968 
00969         /*
00970         * Get alpha 
00971         */
00972         a = (color & (Uint32) 0x000000ff);
00973 
00974         /*
00975         * Modify Alpha by weight 
00976         */
00977         a = ((a * weight) >> 8);
00978 
00979         return (pixelColorNolock(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a));
00980 }
00981 
00995 int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
00996 {
00997         Uint32 color;
00998 
00999         /*
01000         * Check Alpha 
01001         */
01002         if (a == 255) {
01003                 /*
01004                 * No alpha blending required 
01005                 */
01006                 /*
01007                 * Setup color 
01008                 */
01009                 color = SDL_MapRGBA(dst->format, r, g, b, a);
01010                 /*
01011                 * Draw 
01012                 */
01013                 return (fastPixelColor(dst, x, y, color));
01014         } else {
01015                 /*
01016                 * Alpha blending required 
01017                 */
01018                 /*
01019                 * Draw 
01020                 */
01021                 return (pixelColor(dst, x, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01022         }
01023 }
01024 
01025 
01041 int hlineColorStore(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
01042 {
01043         Sint16 left, right, top, bottom;
01044         Uint8 *pixel, *pixellast;
01045         int dx;
01046         int pixx, pixy;
01047         Sint16 w;
01048         Sint16 xtmp;
01049         int result = -1;
01050 
01051         /*
01052         * Check visibility of clipping rectangle
01053         */
01054         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
01055                 return(0);
01056         }
01057 
01058         /*
01059         * Swap x1, x2 if required to ensure x1<=x2
01060         */
01061         if (x1 > x2) {
01062                 xtmp = x1;
01063                 x1 = x2;
01064                 x2 = xtmp;
01065         }
01066 
01067         /*
01068         * Get clipping boundary and
01069         * check visibility of hline 
01070         */
01071         left = dst->clip_rect.x;
01072         if (x2<left) {
01073                 return(0);
01074         }
01075         right = dst->clip_rect.x + dst->clip_rect.w - 1;
01076         if (x1>right) {
01077                 return(0);
01078         }
01079         top = dst->clip_rect.y;
01080         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
01081         if ((y<top) || (y>bottom)) {
01082                 return (0);
01083         }
01084 
01085         /*
01086         * Clip x 
01087         */
01088         if (x1 < left) {
01089                 x1 = left;
01090         }
01091         if (x2 > right) {
01092                 x2 = right;
01093         }
01094 
01095         /*
01096         * Calculate width 
01097         */
01098         w = x2 - x1;
01099 
01100         /*
01101         * Lock the surface 
01102         */
01103         if (SDL_MUSTLOCK(dst)) {
01104                 if (SDL_LockSurface(dst) < 0) {
01105                         return (-1);
01106                 }
01107         }
01108 
01109         /*
01110         * More variable setup 
01111         */
01112         dx = w;
01113         pixx = dst->format->BytesPerPixel;
01114         pixy = dst->pitch;
01115         pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y;
01116 
01117         /*
01118         * Draw 
01119         */
01120         switch (dst->format->BytesPerPixel) {
01121         case 1:
01122                 memset(pixel, color, dx+1);
01123                 break;
01124         case 2:
01125                 pixellast = pixel + dx + dx;
01126                 for (; pixel <= pixellast; pixel += pixx) {
01127                         *(Uint16 *) pixel = color;
01128                 }
01129                 break;
01130         case 3:
01131                 pixellast = pixel + dx + dx + dx;
01132                 for (; pixel <= pixellast; pixel += pixx) {
01133                         if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
01134                                 pixel[0] = (color >> 16) & 0xff;
01135                                 pixel[1] = (color >> 8) & 0xff;
01136                                 pixel[2] = color & 0xff;
01137                         } else {
01138                                 pixel[0] = color & 0xff;
01139                                 pixel[1] = (color >> 8) & 0xff;
01140                                 pixel[2] = (color >> 16) & 0xff;
01141                         }
01142                 }
01143                 break;
01144         default:                /* case 4 */
01145                 dx = dx + dx;
01146                 pixellast = pixel + dx + dx;
01147                 for (; pixel <= pixellast; pixel += pixx) {
01148                         *(Uint32 *) pixel = color;
01149                 }
01150                 break;
01151         }
01152 
01153         /* 
01154         * Unlock surface 
01155         */
01156         if (SDL_MUSTLOCK(dst)) {
01157                 SDL_UnlockSurface(dst);
01158         }
01159 
01160         /*
01161         * Set result code 
01162         */
01163         result = 0;
01164 
01165         return (result);
01166 }
01167 
01185 int hlineRGBAStore(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01186 {
01187         /*
01188         * Draw 
01189         */
01190         return (hlineColorStore(dst, x1, x2, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01191 }
01192 
01204 int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
01205 {
01206         Sint16 left, right, top, bottom;
01207         Uint8 *pixel, *pixellast;
01208         int dx;
01209         int pixx, pixy;
01210         Sint16 xtmp;
01211         int result = -1;
01212         Uint8 *colorptr;
01213         Uint8 color3[3];
01214 
01215         /*
01216         * Check visibility of clipping rectangle
01217         */
01218         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
01219                 return(0);
01220         }
01221 
01222         /*
01223         * Swap x1, x2 if required to ensure x1<=x2
01224         */
01225         if (x1 > x2) {
01226                 xtmp = x1;
01227                 x1 = x2;
01228                 x2 = xtmp;
01229         }
01230 
01231         /*
01232         * Get clipping boundary and
01233         * check visibility of hline 
01234         */
01235         left = dst->clip_rect.x;
01236         if (x2<left) {
01237                 return(0);
01238         }
01239         right = dst->clip_rect.x + dst->clip_rect.w - 1;
01240         if (x1>right) {
01241                 return(0);
01242         }
01243         top = dst->clip_rect.y;
01244         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
01245         if ((y<top) || (y>bottom)) {
01246                 return (0);
01247         }
01248 
01249         /*
01250         * Clip x 
01251         */
01252         if (x1 < left) {
01253                 x1 = left;
01254         }
01255         if (x2 > right) {
01256                 x2 = right;
01257         }
01258 
01259         /*
01260         * Calculate width difference
01261         */
01262         dx = x2 - x1;
01263 
01264         /*
01265         * Alpha check 
01266         */
01267         if ((color & 255) == 255) {
01268 
01269                 /*
01270                 * No alpha-blending required 
01271                 */
01272 
01273                 /*
01274                 * Setup color 
01275                 */
01276                 colorptr = (Uint8 *) & color;
01277                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
01278                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
01279                 } else {
01280                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
01281                 }
01282 
01283                 /*
01284                 * Lock the surface 
01285                 */
01286                 if (SDL_MUSTLOCK(dst)) {
01287                         if (SDL_LockSurface(dst) < 0) {
01288                                 return (-1);
01289                         }
01290                 }
01291 
01292                 /*
01293                 * More variable setup 
01294                 */
01295                 pixx = dst->format->BytesPerPixel;
01296                 pixy = dst->pitch;
01297                 pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y;
01298 
01299                 /*
01300                 * Draw 
01301                 */
01302                 switch (dst->format->BytesPerPixel) {
01303                 case 1:
01304                         memset(pixel, color, dx + 1);
01305                         break;
01306                 case 2:
01307                         pixellast = pixel + dx + dx;
01308                         for (; pixel <= pixellast; pixel += pixx) {
01309                                 *(Uint16 *) pixel = color;
01310                         }
01311                         break;
01312                 case 3:
01313                         pixellast = pixel + dx + dx + dx;
01314                         if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
01315                                 color3[0] = (color >> 16) & 0xff;
01316                                 color3[1] = (color >> 8) & 0xff;
01317                                 color3[2] = color & 0xff;
01318                         } else {
01319                                 color3[0] = color & 0xff;
01320                                 color3[1] = (color >> 8) & 0xff;
01321                                 color3[2] = (color >> 16) & 0xff;
01322                         }
01323                         for (; pixel <= pixellast; pixel += pixx) {
01324                                 memcpy(pixel, color3, 3);
01325                         }
01326                         break;
01327                 default:                /* case 4 */
01328                         dx = dx + dx;
01329                         pixellast = pixel + dx + dx;
01330                         for (; pixel <= pixellast; pixel += pixx) {
01331                                 *(Uint32 *) pixel = color;
01332                         }
01333                         break;
01334                 }
01335 
01336                 /* 
01337                 * Unlock surface 
01338                 */
01339                 if (SDL_MUSTLOCK(dst)) {
01340                         SDL_UnlockSurface(dst);
01341                 }
01342 
01343                 /*
01344                 * Set result code 
01345                 */
01346                 result = 0;
01347 
01348         } else {
01349 
01350                 /*
01351                 * Alpha blending blit 
01352                 */
01353                 result = _HLineAlpha(dst, x1, x1 + dx, y, color);
01354         }
01355 
01356         return (result);
01357 }
01358 
01373 int hlineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01374 {
01375         /*
01376         * Draw 
01377         */
01378         return (hlineColor(dst, x1, x2, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01379 }
01380 
01392 int vlineColor(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
01393 {
01394         Sint16 left, right, top, bottom;
01395         Uint8 *pixel, *pixellast;
01396         int dy;
01397         int pixx, pixy;
01398         Sint16 h;
01399         Sint16 ytmp;
01400         int result = -1;
01401         Uint8 *colorptr;
01402 
01403         /*
01404         * Check visibility of clipping rectangle
01405         */
01406         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
01407                 return(0);
01408         }
01409 
01410         /*
01411         * Swap y1, y2 if required to ensure y1<=y2
01412         */
01413         if (y1 > y2) {
01414                 ytmp = y1;
01415                 y1 = y2;
01416                 y2 = ytmp;
01417         }
01418 
01419         /*
01420         * Get clipping boundary and
01421         * check visibility of vline 
01422         */
01423         left = dst->clip_rect.x;
01424         right = dst->clip_rect.x + dst->clip_rect.w - 1;
01425         if ((x<left) || (x>right)) {
01426                 return (0);
01427         }    
01428         top = dst->clip_rect.y;
01429         if (y2<top) {
01430                 return(0);
01431         }
01432         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
01433         if (y1>bottom) {
01434                 return(0);
01435         }
01436 
01437         /*
01438         * Clip x 
01439         */
01440         if (y1 < top) {
01441                 y1 = top;
01442         }
01443         if (y2 > bottom) {
01444                 y2 = bottom;
01445         }
01446 
01447         /*
01448         * Calculate height
01449         */
01450         h = y2 - y1;
01451 
01452         /*
01453         * Alpha check 
01454         */
01455         if ((color & 255) == 255) {
01456 
01457                 /*
01458                 * No alpha-blending required 
01459                 */
01460 
01461                 /*
01462                 * Setup color 
01463                 */
01464                 colorptr = (Uint8 *) & color;
01465                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
01466                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
01467                 } else {
01468                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
01469                 }
01470 
01471                 /*
01472                 * Lock the surface 
01473                 */
01474                 if (SDL_MUSTLOCK(dst)) {
01475                         if (SDL_LockSurface(dst) < 0) {
01476                                 return (-1);
01477                         }
01478                 }
01479 
01480                 /*
01481                 * More variable setup 
01482                 */
01483                 dy = h;
01484                 pixx = dst->format->BytesPerPixel;
01485                 pixy = dst->pitch;
01486                 pixel = ((Uint8 *) dst->pixels) + pixx * (int) x + pixy * (int) y1;
01487                 pixellast = pixel + pixy * dy;
01488 
01489                 /*
01490                 * Draw 
01491                 */
01492                 switch (dst->format->BytesPerPixel) {
01493                 case 1:
01494                         for (; pixel <= pixellast; pixel += pixy) {
01495                                 *(Uint8 *) pixel = color;
01496                         }
01497                         break;
01498                 case 2:
01499                         for (; pixel <= pixellast; pixel += pixy) {
01500                                 *(Uint16 *) pixel = color;
01501                         }
01502                         break;
01503                 case 3:
01504                         for (; pixel <= pixellast; pixel += pixy) {
01505                                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
01506                                         pixel[0] = (color >> 16) & 0xff;
01507                                         pixel[1] = (color >> 8) & 0xff;
01508                                         pixel[2] = color & 0xff;
01509                                 } else {
01510                                         pixel[0] = color & 0xff;
01511                                         pixel[1] = (color >> 8) & 0xff;
01512                                         pixel[2] = (color >> 16) & 0xff;
01513                                 }
01514                         }
01515                         break;
01516                 default:                /* case 4 */
01517                         for (; pixel <= pixellast; pixel += pixy) {
01518                                 *(Uint32 *) pixel = color;
01519                         }
01520                         break;
01521                 }
01522 
01523                 /* Unlock surface */
01524                 if (SDL_MUSTLOCK(dst)) {
01525                         SDL_UnlockSurface(dst);
01526                 }
01527 
01528                 /*
01529                 * Set result code 
01530                 */
01531                 result = 0;
01532 
01533         } else {
01534 
01535                 /*
01536                 * Alpha blending blit 
01537                 */
01538 
01539                 result = _VLineAlpha(dst, x, y1, y1 + h, color);
01540 
01541         }
01542 
01543         return (result);
01544 }
01545 
01560 int vlineRGBA(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01561 {
01562         /*
01563         * Draw 
01564         */
01565         return (vlineColor(dst, x, y1, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01566 }
01567 
01580 int rectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
01581 {
01582         int result;
01583         Sint16 tmp;
01584 
01585         /* Check destination surface */
01586         if (dst == NULL)
01587         {
01588                 return -1;
01589         }
01590 
01591         /*
01592         * Check visibility of clipping rectangle
01593         */
01594         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
01595                 return 0;
01596         }
01597 
01598         /*
01599         * Test for special cases of straight lines or single point 
01600         */
01601         if (x1 == x2) {
01602                 if (y1 == y2) {
01603                         return (pixelColor(dst, x1, y1, color));
01604                 } else {
01605                         return (vlineColor(dst, x1, y1, y2, color));
01606                 }
01607         } else {
01608                 if (y1 == y2) {
01609                         return (hlineColor(dst, x1, x2, y1, color));
01610                 }
01611         }
01612 
01613         /*
01614         * Swap x1, x2 if required 
01615         */
01616         if (x1 > x2) {
01617                 tmp = x1;
01618                 x1 = x2;
01619                 x2 = tmp;
01620         }
01621 
01622         /*
01623         * Swap y1, y2 if required 
01624         */
01625         if (y1 > y2) {
01626                 tmp = y1;
01627                 y1 = y2;
01628                 y2 = tmp;
01629         }
01630 
01631         /*
01632         * Draw rectangle 
01633         */
01634         result = 0;
01635         result |= hlineColor(dst, x1, x2, y1, color);
01636         result |= hlineColor(dst, x1, x2, y2, color);
01637         y1 += 1;
01638         y2 -= 1;
01639         if (y1 <= y2) {
01640                 result |= vlineColor(dst, x1, y1, y2, color);
01641                 result |= vlineColor(dst, x2, y1, y2, color);
01642         }
01643 
01644         return (result);
01645 
01646 }
01647 
01663 int rectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01664 {
01665         /*
01666         * Draw 
01667         */
01668         return (rectangleColor
01669                 (dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01670 }
01671 
01685 int roundedRectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
01686 {
01687         int result;
01688         Sint16 w, h, tmp;
01689         Sint16 xx1, xx2, yy1, yy2;
01690 
01691         /* 
01692         * Check destination surface 
01693         */
01694         if (dst == NULL)
01695         {
01696                 return -1;
01697         }
01698 
01699         /*
01700         * Check radius vor valid range
01701         */
01702         if (rad < 0) {
01703                 return -1;
01704         }
01705 
01706         /*
01707         * Special case - no rounding
01708         */
01709         if (rad == 0) {
01710                 return rectangleColor(dst, x1, y1, x2, y2, color);
01711         }
01712 
01713         /*
01714         * Check visibility of clipping rectangle
01715         */
01716         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
01717                 return 0;
01718         }
01719 
01720         /*
01721         * Test for special cases of straight lines or single point 
01722         */
01723         if (x1 == x2) {
01724                 if (y1 == y2) {
01725                         return (pixelColor(dst, x1, y1, color));
01726                 } else {
01727                         return (vlineColor(dst, x1, y1, y2, color));
01728                 }
01729         } else {
01730                 if (y1 == y2) {
01731                         return (hlineColor(dst, x1, x2, y1, color));
01732                 }
01733         }
01734 
01735         /*
01736         * Swap x1, x2 if required 
01737         */
01738         if (x1 > x2) {
01739                 tmp = x1;
01740                 x1 = x2;
01741                 x2 = tmp;
01742         }
01743 
01744         /*
01745         * Swap y1, y2 if required 
01746         */
01747         if (y1 > y2) {
01748                 tmp = y1;
01749                 y1 = y2;
01750                 y2 = tmp;
01751         }
01752 
01753         /*
01754         * Calculate width&height 
01755         */
01756         w = x2 - x1;
01757         h = y2 - y1;
01758 
01759         /*
01760         * Maybe adjust radius
01761         */
01762         if ((rad * 2) > w)  
01763         {
01764                 rad = w / 2;
01765         }
01766         if ((rad * 2) > h)
01767         {
01768                 rad = h / 2;
01769         }
01770 
01771         /*
01772         * Draw corners
01773         */
01774         result = 0;
01775         xx1 = x1 + rad;
01776         xx2 = x2 - rad;
01777         yy1 = y1 + rad;
01778         yy2 = y2 - rad;
01779         result |= arcColor(dst, xx1, yy1, rad, 180, 270, color);
01780         result |= arcColor(dst, xx2, yy1, rad, 270, 360, color);
01781         result |= arcColor(dst, xx1, yy2, rad,  90, 180, color);
01782         result |= arcColor(dst, xx2, yy2, rad,   0,  90, color);
01783 
01784         /*
01785         * Draw lines
01786         */
01787         if (xx1 <= xx2) {
01788                 result |= hlineColor(dst, xx1, xx2, y1, color);
01789                 result |= hlineColor(dst, xx1, xx2, y2, color);
01790         }
01791         if (yy1 <= yy2) {
01792                 result |= vlineColor(dst, x1, yy1, yy2, color);
01793                 result |= vlineColor(dst, x2, yy1, yy2, color);
01794         }
01795 
01796         return result;
01797 }
01798 
01815 int roundedRectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01816 {
01817         /*
01818         * Draw 
01819         */
01820         return (roundedRectangleColor
01821                 (dst, x1, y1, x2, y2, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01822 }
01823 
01837 int roundedBoxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
01838 {
01839         int result;
01840         Sint16 w, h, tmp;
01841         Sint16 xx1, xx2, yy1, yy2;
01842 
01843         /* 
01844         * Check destination surface 
01845         */
01846         if (dst == NULL)
01847         {
01848                 return -1;
01849         }
01850 
01851         /*
01852         * Check radius vor valid range
01853         */
01854         if (rad < 0) {
01855                 return -1;
01856         }
01857 
01858         /*
01859         * Special case - no rounding
01860         */
01861         if (rad == 0) {
01862                 return rectangleColor(dst, x1, y1, x2, y2, color);
01863         }
01864 
01865         /*
01866         * Check visibility of clipping rectangle
01867         */
01868         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
01869                 return 0;
01870         }
01871 
01872         /*
01873         * Test for special cases of straight lines or single point 
01874         */
01875         if (x1 == x2) {
01876                 if (y1 == y2) {
01877                         return (pixelColor(dst, x1, y1, color));
01878                 } else {
01879                         return (vlineColor(dst, x1, y1, y2, color));
01880                 }
01881         } else {
01882                 if (y1 == y2) {
01883                         return (hlineColor(dst, x1, x2, y1, color));
01884                 }
01885         }
01886 
01887         /*
01888         * Swap x1, x2 if required 
01889         */
01890         if (x1 > x2) {
01891                 tmp = x1;
01892                 x1 = x2;
01893                 x2 = tmp;
01894         }
01895 
01896         /*
01897         * Swap y1, y2 if required 
01898         */
01899         if (y1 > y2) {
01900                 tmp = y1;
01901                 y1 = y2;
01902                 y2 = tmp;
01903         }
01904 
01905         /*
01906         * Calculate width&height 
01907         */
01908         w = x2 - x1;
01909         h = y2 - y1;
01910 
01911         /*
01912         * Maybe adjust radius
01913         */
01914         if ((rad * 2) > w)  
01915         {
01916                 rad = w / 2;
01917         }
01918         if ((rad * 2) > h)
01919         {
01920                 rad = h / 2;
01921         }
01922 
01923         /*
01924         * Draw corners
01925         */
01926         result = 0;
01927         xx1 = x1 + rad;
01928         xx2 = x2 - rad;
01929         yy1 = y1 + rad;
01930         yy2 = y2 - rad;
01931         result |= filledPieColor(dst, xx1, yy1, rad, 180, 270, color);
01932         result |= filledPieColor(dst, xx2, yy1, rad, 270, 360, color);
01933         result |= filledPieColor(dst, xx1, yy2, rad,  90, 180, color);
01934         result |= filledPieColor(dst, xx2, yy2, rad,   0,  90, color);
01935 
01936         /*
01937         * Draw body
01938         */
01939         xx1++;
01940         xx2--;
01941         yy1++;
01942         yy2--;
01943         if (xx1 <= xx2) {
01944                 result |= boxColor(dst, xx1, y1, xx2, y2, color);
01945         }
01946         if (yy1 <= yy2) {
01947                 result |= boxColor(dst, x1, yy1, xx1-1, yy2, color);
01948                 result |= boxColor(dst, xx2+1, yy1, x2, yy2, color);
01949         }
01950 
01951         return result;
01952 }
01953 
01970 int roundedBoxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
01971         Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
01972 {
01973         /*
01974         * Draw 
01975         */
01976         return (roundedBoxColor
01977                 (dst, x1, y1, x2, y2, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
01978 }
01979 
01980 /* --------- Clipping routines for line */
01981 
01982 /* Clipping based heavily on code from                       */
01983 /* http://www.ncsa.uiuc.edu/Vis/Graphics/src/clipCohSuth.c   */
01984 
01985 #define CLIP_LEFT_EDGE   0x1
01986 #define CLIP_RIGHT_EDGE  0x2
01987 #define CLIP_BOTTOM_EDGE 0x4
01988 #define CLIP_TOP_EDGE    0x8
01989 #define CLIP_INSIDE(a)   (!a)
01990 #define CLIP_REJECT(a,b) (a&b)
01991 #define CLIP_ACCEPT(a,b) (!(a|b))
01992 
02005 static int _clipEncode(Sint16 x, Sint16 y, Sint16 left, Sint16 top, Sint16 right, Sint16 bottom)
02006 {
02007         int code = 0;
02008 
02009         if (x < left) {
02010                 code |= CLIP_LEFT_EDGE;
02011         } else if (x > right) {
02012                 code |= CLIP_RIGHT_EDGE;
02013         }
02014         if (y < top) {
02015                 code |= CLIP_TOP_EDGE;
02016         } else if (y > bottom) {
02017                 code |= CLIP_BOTTOM_EDGE;
02018         }
02019         return code;
02020 }
02021 
02031 static int _clipLine(SDL_Surface * dst, Sint16 * x1, Sint16 * y1, Sint16 * x2, Sint16 * y2)
02032 {
02033         Sint16 left, right, top, bottom;
02034         int code1, code2;
02035         int draw = 0;
02036         Sint16 swaptmp;
02037         float m;
02038 
02039         /*
02040         * Get clipping boundary 
02041         */
02042         left = dst->clip_rect.x;
02043         right = dst->clip_rect.x + dst->clip_rect.w - 1;
02044         top = dst->clip_rect.y;
02045         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
02046 
02047         while (1) {
02048                 code1 = _clipEncode(*x1, *y1, left, top, right, bottom);
02049                 code2 = _clipEncode(*x2, *y2, left, top, right, bottom);
02050                 if (CLIP_ACCEPT(code1, code2)) {
02051                         draw = 1;
02052                         break;
02053                 } else if (CLIP_REJECT(code1, code2))
02054                         break;
02055                 else {
02056                         if (CLIP_INSIDE(code1)) {
02057                                 swaptmp = *x2;
02058                                 *x2 = *x1;
02059                                 *x1 = swaptmp;
02060                                 swaptmp = *y2;
02061                                 *y2 = *y1;
02062                                 *y1 = swaptmp;
02063                                 swaptmp = code2;
02064                                 code2 = code1;
02065                                 code1 = swaptmp;
02066                         }
02067                         if (*x2 != *x1) {
02068                                 m = (float)(*y2 - *y1) / (float)(*x2 - *x1);
02069                         } else {
02070                                 m = 1.0f;
02071                         }
02072                         if (code1 & CLIP_LEFT_EDGE) {
02073                                 *y1 += (Sint16) ((left - *x1) * m);
02074                                 *x1 = left;
02075                         } else if (code1 & CLIP_RIGHT_EDGE) {
02076                                 *y1 += (Sint16) ((right - *x1) * m);
02077                                 *x1 = right;
02078                         } else if (code1 & CLIP_BOTTOM_EDGE) {
02079                                 if (*x2 != *x1) {
02080                                         *x1 += (Sint16) ((bottom - *y1) / m);
02081                                 }
02082                                 *y1 = bottom;
02083                         } else if (code1 & CLIP_TOP_EDGE) {
02084                                 if (*x2 != *x1) {
02085                                         *x1 += (Sint16) ((top - *y1) / m);
02086                                 }
02087                                 *y1 = top;
02088                         }
02089                 }
02090         }
02091 
02092         return draw;
02093 }
02094 
02107 int boxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
02108 {
02109         Sint16 left, right, top, bottom;
02110         Uint8 *pixel, *pixellast;
02111         int x, dx;
02112         int dy;
02113         int pixx, pixy;
02114         Sint16 w, h, tmp;
02115         int result;
02116         Uint8 *colorptr;
02117 
02118         /*
02119         * Check visibility of clipping rectangle
02120         */
02121         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
02122                 return(0);
02123         }
02124 
02125         /*
02126         * Order coordinates to ensure that
02127         * x1<=x2 and y1<=y2 
02128         */
02129         if (x1 > x2) {
02130                 tmp = x1;
02131                 x1 = x2;
02132                 x2 = tmp;
02133         }
02134         if (y1 > y2) {
02135                 tmp = y1;
02136                 y1 = y2;
02137                 y2 = tmp;
02138         }
02139 
02140         /* 
02141         * Get clipping boundary and 
02142         * check visibility 
02143         */
02144         left = dst->clip_rect.x;
02145         if (x2<left) {
02146                 return(0);
02147         }
02148         right = dst->clip_rect.x + dst->clip_rect.w - 1;
02149         if (x1>right) {
02150                 return(0);
02151         }
02152         top = dst->clip_rect.y;
02153         if (y2<top) {
02154                 return(0);
02155         }
02156         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
02157         if (y1>bottom) {
02158                 return(0);
02159         }
02160 
02161         /* Clip all points */
02162         if (x1<left) { 
02163                 x1=left; 
02164         } else if (x1>right) {
02165                 x1=right;
02166         }
02167         if (x2<left) { 
02168                 x2=left; 
02169         } else if (x2>right) {
02170                 x2=right;
02171         }
02172         if (y1<top) { 
02173                 y1=top; 
02174         } else if (y1>bottom) {
02175                 y1=bottom;
02176         }
02177         if (y2<top) { 
02178                 y2=top; 
02179         } else if (y2>bottom) {
02180                 y2=bottom;
02181         }
02182 
02183         /*
02184         * Test for special cases of straight line or single point 
02185         */
02186         if (x1 == x2) {
02187                 if (y1 == y2) {
02188                         return (pixelColor(dst, x1, y1, color));
02189                 } else { 
02190                         return (vlineColor(dst, x1, y1, y2, color));
02191                 }
02192         }
02193         if (y1 == y2) {
02194                 return (hlineColor(dst, x1, x2, y1, color));
02195         }
02196 
02197         /*
02198         * Calculate width&height 
02199         */
02200         w = x2 - x1;
02201         h = y2 - y1;
02202 
02203         /*
02204         * Alpha check 
02205         */
02206         if ((color & 255) == 255) {
02207 
02208                 /*
02209                 * No alpha-blending required 
02210                 */
02211 
02212                 /*
02213                 * Setup color 
02214                 */
02215                 colorptr = (Uint8 *) & color;
02216                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
02217                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
02218                 } else {
02219                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
02220                 }
02221 
02222                 /*
02223                 * Lock the surface 
02224                 */
02225                 if (SDL_MUSTLOCK(dst)) {
02226                         if (SDL_LockSurface(dst) < 0) {
02227                                 return (-1);
02228                         }
02229                 }
02230 
02231                 /*
02232                 * More variable setup 
02233                 */
02234                 dx = w;
02235                 dy = h;
02236                 pixx = dst->format->BytesPerPixel;
02237                 pixy = dst->pitch;
02238                 pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y1;
02239                 pixellast = pixel + pixx * dx + pixy * dy;
02240                 dx++;
02241 
02242                 /*
02243                 * Draw 
02244                 */
02245                 switch (dst->format->BytesPerPixel) {
02246                 case 1:
02247                         for (; pixel <= pixellast; pixel += pixy) {
02248                                 memset(pixel, (Uint8) color, dx);
02249                         }
02250                         break;
02251                 case 2:
02252                         pixy -= (pixx * dx);
02253                         for (; pixel <= pixellast; pixel += pixy) {
02254                                 for (x = 0; x < dx; x++) {
02255                                         *(Uint16*) pixel = color;
02256                                         pixel += pixx;
02257                                 }
02258                         }
02259                         break;
02260                 case 3:
02261                         pixy -= (pixx * dx);
02262                         for (; pixel <= pixellast; pixel += pixy) {
02263                                 for (x = 0; x < dx; x++) {
02264                                         if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
02265                                                 pixel[0] = (color >> 16) & 0xff;
02266                                                 pixel[1] = (color >> 8) & 0xff;
02267                                                 pixel[2] = color & 0xff;
02268                                         } else {
02269                                                 pixel[0] = color & 0xff;
02270                                                 pixel[1] = (color >> 8) & 0xff;
02271                                                 pixel[2] = (color >> 16) & 0xff;
02272                                         }
02273                                         pixel += pixx;
02274                                 }
02275                         }
02276                         break;
02277                 default:                /* case 4 */
02278                         pixy -= (pixx * dx);
02279                         for (; pixel <= pixellast; pixel += pixy) {
02280                                 for (x = 0; x < dx; x++) {
02281                                         *(Uint32 *) pixel = color;
02282                                         pixel += pixx;
02283                                 }
02284                         }
02285                         break;
02286                 }
02287 
02288                 /* Unlock surface */
02289                 if (SDL_MUSTLOCK(dst)) {
02290                         SDL_UnlockSurface(dst);
02291                 }
02292 
02293                 result = 0;
02294 
02295         } else {
02296 
02297                 result = filledRectAlpha(dst, x1, y1, x1 + w, y1 + h, color);
02298 
02299         }
02300 
02301         return (result);
02302 }
02303 
02319 int boxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02320 {
02321         /*
02322         * Draw 
02323         */
02324         return (boxColor(dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
02325 }
02326 
02327 /* ----- Line */
02328 
02329 /* Non-alpha line drawing code adapted from routine          */
02330 /* by Pete Shinners, pete@shinners.org                       */
02331 /* Originally from pygame, http://pygame.seul.org            */
02332 
02333 #define ABS(a) (((a)<0) ? -(a) : (a))
02334 
02347 int lineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
02348 {
02349         int pixx, pixy;
02350         int x, y;
02351         int dx, dy;
02352         int ax, ay;
02353         int sx, sy;
02354         int swaptmp;
02355         Uint8 *pixel;
02356         Uint8 *colorptr;
02357 
02358         /*
02359         * Clip line and test if we have to draw 
02360         */
02361         if (!(_clipLine(dst, &x1, &y1, &x2, &y2))) {
02362                 return (0);
02363         }
02364 
02365         /*
02366         * Test for special cases of straight lines or single point 
02367         */
02368         if (x1 == x2) {
02369                 if (y1 < y2) {
02370                         return (vlineColor(dst, x1, y1, y2, color));
02371                 } else if (y1 > y2) {
02372                         return (vlineColor(dst, x1, y2, y1, color));
02373                 } else {
02374                         return (pixelColor(dst, x1, y1, color));
02375                 }
02376         }
02377         if (y1 == y2) {
02378                 if (x1 < x2) {
02379                         return (hlineColor(dst, x1, x2, y1, color));
02380                 } else if (x1 > x2) {
02381                         return (hlineColor(dst, x2, x1, y1, color));
02382                 }
02383         }
02384 
02385         /*
02386         * Variable setup 
02387         */
02388         dx = x2 - x1;
02389         dy = y2 - y1;
02390         sx = (dx >= 0) ? 1 : -1;
02391         sy = (dy >= 0) ? 1 : -1;
02392 
02393         /* Lock surface */
02394         if (SDL_MUSTLOCK(dst)) {
02395                 if (SDL_LockSurface(dst) < 0) {
02396                         return (-1);
02397                 }
02398         }
02399 
02400         /*
02401         * Check for alpha blending 
02402         */
02403         if ((color & 255) == 255) {
02404 
02405                 /*
02406                 * No alpha blending - use fast pixel routines 
02407                 */
02408 
02409                 /*
02410                 * Setup color 
02411                 */
02412                 colorptr = (Uint8 *) & color;
02413                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
02414                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
02415                 } else {
02416                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
02417                 }
02418 
02419                 /*
02420                 * More variable setup 
02421                 */
02422                 dx = sx * dx + 1;
02423                 dy = sy * dy + 1;
02424                 pixx = dst->format->BytesPerPixel;
02425                 pixy = dst->pitch;
02426                 pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y1;
02427                 pixx *= sx;
02428                 pixy *= sy;
02429                 if (dx < dy) {
02430                         swaptmp = dx;
02431                         dx = dy;
02432                         dy = swaptmp;
02433                         swaptmp = pixx;
02434                         pixx = pixy;
02435                         pixy = swaptmp;
02436                 }
02437 
02438                 /*
02439                 * Draw 
02440                 */
02441                 x = 0;
02442                 y = 0;
02443                 switch (dst->format->BytesPerPixel) {
02444                 case 1:
02445                         for (; x < dx; x++, pixel += pixx) {
02446                                 *pixel = color;
02447                                 y += dy;
02448                                 if (y >= dx) {
02449                                         y -= dx;
02450                                         pixel += pixy;
02451                                 }
02452                         }
02453                         break;
02454                 case 2:
02455                         for (; x < dx; x++, pixel += pixx) {
02456                                 *(Uint16 *) pixel = color;
02457                                 y += dy;
02458                                 if (y >= dx) {
02459                                         y -= dx;
02460                                         pixel += pixy;
02461                                 }
02462                         }
02463                         break;
02464                 case 3:
02465                         for (; x < dx; x++, pixel += pixx) {
02466                                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
02467                                         pixel[0] = (color >> 16) & 0xff;
02468                                         pixel[1] = (color >> 8) & 0xff;
02469                                         pixel[2] = color & 0xff;
02470                                 } else {
02471                                         pixel[0] = color & 0xff;
02472                                         pixel[1] = (color >> 8) & 0xff;
02473                                         pixel[2] = (color >> 16) & 0xff;
02474                                 }
02475                                 y += dy;
02476                                 if (y >= dx) {
02477                                         y -= dx;
02478                                         pixel += pixy;
02479                                 }
02480                         }
02481                         break;
02482                 default:                /* case 4 */
02483                         for (; x < dx; x++, pixel += pixx) {
02484                                 *(Uint32 *) pixel = color;
02485                                 y += dy;
02486                                 if (y >= dx) {
02487                                         y -= dx;
02488                                         pixel += pixy;
02489                                 }
02490                         }
02491                         break;
02492                 }
02493 
02494         } else {
02495 
02496                 /*
02497                 * Alpha blending required - use single-pixel blits 
02498                 */
02499 
02500                 ax = ABS(dx) << 1;
02501                 ay = ABS(dy) << 1;
02502                 x = x1;
02503                 y = y1;
02504                 if (ax > ay) {
02505                         int d = ay - (ax >> 1);
02506 
02507                         while (x != x2) {
02508                                 pixelColorNolock (dst, x, y, color);
02509                                 if (d > 0 || (d == 0 && sx == 1)) {
02510                                         y += sy;
02511                                         d -= ax;
02512                                 }
02513                                 x += sx;
02514                                 d += ay;
02515                         }
02516                 } else {
02517                         int d = ax - (ay >> 1);
02518 
02519                         while (y != y2) {
02520                                 pixelColorNolock (dst, x, y, color);
02521                                 if (d > 0 || ((d == 0) && (sy == 1))) {
02522                                         x += sx;
02523                                         d -= ay;
02524                                 }
02525                                 y += sy;
02526                                 d += ax;
02527                         }
02528                 }
02529                 pixelColorNolock (dst, x, y, color);
02530 
02531         }
02532 
02533         /* Unlock surface */
02534         if (SDL_MUSTLOCK(dst)) {
02535                 SDL_UnlockSurface(dst);
02536         }
02537 
02538         return (0);
02539 }
02540 
02556 int lineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02557 {
02558         /*
02559         * Draw 
02560         */
02561         return (lineColor(dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
02562 }
02563 
02564 /* AA Line */
02565 
02566 #define AAlevels 256
02567 #define AAbits 8
02568 
02589 int _aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, int draw_endpoint)
02590 {
02591         Sint32 xx0, yy0, xx1, yy1;
02592         int result;
02593         Uint32 intshift, erracc, erradj;
02594         Uint32 erracctmp, wgt, wgtcompmask;
02595         int dx, dy, tmp, xdir, y0p1, x0pxdir;
02596 
02597         /*
02598         * Check visibility of clipping rectangle
02599         */
02600         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
02601                 return(0);
02602         }
02603 
02604         /*
02605         * Clip line and test if we have to draw 
02606         */
02607         if (!(_clipLine(dst, &x1, &y1, &x2, &y2))) {
02608                 return (0);
02609         }
02610 
02611         /*
02612         * Keep on working with 32bit numbers 
02613         */
02614         xx0 = x1;
02615         yy0 = y1;
02616         xx1 = x2;
02617         yy1 = y2;
02618 
02619         /*
02620         * Reorder points if required 
02621         */
02622         if (yy0 > yy1) {
02623                 tmp = yy0;
02624                 yy0 = yy1;
02625                 yy1 = tmp;
02626                 tmp = xx0;
02627                 xx0 = xx1;
02628                 xx1 = tmp;
02629         }
02630 
02631         /*
02632         * Calculate distance 
02633         */
02634         dx = xx1 - xx0;
02635         dy = yy1 - yy0;
02636 
02637         /*
02638         * Check for special cases 
02639         */
02640         if (dx == 0) {
02641                 /*
02642                 * Vertical line 
02643                 */
02644                 if (draw_endpoint)
02645                 {
02646                         return (vlineColor(dst, x1, y1, y2, color));
02647                 } else {
02648                         if (dy>0) {
02649                                 return (vlineColor(dst, x1, yy0, yy0+dy, color));
02650                         } else {
02651                                 return (pixelColor(dst, x1, y1, color));
02652                         }
02653                 }
02654         } else if (dy == 0) {
02655                 /*
02656                 * Horizontal line 
02657                 */
02658                 if (draw_endpoint)
02659                 {
02660                         return (hlineColor(dst, x1, x2, y1, color));
02661                 } else {
02662                         if (dx!=0) {
02663                                 return (hlineColor(dst, xx0, xx0+dx, y1, color));
02664                         } else {
02665                                 return (pixelColor(dst, x1, y1, color));
02666                         }
02667                 }
02668         } else if ((dx == dy) && (draw_endpoint)) {
02669                 /*
02670                 * Diagonal line (with endpoint)
02671                 */
02672                 return (lineColor(dst, x1, y1, x2, y2, color));
02673         }
02674 
02675         /*
02676         * Adjust for negative dx and set xdir 
02677         */
02678         if (dx >= 0) {
02679                 xdir = 1;
02680         } else {
02681                 xdir = -1;
02682                 dx = (-dx);
02683         }
02684 
02685         /*
02686         * Line is not horizontal, vertical or diagonal (with endpoint)
02687         */
02688         result = 0;
02689 
02690         /*
02691         * Zero accumulator 
02692         */
02693         erracc = 0;
02694 
02695         /*
02696         * # of bits by which to shift erracc to get intensity level 
02697         */
02698         intshift = 32 - AAbits;
02699 
02700         /*
02701         * Mask used to flip all bits in an intensity weighting 
02702         */
02703         wgtcompmask = AAlevels - 1;
02704 
02705         /* Lock surface */
02706         if (SDL_MUSTLOCK(dst)) {
02707                 if (SDL_LockSurface(dst) < 0) {
02708                         return (-1);
02709                 }
02710         }
02711 
02712         /*
02713         * Draw the initial pixel in the foreground color 
02714         */
02715         result |= pixelColorNolock(dst, x1, y1, color);
02716 
02717         /*
02718         * x-major or y-major? 
02719         */
02720         if (dy > dx) {
02721 
02722                 /*
02723                 * y-major.  Calculate 16-bit fixed point fractional part of a pixel that
02724                 * X advances every time Y advances 1 pixel, truncating the result so that
02725                 * we won't overrun the endpoint along the X axis 
02726                 */
02727                 /*
02728                 * Not-so-portable version: erradj = ((Uint64)dx << 32) / (Uint64)dy; 
02729                 */
02730                 erradj = ((dx << 16) / dy) << 16;
02731 
02732                 /*
02733                 * draw all pixels other than the first and last 
02734                 */
02735                 x0pxdir = xx0 + xdir;
02736                 while (--dy) {
02737                         erracctmp = erracc;
02738                         erracc += erradj;
02739                         if (erracc <= erracctmp) {
02740                                 /*
02741                                 * rollover in error accumulator, x coord advances 
02742                                 */
02743                                 xx0 = x0pxdir;
02744                                 x0pxdir += xdir;
02745                         }
02746                         yy0++;          /* y-major so always advance Y */
02747 
02748                         /*
02749                         * the AAbits most significant bits of erracc give us the intensity
02750                         * weighting for this pixel, and the complement of the weighting for
02751                         * the paired pixel. 
02752                         */
02753                         wgt = (erracc >> intshift) & 255;
02754                         result |= pixelColorWeightNolock (dst, xx0, yy0, color, 255 - wgt);
02755                         result |= pixelColorWeightNolock (dst, x0pxdir, yy0, color, wgt);
02756                 }
02757 
02758         } else {
02759 
02760                 /*
02761                 * x-major line.  Calculate 16-bit fixed-point fractional part of a pixel
02762                 * that Y advances each time X advances 1 pixel, truncating the result so
02763                 * that we won't overrun the endpoint along the X axis. 
02764                 */
02765                 /*
02766                 * Not-so-portable version: erradj = ((Uint64)dy << 32) / (Uint64)dx; 
02767                 */
02768                 erradj = ((dy << 16) / dx) << 16;
02769 
02770                 /*
02771                 * draw all pixels other than the first and last 
02772                 */
02773                 y0p1 = yy0 + 1;
02774                 while (--dx) {
02775 
02776                         erracctmp = erracc;
02777                         erracc += erradj;
02778                         if (erracc <= erracctmp) {
02779                                 /*
02780                                 * Accumulator turned over, advance y 
02781                                 */
02782                                 yy0 = y0p1;
02783                                 y0p1++;
02784                         }
02785                         xx0 += xdir;    /* x-major so always advance X */
02786                         /*
02787                         * the AAbits most significant bits of erracc give us the intensity
02788                         * weighting for this pixel, and the complement of the weighting for
02789                         * the paired pixel. 
02790                         */
02791                         wgt = (erracc >> intshift) & 255;
02792                         result |= pixelColorWeightNolock (dst, xx0, yy0, color, 255 - wgt);
02793                         result |= pixelColorWeightNolock (dst, xx0, y0p1, color, wgt);
02794                 }
02795         }
02796 
02797         /*
02798         * Do we have to draw the endpoint 
02799         */
02800         if (draw_endpoint) {
02801                 /*
02802                 * Draw final pixel, always exactly intersected by the line and doesn't
02803                 * need to be weighted. 
02804                 */
02805                 result |= pixelColorNolock (dst, x2, y2, color);
02806         }
02807 
02808         /* Unlock surface */
02809         if (SDL_MUSTLOCK(dst)) {
02810                 SDL_UnlockSurface(dst);
02811         }
02812 
02813         return (result);
02814 }
02815 
02828 int aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
02829 {
02830         return (_aalineColor(dst, x1, y1, x2, y2, color, 1));
02831 }
02832 
02848 int aalineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
02849 {
02850         return (_aalineColor
02851                 (dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, 1));
02852 }
02853 
02854 
02855 /* ----- Circle */
02856 
02872 int circleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
02873 {
02874         Sint16 left, right, top, bottom;
02875         int result;
02876         Sint16 x1, y1, x2, y2;
02877         Sint16 cx = 0;
02878         Sint16 cy = rad;
02879         Sint16 df = 1 - rad;
02880         Sint16 d_e = 3;
02881         Sint16 d_se = -2 * rad + 5;
02882         Sint16 xpcx, xmcx, xpcy, xmcy;
02883         Sint16 ypcy, ymcy, ypcx, ymcx;
02884         Uint8 *colorptr;
02885 
02886         /*
02887         * Check visibility of clipping rectangle
02888         */
02889         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
02890                 return(0);
02891         }
02892 
02893         /*
02894         * Sanity check radius 
02895         */
02896         if (rad < 0) {
02897                 return (-1);
02898         }
02899 
02900         /*
02901         * Special case for rad=0 - draw a point 
02902         */
02903         if (rad == 0) {
02904                 return (pixelColor(dst, x, y, color));
02905         }
02906 
02907         /*
02908         * Get circle and clipping boundary and 
02909         * test if bounding box of circle is visible 
02910         */
02911         x2 = x + rad;
02912         left = dst->clip_rect.x;
02913         if (x2<left) {
02914                 return(0);
02915         } 
02916         x1 = x - rad;
02917         right = dst->clip_rect.x + dst->clip_rect.w - 1;
02918         if (x1>right) {
02919                 return(0);
02920         } 
02921         y2 = y + rad;
02922         top = dst->clip_rect.y;
02923         if (y2<top) {
02924                 return(0);
02925         } 
02926         y1 = y - rad;
02927         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
02928         if (y1>bottom) {
02929                 return(0);
02930         } 
02931 
02932         /*
02933         * Draw circle 
02934         */
02935         result = 0;
02936 
02937         /* Lock surface */
02938         if (SDL_MUSTLOCK(dst)) {
02939                 if (SDL_LockSurface(dst) < 0) {
02940                         return (-1);
02941                 }
02942         }
02943 
02944         /*
02945         * Alpha Check 
02946         */
02947         if ((color & 255) == 255) {
02948 
02949                 /*
02950                 * No Alpha - direct memory writes 
02951                 */
02952 
02953                 /*
02954                 * Setup color 
02955                 */
02956                 colorptr = (Uint8 *) & color;
02957                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
02958                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
02959                 } else {
02960                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
02961                 }
02962 
02963                 /*
02964                 * Draw 
02965                 */
02966                 do {
02967                         ypcy = y + cy;
02968                         ymcy = y - cy;
02969                         if (cx > 0) {
02970                                 xpcx = x + cx;
02971                                 xmcx = x - cx;
02972                                 result |= fastPixelColorNolock(dst, xmcx, ypcy, color);
02973                                 result |= fastPixelColorNolock(dst, xpcx, ypcy, color);
02974                                 result |= fastPixelColorNolock(dst, xmcx, ymcy, color);
02975                                 result |= fastPixelColorNolock(dst, xpcx, ymcy, color);
02976                         } else {
02977                                 result |= fastPixelColorNolock(dst, x, ymcy, color);
02978                                 result |= fastPixelColorNolock(dst, x, ypcy, color);
02979                         }
02980                         xpcy = x + cy;
02981                         xmcy = x - cy;
02982                         if ((cx > 0) && (cx != cy)) {
02983                                 ypcx = y + cx;
02984                                 ymcx = y - cx;
02985                                 result |= fastPixelColorNolock(dst, xmcy, ypcx, color);
02986                                 result |= fastPixelColorNolock(dst, xpcy, ypcx, color);
02987                                 result |= fastPixelColorNolock(dst, xmcy, ymcx, color);
02988                                 result |= fastPixelColorNolock(dst, xpcy, ymcx, color);
02989                         } else if (cx == 0) {
02990                                 result |= fastPixelColorNolock(dst, xmcy, y, color);
02991                                 result |= fastPixelColorNolock(dst, xpcy, y, color);
02992                         }
02993                         /*
02994                         * Update 
02995                         */
02996                         if (df < 0) {
02997                                 df += d_e;
02998                                 d_e += 2;
02999                                 d_se += 2;
03000                         } else {
03001                                 df += d_se;
03002                                 d_e += 2;
03003                                 d_se += 4;
03004                                 cy--;
03005                         }
03006                         cx++;
03007                 } while (cx <= cy);
03008 
03009                 /*
03010                 * Unlock surface 
03011                 */
03012                 SDL_UnlockSurface(dst);
03013 
03014         } else {
03015 
03016                 /*
03017                 * Using Alpha - blended pixel blits 
03018                 */
03019 
03020                 do {
03021                         /*
03022                         * Draw 
03023                         */
03024                         ypcy = y + cy;
03025                         ymcy = y - cy;
03026                         if (cx > 0) {
03027                                 xpcx = x + cx;
03028                                 xmcx = x - cx;
03029                                 result |= pixelColorNolock (dst, xmcx, ypcy, color);
03030                                 result |= pixelColorNolock (dst, xpcx, ypcy, color);
03031                                 result |= pixelColorNolock (dst, xmcx, ymcy, color);
03032                                 result |= pixelColorNolock (dst, xpcx, ymcy, color);
03033                         } else {
03034                                 result |= pixelColorNolock (dst, x, ymcy, color);
03035                                 result |= pixelColorNolock (dst, x, ypcy, color);
03036                         }
03037                         xpcy = x + cy;
03038                         xmcy = x - cy;
03039                         if ((cx > 0) && (cx != cy)) {
03040                                 ypcx = y + cx;
03041                                 ymcx = y - cx;
03042                                 result |= pixelColorNolock (dst, xmcy, ypcx, color);
03043                                 result |= pixelColorNolock (dst, xpcy, ypcx, color);
03044                                 result |= pixelColorNolock (dst, xmcy, ymcx, color);
03045                                 result |= pixelColorNolock (dst, xpcy, ymcx, color);
03046                         } else if (cx == 0) {
03047                                 result |= pixelColorNolock (dst, xmcy, y, color);
03048                                 result |= pixelColorNolock (dst, xpcy, y, color);
03049                         }
03050                         /*
03051                         * Update 
03052                         */
03053                         if (df < 0) {
03054                                 df += d_e;
03055                                 d_e += 2;
03056                                 d_se += 2;
03057                         } else {
03058                                 df += d_se;
03059                                 d_e += 2;
03060                                 d_se += 4;
03061                                 cy--;
03062                         }
03063                         cx++;
03064                 } while (cx <= cy);
03065 
03066         }                               /* Alpha check */
03067 
03068         /* Unlock surface */
03069         if (SDL_MUSTLOCK(dst)) {
03070                 SDL_UnlockSurface(dst);
03071         }
03072 
03073         return (result);
03074 }
03075 
03090 int circleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03091 {
03092         /*
03093         * Draw 
03094         */
03095         return (circleColor(dst, x, y, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
03096 }
03097 
03098 /* ----- Arc */
03099 
03117 int arcColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
03118 {
03119         Sint16 left, right, top, bottom;
03120         int result;
03121         Sint16 x1, y1, x2, y2;
03122         Sint16 cx = 0;
03123         Sint16 cy = rad;
03124         Sint16 df = 1 - rad;
03125         Sint16 d_e = 3;
03126         Sint16 d_se = -2 * rad + 5;
03127         Sint16 xpcx, xmcx, xpcy, xmcy;
03128         Sint16 ypcy, ymcy, ypcx, ymcx;
03129         Uint8 *colorptr;
03130         Uint8 drawoct;
03131         int startoct, endoct, oct, stopval_start = 0, stopval_end = 0;
03132         double dstart, dend, temp = 0.;
03133 
03134         /*
03135         * Check visibility of clipping rectangle
03136         */
03137         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
03138                 return(0);
03139         }
03140 
03141         /*
03142         * Sanity check radius 
03143         */
03144         if (rad < 0) {
03145                 return (-1);
03146         }
03147 
03148         /*
03149         * Special case for rad=0 - draw a point 
03150         */
03151         if (rad == 0) {
03152                 return (pixelColor(dst, x, y, color));
03153         }
03154 
03155         /*
03156         * Get arc's circle and clipping boundary and 
03157         * test if bounding box of circle is visible 
03158         */
03159         x2 = x + rad;
03160         left = dst->clip_rect.x;
03161         if (x2<left) {
03162                 return(0);
03163         } 
03164         x1 = x - rad;
03165         right = dst->clip_rect.x + dst->clip_rect.w - 1;
03166         if (x1>right) {
03167                 return(0);
03168         } 
03169         y2 = y + rad;
03170         top = dst->clip_rect.y;
03171         if (y2<top) {
03172                 return(0);
03173         } 
03174         y1 = y - rad;
03175         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
03176         if (y1>bottom) {
03177                 return(0);
03178         }  
03179 
03180         // Octant labelling
03181         //      
03182         //  \ 5 | 6 /
03183         //   \  |  /
03184         //  4 \ | / 7
03185         //     \|/
03186         //------+------ +x
03187         //     /|\
03188         //  3 / | \ 0
03189         //   /  |  \
03190         //  / 2 | 1 \
03191         //      +y
03192 
03193         // Initially reset bitmask to 0x00000000
03194         // the set whether or not to keep drawing a given octant.
03195         // For example: 0x00111100 means we're drawing in octants 2-5
03196         drawoct = 0; 
03197 
03198         /*
03199         * Fixup angles
03200         */
03201         start %= 360;
03202         end %= 360;
03203         // 0 <= start & end < 360; note that sometimes start > end - if so, arc goes back through 0.
03204         while (start < 0) start += 360;
03205         while (end < 0) end += 360;
03206         start %= 360;
03207         end %= 360;
03208 
03209         // now, we find which octants we're drawing in.
03210         startoct = start / 45;
03211         endoct = end / 45;
03212         oct = startoct - 1; // we increment as first step in loop
03213 
03214         // stopval_start, stopval_end; 
03215         // what values of cx to stop at.
03216         do {
03217                 oct = (oct + 1) % 8;
03218 
03219                 if (oct == startoct) {
03220                         // need to compute stopval_start for this octant.  Look at picture above if this is unclear
03221                         dstart = (double)start;
03222                         switch (oct) 
03223                         {
03224                         case 0:
03225                         case 3:
03226                                 temp = sin(dstart * M_PI / 180.);
03227                                 break;
03228                         case 1:
03229                         case 6:
03230                                 temp = cos(dstart * M_PI / 180.);
03231                                 break;
03232                         case 2:
03233                         case 5:
03234                                 temp = -cos(dstart * M_PI / 180.);
03235                                 break;
03236                         case 4:
03237                         case 7:
03238                                 temp = -sin(dstart * M_PI / 180.);
03239                                 break;
03240                         }
03241                         temp *= rad;
03242                         stopval_start = (int)temp; // always round down.
03243                         // This isn't arbitrary, but requires graph paper to explain well.
03244                         // The basic idea is that we're always changing drawoct after we draw, so we
03245                         // stop immediately after we render the last sensible pixel at x = ((int)temp).
03246 
03247                         // and whether to draw in this octant initially
03248                         if (oct % 2) drawoct |= (1 << oct); // this is basically like saying drawoct[oct] = true, if drawoct were a bool array
03249                         else             drawoct &= 255 - (1 << oct); // this is basically like saying drawoct[oct] = false
03250                 }
03251                 if (oct == endoct) {
03252                         // need to compute stopval_end for this octant
03253                         dend = (double)end;
03254                         switch (oct)
03255                         {
03256                         case 0:
03257                         case 3:
03258                                 temp = sin(dend * M_PI / 180);
03259                                 break;
03260                         case 1:
03261                         case 6:
03262                                 temp = cos(dend * M_PI / 180);
03263                                 break;
03264                         case 2:
03265                         case 5:
03266                                 temp = -cos(dend * M_PI / 180);
03267                                 break;
03268                         case 4:
03269                         case 7:
03270                                 temp = -sin(dend * M_PI / 180);
03271                                 break;
03272                         }
03273                         temp *= rad;
03274                         stopval_end = (int)temp;
03275 
03276                         // and whether to draw in this octant initially
03277                         if (startoct == endoct) {
03278                                 // note:      we start drawing, stop, then start again in this case
03279                                 // otherwise: we only draw in this octant, so initialize it to false, it will get set back to true
03280                                 if (start > end) {
03281                                         // unfortunately, if we're in the same octant and need to draw over the whole circle, 
03282                                         // we need to set the rest to true, because the while loop will end at the bottom.
03283                                         drawoct = 255;
03284                                 } else {
03285                                         drawoct &= 255 - (1 << oct);
03286                                 }
03287                         } 
03288                         else if (oct % 2) drawoct &= 255 - (1 << oct);
03289                         else                      drawoct |= (1 << oct);
03290                 } else if (oct != startoct) { // already verified that it's != endoct
03291                         drawoct |= (1 << oct); // draw this entire segment
03292                 }
03293         } while (oct != endoct);
03294 
03295         // so now we have what octants to draw and when to draw them.  all that's left is the actual raster code.
03296 
03297         /* Lock surface */
03298         if (SDL_MUSTLOCK(dst)) {
03299                 if (SDL_LockSurface(dst) < 0) {
03300                         return (-1);
03301                 }
03302         }
03303 
03304         /*
03305         * Draw arc 
03306         */
03307         result = 0;
03308 
03309         /*
03310         * Alpha Check 
03311         */
03312         if ((color & 255) == 255) {
03313 
03314                 /*
03315                 * No Alpha - direct memory writes 
03316                 */
03317 
03318                 /*
03319                 * Setup color 
03320                 */
03321                 colorptr = (Uint8 *) & color;
03322                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
03323                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
03324                 } else {
03325                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
03326                 }
03327 
03328                 /*
03329                 * Draw 
03330                 */
03331                 do {
03332                         ypcy = y + cy;
03333                         ymcy = y - cy;
03334                         if (cx > 0) {
03335                                 xpcx = x + cx;
03336                                 xmcx = x - cx;
03337                                 // always check if we're drawing a certain octant before adding a pixel to that octant.
03338                                 if (drawoct & 4)  result |= fastPixelColorNolock(dst, xmcx, ypcy, color); // drawoct & 4 = 22; drawoct[2]
03339                                 if (drawoct & 2)  result |= fastPixelColorNolock(dst, xpcx, ypcy, color);
03340                                 if (drawoct & 32) result |= fastPixelColorNolock(dst, xmcx, ymcy, color);
03341                                 if (drawoct & 64) result |= fastPixelColorNolock(dst, xpcx, ymcy, color);
03342                         } else {
03343                                 if (drawoct & 6)  result |= fastPixelColorNolock(dst, x, ypcy, color); // 4 + 2; drawoct[2] || drawoct[1]
03344                                 if (drawoct & 96) result |= fastPixelColorNolock(dst, x, ymcy, color); // 32 + 64
03345                         }
03346 
03347                         xpcy = x + cy;
03348                         xmcy = x - cy;
03349                         if (cx > 0 && cx != cy) {
03350                                 ypcx = y + cx;
03351                                 ymcx = y - cx;
03352                                 if (drawoct & 8)   result |= fastPixelColorNolock(dst, xmcy, ypcx, color);
03353                                 if (drawoct & 1)   result |= fastPixelColorNolock(dst, xpcy, ypcx, color);
03354                                 if (drawoct & 16)  result |= fastPixelColorNolock(dst, xmcy, ymcx, color);
03355                                 if (drawoct & 128) result |= fastPixelColorNolock(dst, xpcy, ymcx, color);
03356                         } else if (cx == 0) {
03357                                 if (drawoct & 24)  result |= fastPixelColorNolock(dst, xmcy, y, color); // 8 + 16
03358                                 if (drawoct & 129) result |= fastPixelColorNolock(dst, xpcy, y, color); // 1 + 128
03359                         }
03360 
03361                         /*
03362                         * Update whether we're drawing an octant
03363                         */
03364                         if (stopval_start == cx) {
03365                                 // works like an on-off switch because start & end may be in the same octant.
03366                                 if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);                
03367                                 else drawoct |= (1 << startoct);
03368                         }
03369                         if (stopval_end == cx) {
03370                                 if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
03371                                 else drawoct |= (1 << endoct);
03372                         }
03373 
03374                         /*
03375                         * Update pixels
03376                         */
03377                         if (df < 0) {
03378                                 df += d_e;
03379                                 d_e += 2;
03380                                 d_se += 2;
03381                         } else {
03382                                 df += d_se;
03383                                 d_e += 2;
03384                                 d_se += 4;
03385                                 cy--;
03386                         }
03387                         cx++;
03388                 } while (cx <= cy);
03389 
03390                 /*
03391                 * Unlock surface 
03392                 */
03393                 SDL_UnlockSurface(dst);
03394 
03395         } else {
03396 
03397                 /*
03398                 * Using Alpha - blended pixel blits 
03399                 */
03400 
03401                 do {
03402                         ypcy = y + cy;
03403                         ymcy = y - cy;
03404                         if (cx > 0) {
03405                                 xpcx = x + cx;
03406                                 xmcx = x - cx;
03407 
03408                                 // always check if we're drawing a certain octant before adding a pixel to that octant.
03409                                 if (drawoct & 4)  result |= pixelColorNolock(dst, xmcx, ypcy, color);
03410                                 if (drawoct & 2)  result |= pixelColorNolock(dst, xpcx, ypcy, color);
03411                                 if (drawoct & 32) result |= pixelColorNolock(dst, xmcx, ymcy, color);
03412                                 if (drawoct & 64) result |= pixelColorNolock(dst, xpcx, ymcy, color);
03413                         } else {
03414                                 if (drawoct & 96) result |= pixelColorNolock(dst, x, ymcy, color);
03415                                 if (drawoct & 6)  result |= pixelColorNolock(dst, x, ypcy, color);
03416                         }
03417 
03418                         xpcy = x + cy;
03419                         xmcy = x - cy;
03420                         if (cx > 0 && cx != cy) {
03421                                 ypcx = y + cx;
03422                                 ymcx = y - cx;
03423                                 if (drawoct & 8)   result |= pixelColorNolock(dst, xmcy, ypcx, color);
03424                                 if (drawoct & 1)   result |= pixelColorNolock(dst, xpcy, ypcx, color);
03425                                 if (drawoct & 16)  result |= pixelColorNolock(dst, xmcy, ymcx, color);
03426                                 if (drawoct & 128) result |= pixelColorNolock(dst, xpcy, ymcx, color);
03427                         } else if (cx == 0) {
03428                                 if (drawoct & 24)  result |= pixelColorNolock(dst, xmcy, y, color);
03429                                 if (drawoct & 129) result |= pixelColorNolock(dst, xpcy, y, color);
03430                         }
03431 
03432                         /*
03433                         * Update whether we're drawing an octant
03434                         */
03435                         if (stopval_start == cx) {
03436                                 // works like an on-off switch.  
03437                                 // This is just in case start & end are in the same octant.
03438                                 if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);                
03439                                 else                                               drawoct |= (1 << startoct);
03440                         }
03441                         if (stopval_end == cx) {
03442                                 if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
03443                                 else                                             drawoct |= (1 << endoct);
03444                         }
03445 
03446                         /*
03447                         * Update pixels
03448                         */
03449                         if (df < 0) {
03450                                 df += d_e;
03451                                 d_e += 2;
03452                                 d_se += 2;
03453                         } else {
03454                                 df += d_se;
03455                                 d_e += 2;
03456                                 d_se += 4;
03457                                 cy--;
03458                         }
03459                         cx++;
03460                 } while (cx <= cy);
03461 
03462         }                               /* Alpha check */
03463 
03464         /* Unlock surface */
03465         if (SDL_MUSTLOCK(dst)) {
03466                 SDL_UnlockSurface(dst);
03467         }
03468 
03469         return (result);
03470 }
03471 
03488 int arcRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03489 {
03490         /*
03491         * Draw 
03492         */
03493         return (arcColor(dst, x, y, rad, start, end, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
03494 }
03495 
03496 /* ----- AA Circle */
03497 
03498 
03512 int aacircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
03513 {
03514         return (aaellipseColor(dst, x, y, rad, rad, color));
03515 }
03516 
03531 int aacircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03532 {
03533         /*
03534         * Draw 
03535         */
03536         return (aaellipseColor
03537                 (dst, x, y, rad, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
03538 }
03539 
03540 /* ----- Filled Circle */
03541 
03556 int filledCircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
03557 {
03558         Sint16 left, right, top, bottom;
03559         int result;
03560         Sint16 x1, y1, x2, y2;
03561         Sint16 cx = 0;
03562         Sint16 cy = rad;
03563         Sint16 ocx = (Sint16) 0xffff;
03564         Sint16 ocy = (Sint16) 0xffff;
03565         Sint16 df = 1 - rad;
03566         Sint16 d_e = 3;
03567         Sint16 d_se = -2 * rad + 5;
03568         Sint16 xpcx, xmcx, xpcy, xmcy;
03569         Sint16 ypcy, ymcy, ypcx, ymcx;
03570 
03571         /*
03572         * Check visibility of clipping rectangle
03573         */
03574         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
03575                 return(0);
03576         }
03577 
03578         /*
03579         * Sanity check radius 
03580         */
03581         if (rad < 0) {
03582                 return (-1);
03583         }
03584 
03585         /*
03586         * Special case for rad=0 - draw a point 
03587         */
03588         if (rad == 0) {
03589                 return (pixelColor(dst, x, y, color));
03590         }
03591 
03592         /*
03593         * Get circle and clipping boundary and 
03594         * test if bounding box of circle is visible 
03595         */
03596         x2 = x + rad;
03597         left = dst->clip_rect.x;
03598         if (x2<left) {
03599                 return(0);
03600         } 
03601         x1 = x - rad;
03602         right = dst->clip_rect.x + dst->clip_rect.w - 1;
03603         if (x1>right) {
03604                 return(0);
03605         } 
03606         y2 = y + rad;
03607         top = dst->clip_rect.y;
03608         if (y2<top) {
03609                 return(0);
03610         } 
03611         y1 = y - rad;
03612         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
03613         if (y1>bottom) {
03614                 return(0);
03615         } 
03616 
03617         /*
03618         * Draw 
03619         */
03620         result = 0;
03621         do {
03622                 xpcx = x + cx;
03623                 xmcx = x - cx;
03624                 xpcy = x + cy;
03625                 xmcy = x - cy;
03626                 if (ocy != cy) {
03627                         if (cy > 0) {
03628                                 ypcy = y + cy;
03629                                 ymcy = y - cy;
03630                                 result |= hlineColor(dst, xmcx, xpcx, ypcy, color);
03631                                 result |= hlineColor(dst, xmcx, xpcx, ymcy, color);
03632                         } else {
03633                                 result |= hlineColor(dst, xmcx, xpcx, y, color);
03634                         }
03635                         ocy = cy;
03636                 }
03637                 if (ocx != cx) {
03638                         if (cx != cy) {
03639                                 if (cx > 0) {
03640                                         ypcx = y + cx;
03641                                         ymcx = y - cx;
03642                                         result |= hlineColor(dst, xmcy, xpcy, ymcx, color);
03643                                         result |= hlineColor(dst, xmcy, xpcy, ypcx, color);
03644                                 } else {
03645                                         result |= hlineColor(dst, xmcy, xpcy, y, color);
03646                                 }
03647                         }
03648                         ocx = cx;
03649                 }
03650                 /*
03651                 * Update 
03652                 */
03653                 if (df < 0) {
03654                         df += d_e;
03655                         d_e += 2;
03656                         d_se += 2;
03657                 } else {
03658                         df += d_se;
03659                         d_e += 2;
03660                         d_se += 4;
03661                         cy--;
03662                 }
03663                 cx++;
03664         } while (cx <= cy);
03665 
03666         return (result);
03667 }
03668 
03683 int filledCircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
03684 {
03685         /*
03686         * Draw 
03687         */
03688         return (filledCircleColor
03689                 (dst, x, y, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
03690 }
03691 
03692 /* ----- Ellipse */
03693 
03709 int ellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
03710 {
03711         Sint16 left, right, top, bottom;
03712         int result;
03713         Sint16 x1, y1, x2, y2;
03714         int ix, iy;
03715         int h, i, j, k;
03716         int oh, oi, oj, ok;
03717         int xmh, xph, ypk, ymk;
03718         int xmi, xpi, ymj, ypj;
03719         int xmj, xpj, ymi, ypi;
03720         int xmk, xpk, ymh, yph;
03721         Uint8 *colorptr;
03722 
03723         /*
03724         * Check visibility of clipping rectangle
03725         */
03726         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
03727                 return(0);
03728         }
03729 
03730         /*
03731         * Sanity check radii 
03732         */
03733         if ((rx < 0) || (ry < 0)) {
03734                 return (-1);
03735         }
03736 
03737         /*
03738         * Special case for rx=0 - draw a vline 
03739         */
03740         if (rx == 0) {
03741                 return (vlineColor(dst, x, y - ry, y + ry, color));
03742         }
03743         /*
03744         * Special case for ry=0 - draw a hline 
03745         */
03746         if (ry == 0) {
03747                 return (hlineColor(dst, x - rx, x + rx, y, color));
03748         }
03749 
03750         /*
03751         * Get circle and clipping boundary and 
03752         * test if bounding box of circle is visible 
03753         */
03754         x2 = x + rx;
03755         left = dst->clip_rect.x;
03756         if (x2<left) {
03757                 return(0);
03758         } 
03759         x1 = x - rx;
03760         right = dst->clip_rect.x + dst->clip_rect.w - 1;
03761         if (x1>right) {
03762                 return(0);
03763         } 
03764         y2 = y + ry;
03765         top = dst->clip_rect.y;
03766         if (y2<top) {
03767                 return(0);
03768         } 
03769         y1 = y - ry;
03770         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
03771         if (y1>bottom) {
03772                 return(0);
03773         } 
03774 
03775         /*
03776         * Init vars 
03777         */
03778         oh = oi = oj = ok = 0xFFFF;
03779 
03780         /*
03781         * Draw 
03782         */
03783         result = 0;
03784 
03785         /* Lock surface */
03786         if (SDL_MUSTLOCK(dst)) {
03787                 if (SDL_LockSurface(dst) < 0) {
03788                         return (-1);
03789                 }
03790         }
03791 
03792         /*
03793         * Check alpha 
03794         */
03795         if ((color & 255) == 255) {
03796 
03797                 /*
03798                 * No Alpha - direct memory writes 
03799                 */
03800 
03801                 /*
03802                 * Setup color 
03803                 */
03804                 colorptr = (Uint8 *) & color;
03805                 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
03806                         color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
03807                 } else {
03808                         color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
03809                 }
03810 
03811 
03812                 if (rx > ry) {
03813                         ix = 0;
03814                         iy = rx * 64;
03815 
03816                         do {
03817                                 h = (ix + 32) >> 6;
03818                                 i = (iy + 32) >> 6;
03819                                 j = (h * ry) / rx;
03820                                 k = (i * ry) / rx;
03821 
03822                                 if (((ok != k) && (oj != k)) || ((oj != j) && (ok != j)) || (k != j)) {
03823                                         xph = x + h;
03824                                         xmh = x - h;
03825                                         if (k > 0) {
03826                                                 ypk = y + k;
03827                                                 ymk = y - k;
03828                                                 result |= fastPixelColorNolock(dst, xmh, ypk, color);
03829                                                 result |= fastPixelColorNolock(dst, xph, ypk, color);
03830                                                 result |= fastPixelColorNolock(dst, xmh, ymk, color);
03831                                                 result |= fastPixelColorNolock(dst, xph, ymk, color);
03832                                         } else {
03833                                                 result |= fastPixelColorNolock(dst, xmh, y, color);
03834                                                 result |= fastPixelColorNolock(dst, xph, y, color);
03835                                         }
03836                                         ok = k;
03837                                         xpi = x + i;
03838                                         xmi = x - i;
03839                                         if (j > 0) {
03840                                                 ypj = y + j;
03841                                                 ymj = y - j;
03842                                                 result |= fastPixelColorNolock(dst, xmi, ypj, color);
03843                                                 result |= fastPixelColorNolock(dst, xpi, ypj, color);
03844                                                 result |= fastPixelColorNolock(dst, xmi, ymj, color);
03845                                                 result |= fastPixelColorNolock(dst, xpi, ymj, color);
03846                                         } else {
03847                                                 result |= fastPixelColorNolock(dst, xmi, y, color);
03848                                                 result |= fastPixelColorNolock(dst, xpi, y, color);
03849                                         }
03850                                         oj = j;
03851                                 }
03852 
03853                                 ix = ix + iy / rx;
03854                                 iy = iy - ix / rx;
03855 
03856                         } while (i > h);
03857                 } else {
03858                         ix = 0;
03859                         iy = ry * 64;
03860 
03861                         do {
03862                                 h = (ix + 32) >> 6;
03863                                 i = (iy + 32) >> 6;
03864                                 j = (h * rx) / ry;
03865                                 k = (i * rx) / ry;
03866 
03867                                 if (((oi != i) && (oh != i)) || ((oh != h) && (oi != h) && (i != h))) {
03868                                         xmj = x - j;
03869                                         xpj = x + j;
03870                                         if (i > 0) {
03871                                                 ypi = y + i;
03872                                                 ymi = y - i;
03873                                                 result |= fastPixelColorNolock(dst, xmj, ypi, color);
03874                                                 result |= fastPixelColorNolock(dst, xpj, ypi, color);
03875                                                 result |= fastPixelColorNolock(dst, xmj, ymi, color);
03876                                                 result |= fastPixelColorNolock(dst, xpj, ymi, color);
03877                                         } else {
03878                                                 result |= fastPixelColorNolock(dst, xmj, y, color);
03879                                                 result |= fastPixelColorNolock(dst, xpj, y, color);
03880                                         }
03881                                         oi = i;
03882                                         xmk = x - k;
03883                                         xpk = x + k;
03884                                         if (h > 0) {
03885                                                 yph = y + h;
03886                                                 ymh = y - h;
03887                                                 result |= fastPixelColorNolock(dst, xmk, yph, color);
03888                                                 result |= fastPixelColorNolock(dst, xpk, yph, color);
03889                                                 result |= fastPixelColorNolock(dst, xmk, ymh, color);
03890                                                 result |= fastPixelColorNolock(dst, xpk, ymh, color);
03891                                         } else {
03892                                                 result |= fastPixelColorNolock(dst, xmk, y, color);
03893                                                 result |= fastPixelColorNolock(dst, xpk, y, color);
03894                                         }
03895                                         oh = h;
03896                                 }
03897 
03898                                 ix = ix + iy / ry;
03899                                 iy = iy - ix / ry;
03900 
03901                         } while (i > h);
03902                 }
03903 
03904         } else {
03905 
03906                 if (rx > ry) {
03907                         ix = 0;
03908                         iy = rx * 64;
03909 
03910                         do {
03911                                 h = (ix + 32) >> 6;
03912                                 i = (iy + 32) >> 6;
03913                                 j = (h * ry) / rx;
03914                                 k = (i * ry) / rx;
03915 
03916                                 if (((ok != k) && (oj != k)) || ((oj != j) && (ok != j)) || (k != j)) {
03917                                         xph = x + h;
03918                                         xmh = x - h;
03919                                         if (k > 0) {
03920                                                 ypk = y + k;
03921                                                 ymk = y - k;
03922                                                 result |= pixelColorNolock (dst, xmh, ypk, color);
03923                                                 result |= pixelColorNolock (dst, xph, ypk, color);
03924                                                 result |= pixelColorNolock (dst, xmh, ymk, color);
03925                                                 result |= pixelColorNolock (dst, xph, ymk, color);
03926                                         } else {
03927                                                 result |= pixelColorNolock (dst, xmh, y, color);
03928                                                 result |= pixelColorNolock (dst, xph, y, color);
03929                                         }
03930                                         ok = k;
03931                                         xpi = x + i;
03932                                         xmi = x - i;
03933                                         if (j > 0) {
03934                                                 ypj = y + j;
03935                                                 ymj = y - j;
03936                                                 result |= pixelColorNolock (dst, xmi, ypj, color);
03937                                                 result |= pixelColorNolock (dst, xpi, ypj, color);
03938                                                 result |= pixelColorNolock (dst, xmi, ymj, color);
03939                                                 result |= pixelColor(dst, xpi, ymj, color);
03940                                         } else {
03941                                                 result |= pixelColorNolock (dst, xmi, y, color);
03942                                                 result |= pixelColorNolock (dst, xpi, y, color);
03943                                         }
03944                                         oj = j;
03945                                 }
03946 
03947                                 ix = ix + iy / rx;
03948                                 iy = iy - ix / rx;
03949 
03950                         } while (i > h);
03951                 } else {
03952                         ix = 0;
03953                         iy = ry * 64;
03954 
03955                         do {
03956                                 h = (ix + 32) >> 6;
03957                                 i = (iy + 32) >> 6;
03958                                 j = (h * rx) / ry;
03959                                 k = (i * rx) / ry;
03960 
03961                                 if (((oi != i) && (oh != i)) || ((oh != h) && (oi != h) && (i != h))) {
03962                                         xmj = x - j;
03963                                         xpj = x + j;
03964                                         if (i > 0) {
03965                                                 ypi = y + i;
03966                                                 ymi = y - i;
03967                                                 result |= pixelColorNolock (dst, xmj, ypi, color);
03968                                                 result |= pixelColorNolock (dst, xpj, ypi, color);
03969                                                 result |= pixelColorNolock (dst, xmj, ymi, color);
03970                                                 result |= pixelColorNolock (dst, xpj, ymi, color);
03971                                         } else {
03972                                                 result |= pixelColorNolock (dst, xmj, y, color);
03973                                                 result |= pixelColorNolock (dst, xpj, y, color);
03974                                         }
03975                                         oi = i;
03976                                         xmk = x - k;
03977                                         xpk = x + k;
03978                                         if (h > 0) {
03979                                                 yph = y + h;
03980                                                 ymh = y - h;
03981                                                 result |= pixelColorNolock (dst, xmk, yph, color);
03982                                                 result |= pixelColorNolock (dst, xpk, yph, color);
03983                                                 result |= pixelColorNolock (dst, xmk, ymh, color);
03984                                                 result |= pixelColorNolock (dst, xpk, ymh, color);
03985                                         } else {
03986                                                 result |= pixelColorNolock (dst, xmk, y, color);
03987                                                 result |= pixelColorNolock (dst, xpk, y, color);
03988                                         }
03989                                         oh = h;
03990                                 }
03991 
03992                                 ix = ix + iy / ry;
03993                                 iy = iy - ix / ry;
03994 
03995                         } while (i > h);
03996                 }
03997 
03998         }                               /* Alpha check */
03999 
04000         /* Unlock surface */
04001         if (SDL_MUSTLOCK(dst)) {
04002                 SDL_UnlockSurface(dst);
04003         }
04004 
04005         return (result);
04006 }
04007 
04023 int ellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04024 {
04025         /*
04026         * Draw 
04027         */
04028         return (ellipseColor(dst, x, y, rx, ry, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
04029 }
04030 
04031 /* ----- AA Ellipse */
04032 
04033 /* Windows targets do not have lrint, so provide a local inline version */
04034 #if defined(_MSC_VER)
04035 /* Detect 64bit and use intrinsic version */
04036 #ifdef _M_X64
04037 #include <emmintrin.h>
04038 static __inline long 
04039         lrint(float f) 
04040 {
04041         return _mm_cvtss_si32(_mm_load_ss(&f));
04042 }
04043 #elif defined(_M_IX86)
04044 __inline long int
04045         lrint (double flt)
04046 {       
04047         int intgr;
04048         _asm
04049         {
04050                 fld flt
04051                         fistp intgr
04052         };
04053         return intgr;
04054 }
04055 #elif defined(_M_ARM)
04056 #include <armintr.h>
04057 #pragma warning(push)
04058 #pragma warning(disable: 4716)
04059 __declspec(naked) long int
04060         lrint (double flt)
04061 {
04062         __emit(0xEC410B10); // fmdrr  d0, r0, r1
04063         __emit(0xEEBD0B40); // ftosid s0, d0
04064         __emit(0xEE100A10); // fmrs   r0, s0
04065         __emit(0xE12FFF1E); // bx     lr
04066 }
04067 #pragma warning(pop)
04068 #else
04069 #error lrint needed for MSVC on non X86/AMD64/ARM targets.
04070 #endif
04071 #endif
04072 
04088 int aaellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
04089 {
04090         Sint16 left, right, top, bottom;
04091         Sint16 x1,y1,x2,y2;
04092         int i;
04093         int a2, b2, ds, dt, dxt, t, s, d;
04094         Sint16 xp, yp, xs, ys, dyt, od, xx, yy, xc2, yc2;
04095         float cp;
04096         double sab;
04097         Uint8 weight, iweight;
04098         int result;
04099 
04100         /*
04101         * Check visibility of clipping rectangle
04102         */
04103         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
04104                 return(0);
04105         }
04106 
04107         /*
04108         * Sanity check radii 
04109         */
04110         if ((rx < 0) || (ry < 0)) {
04111                 return (-1);
04112         }
04113 
04114         /*
04115         * Special case for rx=0 - draw a vline 
04116         */
04117         if (rx == 0) {
04118                 return (vlineColor(dst, x, y - ry, y + ry, color));
04119         }
04120         /*
04121         * Special case for ry=0 - draw an hline 
04122         */
04123         if (ry == 0) {
04124                 return (hlineColor(dst, x - rx, x + rx, y, color));
04125         }
04126 
04127         /*
04128         * Get circle and clipping boundary and 
04129         * test if bounding box of circle is visible 
04130         */
04131         x2 = x + rx;
04132         left = dst->clip_rect.x;
04133         if (x2<left) {
04134                 return(0);
04135         } 
04136         x1 = x - rx;
04137         right = dst->clip_rect.x + dst->clip_rect.w - 1;
04138         if (x1>right) {
04139                 return(0);
04140         } 
04141         y2 = y + ry;
04142         top = dst->clip_rect.y;
04143         if (y2<top) {
04144                 return(0);
04145         } 
04146         y1 = y - ry;
04147         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
04148         if (y1>bottom) {
04149                 return(0);
04150         } 
04151 
04152         /* Variable setup */
04153         a2 = rx * rx;
04154         b2 = ry * ry;
04155 
04156         ds = 2 * a2;
04157         dt = 2 * b2;
04158 
04159         xc2 = 2 * x;
04160         yc2 = 2 * y;
04161 
04162         sab = sqrt((double)(a2 + b2));
04163         od = (Sint16)lrint(sab*0.01) + 1; /* introduce some overdraw */
04164         dxt = (Sint16)lrint((double)a2 / sab) + od;
04165 
04166         t = 0;
04167         s = -2 * a2 * ry;
04168         d = 0;
04169 
04170         xp = x;
04171         yp = y - ry;
04172 
04173         /* Lock surface */
04174         if (SDL_MUSTLOCK(dst)) {
04175                 if (SDL_LockSurface(dst) < 0) {
04176                         return (-1);
04177                 }
04178         }
04179 
04180         /* Draw */
04181         result = 0;
04182 
04183         /* "End points" */
04184         result |= pixelColorNolock(dst, xp, yp, color);
04185         result |= pixelColorNolock(dst, xc2 - xp, yp, color);
04186         result |= pixelColorNolock(dst, xp, yc2 - yp, color);
04187         result |= pixelColorNolock(dst, xc2 - xp, yc2 - yp, color);
04188 
04189         for (i = 1; i <= dxt; i++) {
04190                 xp--;
04191                 d += t - b2;
04192 
04193                 if (d >= 0)
04194                         ys = yp - 1;
04195                 else if ((d - s - a2) > 0) {
04196                         if ((2 * d - s - a2) >= 0)
04197                                 ys = yp + 1;
04198                         else {
04199                                 ys = yp;
04200                                 yp++;
04201                                 d -= s + a2;
04202                                 s += ds;
04203                         }
04204                 } else {
04205                         yp++;
04206                         ys = yp + 1;
04207                         d -= s + a2;
04208                         s += ds;
04209                 }
04210 
04211                 t -= dt;
04212 
04213                 /* Calculate alpha */
04214                 if (s != 0) {
04215                         cp = (float) abs(d) / (float) abs(s);
04216                         if (cp > 1.0) {
04217                                 cp = 1.0;
04218                         }
04219                 } else {
04220                         cp = 1.0;
04221                 }
04222 
04223                 /* Calculate weights */
04224                 weight = (Uint8) (cp * 255);
04225                 iweight = 255 - weight;
04226 
04227                 /* Upper half */
04228                 xx = xc2 - xp;
04229                 result |= pixelColorWeightNolock(dst, xp, yp, color, iweight);
04230                 result |= pixelColorWeightNolock(dst, xx, yp, color, iweight);
04231 
04232                 result |= pixelColorWeightNolock(dst, xp, ys, color, weight);
04233                 result |= pixelColorWeightNolock(dst, xx, ys, color, weight);
04234 
04235                 /* Lower half */
04236                 yy = yc2 - yp;
04237                 result |= pixelColorWeightNolock(dst, xp, yy, color, iweight);
04238                 result |= pixelColorWeightNolock(dst, xx, yy, color, iweight);
04239 
04240                 yy = yc2 - ys;
04241                 result |= pixelColorWeightNolock(dst, xp, yy, color, weight);
04242                 result |= pixelColorWeightNolock(dst, xx, yy, color, weight);
04243         }
04244 
04245         /* Replaces original approximation code dyt = abs(yp - yc); */
04246         dyt = (Sint16)lrint((double)b2 / sab ) + od;    
04247 
04248         for (i = 1; i <= dyt; i++) {
04249                 yp++;
04250                 d -= s + a2;
04251 
04252                 if (d <= 0)
04253                         xs = xp + 1;
04254                 else if ((d + t - b2) < 0) {
04255                         if ((2 * d + t - b2) <= 0)
04256                                 xs = xp - 1;
04257                         else {
04258                                 xs = xp;
04259                                 xp--;
04260                                 d += t - b2;
04261                                 t -= dt;
04262                         }
04263                 } else {
04264                         xp--;
04265                         xs = xp - 1;
04266                         d += t - b2;
04267                         t -= dt;
04268                 }
04269 
04270                 s += ds;
04271 
04272                 /* Calculate alpha */
04273                 if (t != 0) {
04274                         cp = (float) abs(d) / (float) abs(t);
04275                         if (cp > 1.0) {
04276                                 cp = 1.0;
04277                         }
04278                 } else {
04279                         cp = 1.0;
04280                 }
04281 
04282                 /* Calculate weight */
04283                 weight = (Uint8) (cp * 255);
04284                 iweight = 255 - weight;
04285 
04286                 /* Left half */
04287                 xx = xc2 - xp;
04288                 yy = yc2 - yp;
04289                 result |= pixelColorWeightNolock(dst, xp, yp, color, iweight);
04290                 result |= pixelColorWeightNolock(dst, xx, yp, color, iweight);
04291 
04292                 result |= pixelColorWeightNolock(dst, xp, yy, color, iweight);
04293                 result |= pixelColorWeightNolock(dst, xx, yy, color, iweight);
04294 
04295                 /* Right half */
04296                 xx = xc2 - xs;
04297                 result |= pixelColorWeightNolock(dst, xs, yp, color, weight);
04298                 result |= pixelColorWeightNolock(dst, xx, yp, color, weight);
04299 
04300                 result |= pixelColorWeightNolock(dst, xs, yy, color, weight);
04301                 result |= pixelColorWeightNolock(dst, xx, yy, color, weight);
04302 
04303         }
04304 
04305         /* Unlock surface */
04306         if (SDL_MUSTLOCK(dst)) {
04307                 SDL_UnlockSurface(dst);
04308         }
04309 
04310         return (result);
04311 }
04312 
04328 int aaellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04329 {
04330         /*
04331         * Draw 
04332         */
04333         return (aaellipseColor
04334                 (dst, x, y, rx, ry, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
04335 }
04336 
04337 /* ---- Filled Ellipse */
04338 
04339 /* Note: */
04340 /* Based on algorithm from sge library with multiple-hline draw removal */
04341 /* and other speedup changes. */
04342 
04358 int filledEllipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
04359 {
04360         Sint16 left, right, top, bottom;
04361         int result;
04362         Sint16 x1, y1, x2, y2;
04363         int ix, iy;
04364         int h, i, j, k;
04365         int oh, oi, oj, ok;
04366         int xmh, xph;
04367         int xmi, xpi;
04368         int xmj, xpj;
04369         int xmk, xpk;
04370 
04371         /*
04372         * Check visibility of clipping rectangle
04373         */
04374         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
04375                 return(0);
04376         }
04377 
04378         /*
04379         * Sanity check radii 
04380         */
04381         if ((rx < 0) || (ry < 0)) {
04382                 return (-1);
04383         }
04384 
04385         /*
04386         * Special case for rx=0 - draw a vline 
04387         */
04388         if (rx == 0) {
04389                 return (vlineColor(dst, x, y - ry, y + ry, color));
04390         }
04391         /*
04392         * Special case for ry=0 - draw a hline 
04393         */
04394         if (ry == 0) {
04395                 return (hlineColor(dst, x - rx, x + rx, y, color));
04396         }
04397 
04398         /*
04399         * Get circle and clipping boundary and 
04400         * test if bounding box of circle is visible 
04401         */
04402         x2 = x + rx;
04403         left = dst->clip_rect.x;
04404         if (x2<left) {
04405                 return(0);
04406         } 
04407         x1 = x - rx;
04408         right = dst->clip_rect.x + dst->clip_rect.w - 1;
04409         if (x1>right) {
04410                 return(0);
04411         } 
04412         y2 = y + ry;
04413         top = dst->clip_rect.y;
04414         if (y2<top) {
04415                 return(0);
04416         } 
04417         y1 = y - ry;
04418         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
04419         if (y1>bottom) {
04420                 return(0);
04421         } 
04422 
04423         /*
04424         * Init vars 
04425         */
04426         oh = oi = oj = ok = 0xFFFF;
04427 
04428         /*
04429         * Draw 
04430         */
04431         result = 0;
04432         if (rx > ry) {
04433                 ix = 0;
04434                 iy = rx * 64;
04435 
04436                 do {
04437                         h = (ix + 32) >> 6;
04438                         i = (iy + 32) >> 6;
04439                         j = (h * ry) / rx;
04440                         k = (i * ry) / rx;
04441 
04442                         if ((ok != k) && (oj != k)) {
04443                                 xph = x + h;
04444                                 xmh = x - h;
04445                                 if (k > 0) {
04446                                         result |= hlineColor(dst, xmh, xph, y + k, color);
04447                                         result |= hlineColor(dst, xmh, xph, y - k, color);
04448                                 } else {
04449                                         result |= hlineColor(dst, xmh, xph, y, color);
04450                                 }
04451                                 ok = k;
04452                         }
04453                         if ((oj != j) && (ok != j) && (k != j)) {
04454                                 xmi = x - i;
04455                                 xpi = x + i;
04456                                 if (j > 0) {
04457                                         result |= hlineColor(dst, xmi, xpi, y + j, color);
04458                                         result |= hlineColor(dst, xmi, xpi, y - j, color);
04459                                 } else {
04460                                         result |= hlineColor(dst, xmi, xpi, y, color);
04461                                 }
04462                                 oj = j;
04463                         }
04464 
04465                         ix = ix + iy / rx;
04466                         iy = iy - ix / rx;
04467 
04468                 } while (i > h);
04469         } else {
04470                 ix = 0;
04471                 iy = ry * 64;
04472 
04473                 do {
04474                         h = (ix + 32) >> 6;
04475                         i = (iy + 32) >> 6;
04476                         j = (h * rx) / ry;
04477                         k = (i * rx) / ry;
04478 
04479                         if ((oi != i) && (oh != i)) {
04480                                 xmj = x - j;
04481                                 xpj = x + j;
04482                                 if (i > 0) {
04483                                         result |= hlineColor(dst, xmj, xpj, y + i, color);
04484                                         result |= hlineColor(dst, xmj, xpj, y - i, color);
04485                                 } else {
04486                                         result |= hlineColor(dst, xmj, xpj, y, color);
04487                                 }
04488                                 oi = i;
04489                         }
04490                         if ((oh != h) && (oi != h) && (i != h)) {
04491                                 xmk = x - k;
04492                                 xpk = x + k;
04493                                 if (h > 0) {
04494                                         result |= hlineColor(dst, xmk, xpk, y + h, color);
04495                                         result |= hlineColor(dst, xmk, xpk, y - h, color);
04496                                 } else {
04497                                         result |= hlineColor(dst, xmk, xpk, y, color);
04498                                 }
04499                                 oh = h;
04500                         }
04501 
04502                         ix = ix + iy / ry;
04503                         iy = iy - ix / ry;
04504 
04505                 } while (i > h);
04506         }
04507 
04508         return (result);
04509 }
04510 
04526 int filledEllipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04527 {
04528         /*
04529         * Draw 
04530         */
04531         return (filledEllipseColor
04532                 (dst, x, y, rx, ry, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
04533 }
04534 
04535 /* ----- pie */
04536 
04553 int _pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 filled)
04554 {
04555         Sint16 left, right, top, bottom;
04556         Sint16 x1, y1, x2, y2;
04557         int result;
04558         double angle, start_angle, end_angle;
04559         double deltaAngle;
04560         double dr;
04561         int numpoints, i;
04562         Sint16 *vx, *vy;
04563 
04564         /*
04565         * Check visibility of clipping rectangle
04566         */
04567         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
04568                 return(0);
04569         }
04570 
04571         /*
04572         * Sanity check radii 
04573         */
04574         if (rad < 0) {
04575                 return (-1);
04576         }
04577 
04578         /*
04579         * Fixup angles
04580         */
04581         start = start % 360;
04582         end = end % 360;
04583 
04584         /*
04585         * Special case for rad=0 - draw a point 
04586         */
04587         if (rad == 0) {
04588                 return (pixelColor(dst, x, y, color));
04589         }
04590 
04591         /*
04592         * Clip against circle, not pie (not 100% optimal).
04593         * Get pie's circle and clipping boundary and 
04594         * test if bounding box of circle is visible
04595         */
04596         x2 = x + rad;
04597         left = dst->clip_rect.x;
04598         if (x2<left) {
04599                 return(0);
04600         } 
04601         x1 = x - rad;
04602         right = dst->clip_rect.x + dst->clip_rect.w - 1;
04603         if (x1>right) {
04604                 return(0);
04605         } 
04606         y2 = y + rad;
04607         top = dst->clip_rect.y;
04608         if (y2<top) {
04609                 return(0);
04610         } 
04611         y1 = y - rad;
04612         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
04613         if (y1>bottom) {
04614                 return(0);
04615         } 
04616 
04617         /*
04618         * Variable setup 
04619         */
04620         dr = (double) rad;
04621         deltaAngle = 3.0 / dr;
04622         start_angle = (double) start *(2.0 * M_PI / 360.0);
04623         end_angle = (double) end *(2.0 * M_PI / 360.0);
04624         if (start > end) {
04625                 end_angle += (2.0 * M_PI);
04626         }
04627 
04628         /* We will always have at least 2 points */
04629         numpoints = 2;
04630 
04631         /* Count points (rather than calculating it) */
04632         angle = start_angle;
04633         while (angle < end_angle) {
04634                 angle += deltaAngle;
04635                 numpoints++;
04636         }
04637 
04638         /* Allocate combined vertex array */
04639         vx = vy = (Sint16 *) malloc(2 * sizeof(Uint16) * numpoints);
04640         if (vx == NULL) {
04641                 return (-1);
04642         }
04643 
04644         /* Update point to start of vy */
04645         vy += numpoints;
04646 
04647         /* Center */
04648         vx[0] = x;
04649         vy[0] = y;
04650 
04651         /* First vertex */
04652         angle = start_angle;
04653         vx[1] = x + (int) (dr * cos(angle));
04654         vy[1] = y + (int) (dr * sin(angle));
04655 
04656         if (numpoints<3)
04657         {
04658                 result = lineColor(dst, vx[0], vy[0], vx[1], vy[1], color);
04659         }
04660         else
04661         {
04662                 /* Calculate other vertices */
04663                 i = 2;
04664                 angle = start_angle;
04665                 while (angle < end_angle) {
04666                         angle += deltaAngle;
04667                         if (angle>end_angle)
04668                         {
04669                                 angle = end_angle;
04670                         }
04671                         vx[i] = x + (int) (dr * cos(angle));
04672                         vy[i] = y + (int) (dr * sin(angle));
04673                         i++;
04674                 }
04675 
04676                 /* Draw */
04677                 if (filled) {
04678                         result = filledPolygonColor(dst, vx, vy, numpoints, color);
04679                 } else {
04680                         result = polygonColor(dst, vx, vy, numpoints, color);
04681                 }
04682         }
04683 
04684         /* Free combined vertex array */
04685         free(vx);
04686 
04687         return (result);
04688 }
04689 
04703 int pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, 
04704         Sint16 start, Sint16 end, Uint32 color) 
04705 {
04706         return (_pieColor(dst, x, y, rad, start, end, color, 0));
04707 
04708 }
04709 
04726 int pieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
04727         Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04728 {
04729         return (_pieColor(dst, x, y, rad, start, end,
04730                 ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, 0));
04731 
04732 }
04733 
04747 int filledPieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
04748 {
04749         return (_pieColor(dst, x, y, rad, start, end, color, 1));
04750 }
04751 
04768 int filledPieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
04769         Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04770 {
04771         return (_pieColor(dst, x, y, rad, start, end,
04772                 ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, 1));
04773 }
04774 
04775 /* ------ Trigon */
04776 
04793 int trigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
04794 {
04795         Sint16 vx[3]; 
04796         Sint16 vy[3];
04797 
04798         vx[0]=x1;
04799         vx[1]=x2;
04800         vx[2]=x3;
04801         vy[0]=y1;
04802         vy[1]=y2;
04803         vy[2]=y3;
04804 
04805         return(polygonColor(dst,vx,vy,3,color));
04806 }
04807 
04825 int trigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
04826         Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04827 {
04828         Sint16 vx[3]; 
04829         Sint16 vy[3];
04830 
04831         vx[0]=x1;
04832         vx[1]=x2;
04833         vx[2]=x3;
04834         vy[0]=y1;
04835         vy[1]=y2;
04836         vy[2]=y3;
04837 
04838         return(polygonRGBA(dst,vx,vy,3,r,g,b,a));
04839 }                                
04840 
04841 /* ------ AA-Trigon */
04842 
04859 int aatrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
04860 {
04861         Sint16 vx[3]; 
04862         Sint16 vy[3];
04863 
04864         vx[0]=x1;
04865         vx[1]=x2;
04866         vx[2]=x3;
04867         vy[0]=y1;
04868         vy[1]=y2;
04869         vy[2]=y3;
04870 
04871         return(aapolygonColor(dst,vx,vy,3,color));
04872 }
04873 
04891 int aatrigonRGBA(SDL_Surface * dst,  Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
04892         Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04893 {
04894         Sint16 vx[3]; 
04895         Sint16 vy[3];
04896 
04897         vx[0]=x1;
04898         vx[1]=x2;
04899         vx[2]=x3;
04900         vy[0]=y1;
04901         vy[1]=y2;
04902         vy[2]=y3;
04903 
04904         return(aapolygonRGBA(dst,vx,vy,3,r,g,b,a));
04905 }                                  
04906 
04907 /* ------ Filled Trigon */
04908 
04925 int filledTrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
04926 {
04927         Sint16 vx[3]; 
04928         Sint16 vy[3];
04929 
04930         vx[0]=x1;
04931         vx[1]=x2;
04932         vx[2]=x3;
04933         vy[0]=y1;
04934         vy[1]=y2;
04935         vy[2]=y3;
04936 
04937         return(filledPolygonColor(dst,vx,vy,3,color));
04938 }
04939 
04959 int filledTrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
04960         Uint8 r, Uint8 g, Uint8 b, Uint8 a)
04961 {
04962         Sint16 vx[3]; 
04963         Sint16 vy[3];
04964 
04965         vx[0]=x1;
04966         vx[1]=x2;
04967         vx[2]=x3;
04968         vy[0]=y1;
04969         vy[1]=y2;
04970         vy[2]=y3;
04971 
04972         return(filledPolygonRGBA(dst,vx,vy,3,r,g,b,a));
04973 }
04974 
04975 /* ---- Polygon */
04976 
04988 int polygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
04989 {
04990         int result;
04991         int i;
04992         const Sint16 *x1, *y1, *x2, *y2;
04993 
04994         /*
04995         * Check visibility of clipping rectangle
04996         */
04997         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
04998                 return(0);
04999         }
05000 
05001         /*
05002         * Vertex array NULL check 
05003         */
05004         if (vx == NULL) {
05005                 return (-1);
05006         }
05007         if (vy == NULL) {
05008                 return (-1);
05009         }
05010 
05011         /*
05012         * Sanity check 
05013         */
05014         if (n < 3) {
05015                 return (-1);
05016         }
05017 
05018         /*
05019         * Pointer setup 
05020         */
05021         x1 = x2 = vx;
05022         y1 = y2 = vy;
05023         x2++;
05024         y2++;
05025 
05026         /*
05027         * Draw 
05028         */
05029         result = 0;
05030         for (i = 1; i < n; i++) {
05031                 result |= lineColor(dst, *x1, *y1, *x2, *y2, color);
05032                 x1 = x2;
05033                 y1 = y2;
05034                 x2++;
05035                 y2++;
05036         }
05037         result |= lineColor(dst, *x1, *y1, *vx, *vy, color);
05038 
05039         return (result);
05040 }
05041 
05056 int polygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
05057 {
05058         /*
05059         * Draw 
05060         */
05061         return (polygonColor(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
05062 }
05063 
05064 /* ---- AA-Polygon */
05065 
05077 int aapolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
05078 {
05079         int result;
05080         int i;
05081         const Sint16 *x1, *y1, *x2, *y2;
05082 
05083         /*
05084         * Check visibility of clipping rectangle
05085         */
05086         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
05087                 return(0);
05088         }
05089 
05090         /*
05091         * Vertex array NULL check 
05092         */
05093         if (vx == NULL) {
05094                 return (-1);
05095         }
05096         if (vy == NULL) {
05097                 return (-1);
05098         }
05099 
05100         /*
05101         * Sanity check 
05102         */
05103         if (n < 3) {
05104                 return (-1);
05105         }
05106 
05107         /*
05108         * Pointer setup 
05109         */
05110         x1 = x2 = vx;
05111         y1 = y2 = vy;
05112         x2++;
05113         y2++;
05114 
05115         /*
05116         * Draw 
05117         */
05118         result = 0;
05119         for (i = 1; i < n; i++) {
05120                 result |= _aalineColor(dst, *x1, *y1, *x2, *y2, color, 0);
05121                 x1 = x2;
05122                 y1 = y2;
05123                 x2++;
05124                 y2++;
05125         }
05126         result |= _aalineColor(dst, *x1, *y1, *vx, *vy, color, 0);
05127 
05128         return (result);
05129 }
05130 
05145 int aapolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
05146 {
05147         /*
05148         * Draw 
05149         */
05150         return (aapolygonColor(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
05151 }
05152 
05153 /* ---- Filled Polygon */
05154 
05163 int _gfxPrimitivesCompareInt(const void *a, const void *b)
05164 {
05165         return (*(const int *) a) - (*(const int *) b);
05166 }
05167 
05173 static int *gfxPrimitivesPolyIntsGlobal = NULL;
05174 
05180 static int gfxPrimitivesPolyAllocatedGlobal = 0;
05181 
05197 int filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated)
05198 {
05199         int result;
05200         int i;
05201         int y, xa, xb;
05202         int miny, maxy;
05203         int x1, y1;
05204         int x2, y2;
05205         int ind1, ind2;
05206         int ints;
05207         int *gfxPrimitivesPolyInts = NULL;
05208         int *gfxPrimitivesPolyIntsNew = NULL;
05209         int gfxPrimitivesPolyAllocated = 0;
05210 
05211         /*
05212         * Check visibility of clipping rectangle
05213         */
05214         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
05215                 return(0);
05216         }
05217 
05218         /*
05219         * Vertex array NULL check 
05220         */
05221         if (vx == NULL) {
05222                 return (-1);
05223         }
05224         if (vy == NULL) {
05225                 return (-1);
05226         }
05227 
05228         /*
05229         * Sanity check number of edges
05230         */
05231         if (n < 3) {
05232                 return -1;
05233         }
05234 
05235         /*
05236         * Map polygon cache  
05237         */
05238         if ((polyInts==NULL) || (polyAllocated==NULL)) {
05239                 /* Use global cache */
05240                 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
05241                 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
05242         } else {
05243                 /* Use local cache */
05244                 gfxPrimitivesPolyInts = *polyInts;
05245                 gfxPrimitivesPolyAllocated = *polyAllocated;
05246         }
05247 
05248         /*
05249         * Allocate temp array, only grow array 
05250         */
05251         if (!gfxPrimitivesPolyAllocated) {
05252                 gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
05253                 gfxPrimitivesPolyAllocated = n;
05254         } else {
05255                 if (gfxPrimitivesPolyAllocated < n) {
05256                         gfxPrimitivesPolyIntsNew = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
05257                         if (!gfxPrimitivesPolyIntsNew) {
05258                                 if (!gfxPrimitivesPolyInts) {
05259                                         free(gfxPrimitivesPolyInts);
05260                                         gfxPrimitivesPolyInts = NULL;
05261                                 }
05262                                 gfxPrimitivesPolyAllocated = 0;
05263                         } else {
05264                                 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsNew;
05265                                 gfxPrimitivesPolyAllocated = n;
05266                         }
05267                 }
05268         }
05269 
05270         /*
05271         * Check temp array
05272         */
05273         if (gfxPrimitivesPolyInts==NULL) {        
05274                 gfxPrimitivesPolyAllocated = 0;
05275         }
05276 
05277         /*
05278         * Update cache variables
05279         */
05280         if ((polyInts==NULL) || (polyAllocated==NULL)) { 
05281                 gfxPrimitivesPolyIntsGlobal =  gfxPrimitivesPolyInts;
05282                 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
05283         } else {
05284                 *polyInts = gfxPrimitivesPolyInts;
05285                 *polyAllocated = gfxPrimitivesPolyAllocated;
05286         }
05287 
05288         /*
05289         * Check temp array again
05290         */
05291         if (gfxPrimitivesPolyInts==NULL) {        
05292                 return(-1);
05293         }
05294 
05295         /*
05296         * Determine Y maxima 
05297         */
05298         miny = vy[0];
05299         maxy = vy[0];
05300         for (i = 1; (i < n); i++) {
05301                 if (vy[i] < miny) {
05302                         miny = vy[i];
05303                 } else if (vy[i] > maxy) {
05304                         maxy = vy[i];
05305                 }
05306         }
05307 
05308         /*
05309         * Draw, scanning y 
05310         */
05311         result = 0;
05312         for (y = miny; (y <= maxy); y++) {
05313                 ints = 0;
05314                 for (i = 0; (i < n); i++) {
05315                         if (!i) {
05316                                 ind1 = n - 1;
05317                                 ind2 = 0;
05318                         } else {
05319                                 ind1 = i - 1;
05320                                 ind2 = i;
05321                         }
05322                         y1 = vy[ind1];
05323                         y2 = vy[ind2];
05324                         if (y1 < y2) {
05325                                 x1 = vx[ind1];
05326                                 x2 = vx[ind2];
05327                         } else if (y1 > y2) {
05328                                 y2 = vy[ind1];
05329                                 y1 = vy[ind2];
05330                                 x2 = vx[ind1];
05331                                 x1 = vx[ind2];
05332                         } else {
05333                                 continue;
05334                         }
05335                         if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
05336                                 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
05337                         }           
05338                 }
05339 
05340                 qsort(gfxPrimitivesPolyInts, ints, sizeof(int), _gfxPrimitivesCompareInt);
05341 
05342                 for (i = 0; (i < ints); i += 2) {
05343                         xa = gfxPrimitivesPolyInts[i] + 1;
05344                         xa = (xa >> 16) + ((xa & 32768) >> 15);
05345                         xb = gfxPrimitivesPolyInts[i+1] - 1;
05346                         xb = (xb >> 16) + ((xb & 32768) >> 15);
05347                         result |= hlineColor(dst, xa, xb, y, color);
05348                 }
05349         }
05350 
05351         return (result);
05352 }
05353 
05372 int filledPolygonRGBAMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
05373 {
05374         /*
05375         * Draw 
05376         */
05377         return (filledPolygonColorMT(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, polyInts, polyAllocated));
05378 }
05379 
05394 int filledPolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
05395 {
05396         /*
05397         * Draw 
05398         */
05399         return (filledPolygonColorMT(dst, vx, vy, n, color, NULL, NULL));
05400 }
05401 
05416 int filledPolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
05417 {
05418         /*
05419         * Draw 
05420         */
05421         return (filledPolygonColorMT(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, NULL, NULL));
05422 }
05423 
05437 int _HLineTextured(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface *texture, int texture_dx, int texture_dy)
05438 {
05439         Sint16 left, right, top, bottom;
05440         Sint16 w;
05441         Sint16 xtmp;
05442         int result = 0;
05443         int texture_x_walker;    
05444         int texture_y_start;    
05445         SDL_Rect source_rect,dst_rect;
05446         int pixels_written,write_width;
05447 
05448         /*
05449         * Check visibility of clipping rectangle
05450         */
05451         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
05452                 return(0);
05453         }
05454 
05455         /*
05456         * Swap x1, x2 if required to ensure x1<=x2
05457         */
05458         if (x1 > x2) {
05459                 xtmp = x1;
05460                 x1 = x2;
05461                 x2 = xtmp;
05462         }
05463 
05464         /*
05465         * Get clipping boundary and
05466         * check visibility of hline 
05467         */
05468         left = dst->clip_rect.x;
05469         if (x2<left) {
05470                 return(0);
05471         }
05472         right = dst->clip_rect.x + dst->clip_rect.w - 1;
05473         if (x1>right) {
05474                 return(0);
05475         }
05476         top = dst->clip_rect.y;
05477         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
05478         if ((y<top) || (y>bottom)) {
05479                 return (0);
05480         }
05481 
05482         /*
05483         * Clip x 
05484         */
05485         if (x1 < left) {
05486                 x1 = left;
05487         }
05488         if (x2 > right) {
05489                 x2 = right;
05490         }
05491 
05492         /*
05493         * Calculate width to draw
05494         */
05495         w = x2 - x1 + 1;
05496 
05497         /*
05498         * Determine where in the texture we start drawing
05499         */
05500         texture_x_walker =   (x1 - texture_dx)  % texture->w;
05501         if (texture_x_walker < 0){
05502                 texture_x_walker = texture->w + texture_x_walker ;
05503         }
05504 
05505         texture_y_start = (y + texture_dy) % texture->h;
05506         if (texture_y_start < 0){
05507                 texture_y_start = texture->h + texture_y_start;
05508         }
05509 
05510         // setup the source rectangle; we are only drawing one horizontal line
05511         source_rect.y = texture_y_start;
05512         source_rect.x = texture_x_walker;
05513         source_rect.h = 1;
05514 
05515         // we will draw to the current y
05516         dst_rect.y = y;
05517 
05518         // if there are enough pixels left in the current row of the texture
05519         // draw it all at once
05520         if (w <= texture->w -texture_x_walker){
05521                 source_rect.w = w;
05522                 source_rect.x = texture_x_walker;
05523                 dst_rect.x= x1;
05524                 result = (SDL_BlitSurface  (texture, &source_rect , dst, &dst_rect) == 0);
05525         } else { // we need to draw multiple times
05526                 // draw the first segment
05527                 pixels_written = texture->w  - texture_x_walker;
05528                 source_rect.w = pixels_written;
05529                 source_rect.x = texture_x_walker;
05530                 dst_rect.x= x1;
05531                 result |= (SDL_BlitSurface (texture, &source_rect , dst, &dst_rect) == 0);
05532                 write_width = texture->w;
05533 
05534                 // now draw the rest
05535                 // set the source x to 0
05536                 source_rect.x = 0;
05537                 while (pixels_written < w){
05538                         if (write_width >= w - pixels_written) {
05539                                 write_width =  w - pixels_written;
05540                         }
05541                         source_rect.w = write_width;
05542                         dst_rect.x = x1 + pixels_written;
05543                         result  |= (SDL_BlitSurface  (texture,&source_rect , dst, &dst_rect) == 0);
05544                         pixels_written += write_width;
05545                 }
05546         }
05547 
05548         return result;
05549 }
05550 
05574 int texturedPolygonMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, 
05575         SDL_Surface * texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)
05576 {
05577         int result;
05578         int i;
05579         int y, xa, xb;
05580         int minx,maxx,miny, maxy;
05581         int x1, y1;
05582         int x2, y2;
05583         int ind1, ind2;
05584         int ints;
05585         int *gfxPrimitivesPolyInts = NULL;
05586         int gfxPrimitivesPolyAllocated = 0;
05587 
05588         /*
05589         * Check visibility of clipping rectangle
05590         */
05591         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
05592                 return(0);
05593         }
05594 
05595         /*
05596         * Sanity check number of edges
05597         */
05598         if (n < 3) {
05599                 return -1;
05600         }
05601 
05602         /*
05603         * Map polygon cache  
05604         */
05605         if ((polyInts==NULL) || (polyAllocated==NULL)) {
05606                 /* Use global cache */
05607                 gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
05608                 gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
05609         } else {
05610                 /* Use local cache */
05611                 gfxPrimitivesPolyInts = *polyInts;
05612                 gfxPrimitivesPolyAllocated = *polyAllocated;
05613         }
05614 
05615         /*
05616         * Allocate temp array, only grow array 
05617         */
05618         if (!gfxPrimitivesPolyAllocated) {
05619                 gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
05620                 gfxPrimitivesPolyAllocated = n;
05621         } else {
05622                 if (gfxPrimitivesPolyAllocated < n) {
05623                         gfxPrimitivesPolyInts = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
05624                         gfxPrimitivesPolyAllocated = n;
05625                 }
05626         }
05627 
05628         /*
05629         * Check temp array
05630         */
05631         if (gfxPrimitivesPolyInts==NULL) {        
05632                 gfxPrimitivesPolyAllocated = 0;
05633         }
05634 
05635         /*
05636         * Update cache variables
05637         */
05638         if ((polyInts==NULL) || (polyAllocated==NULL)) { 
05639                 gfxPrimitivesPolyIntsGlobal =  gfxPrimitivesPolyInts;
05640                 gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
05641         } else {
05642                 *polyInts = gfxPrimitivesPolyInts;
05643                 *polyAllocated = gfxPrimitivesPolyAllocated;
05644         }
05645 
05646         /*
05647         * Check temp array again
05648         */
05649         if (gfxPrimitivesPolyInts==NULL) {        
05650                 return(-1);
05651         }
05652 
05653         /*
05654         * Determine X,Y minima,maxima 
05655         */
05656         miny = vy[0];
05657         maxy = vy[0];
05658         minx = vx[0];
05659         maxx = vx[0];
05660         for (i = 1; (i < n); i++) {
05661                 if (vy[i] < miny) {
05662                         miny = vy[i];
05663                 } else if (vy[i] > maxy) {
05664                         maxy = vy[i];
05665                 }
05666                 if (vx[i] < minx) {
05667                         minx = vx[i];
05668                 } else if (vx[i] > maxx) {
05669                         maxx = vx[i];
05670                 }
05671         }
05672         if (maxx <0 || minx > dst->w){
05673                 return -1;
05674         }
05675         if (maxy <0 || miny > dst->h){
05676                 return -1;
05677         }
05678 
05679         /*
05680         * Draw, scanning y 
05681         */
05682         result = 0;
05683         for (y = miny; (y <= maxy); y++) {
05684                 ints = 0;
05685                 for (i = 0; (i < n); i++) {
05686                         if (!i) {
05687                                 ind1 = n - 1;
05688                                 ind2 = 0;
05689                         } else {
05690                                 ind1 = i - 1;
05691                                 ind2 = i;
05692                         }
05693                         y1 = vy[ind1];
05694                         y2 = vy[ind2];
05695                         if (y1 < y2) {
05696                                 x1 = vx[ind1];
05697                                 x2 = vx[ind2];
05698                         } else if (y1 > y2) {
05699                                 y2 = vy[ind1];
05700                                 y1 = vy[ind2];
05701                                 x2 = vx[ind1];
05702                                 x1 = vx[ind2];
05703                         } else {
05704                                 continue;
05705                         }
05706                         if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
05707                                 gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
05708                         } 
05709                 }
05710 
05711                 qsort(gfxPrimitivesPolyInts, ints, sizeof(int), _gfxPrimitivesCompareInt);
05712 
05713                 for (i = 0; (i < ints); i += 2) {
05714                         xa = gfxPrimitivesPolyInts[i] + 1;
05715                         xa = (xa >> 16) + ((xa & 32768) >> 15);
05716                         xb = gfxPrimitivesPolyInts[i+1] - 1;
05717                         xb = (xb >> 16) + ((xb & 32768) >> 15);
05718                         result |= _HLineTextured(dst, xa, xb, y, texture, texture_dx, texture_dy);
05719                 }
05720         }
05721 
05722         return (result);
05723 }
05724 
05741 int texturedPolygon(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
05742 {
05743         /*
05744         * Draw
05745         */
05746         return (texturedPolygonMT(dst, vx, vy, n, texture, texture_dx, texture_dy, NULL, NULL));
05747 }
05748 
05749 
05750 /* ---- Character */
05751 
05755 static SDL_Surface *gfxPrimitivesFont[256];
05756 
05760 static Uint32 gfxPrimitivesFontColor[256];
05761 
05765 static const unsigned char *currentFontdata = gfxPrimitivesFontdata;
05766 
05770 static Uint32 charWidth = 8;
05771 
05775 static Uint32 charHeight = 8;
05776 
05780 static Uint32 charWidthLocal = 8;
05781 
05785 static Uint32 charHeightLocal = 8;
05786 
05790 static Uint32 charPitch = 1;
05791 
05795 static Uint32 charRotation = 0;
05796 
05800 static Uint32 charSize = 8;
05801 
05815 void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch)
05816 {
05817         int i;
05818 
05819         if ((fontdata) && (cw) && (ch)) {
05820                 currentFontdata = fontdata;
05821                 charWidth = cw;
05822                 charHeight = ch;
05823         } else {
05824                 currentFontdata = gfxPrimitivesFontdata;
05825                 charWidth = 8;
05826                 charHeight = 8;
05827         }
05828 
05829         charPitch = (charWidth+7)/8;
05830         charSize = charPitch * charHeight;
05831 
05832         /* Maybe flip width/height for rendering */
05833         if ((charRotation==1) || (charRotation==3))
05834         {
05835                 charWidthLocal = charHeight;
05836                 charHeightLocal = charWidth;
05837         }
05838         else
05839         {
05840                 charWidthLocal = charWidth;
05841                 charHeightLocal = charHeight;
05842         }
05843 
05844         /* Clear character cache */
05845         for (i = 0; i < 256; i++) {
05846                 if (gfxPrimitivesFont[i]) {
05847                         SDL_FreeSurface(gfxPrimitivesFont[i]);
05848                         gfxPrimitivesFont[i] = NULL;
05849                 }
05850         }
05851 }
05852 
05861 void gfxPrimitivesSetFontRotation(Uint32 rotation)
05862 {
05863         int i;
05864 
05865         rotation = rotation & 3;
05866         if (charRotation != rotation)
05867         {
05868                 /* Store rotation */
05869                 charRotation = rotation;
05870 
05871                 /* Maybe flip width/height for rendering */
05872                 if ((charRotation==1) || (charRotation==3))
05873                 {
05874                         charWidthLocal = charHeight;
05875                         charHeightLocal = charWidth;
05876                 }
05877                 else
05878                 {
05879                         charWidthLocal = charWidth;
05880                         charHeightLocal = charHeight;
05881                 }
05882 
05883                 /* Clear character cache */
05884                 for (i = 0; i < 256; i++) {
05885                         if (gfxPrimitivesFont[i]) {
05886                                 SDL_FreeSurface(gfxPrimitivesFont[i]);
05887                                 gfxPrimitivesFont[i] = NULL;
05888                         }
05889                 }
05890         }
05891 }
05892 
05908 int characterColor(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint32 color)
05909 {
05910         Sint16 left, right, top, bottom;
05911         Sint16 x1, y1, x2, y2;
05912         SDL_Rect srect;
05913         SDL_Rect drect;
05914         int result;
05915         Uint32 ix, iy;
05916         const unsigned char *charpos;
05917         Uint8 *curpos;
05918         int forced_redraw;
05919         Uint8 patt, mask;
05920         Uint8 *linepos;
05921         Uint32 pitch;
05922         SDL_Surface *rotatedCharacter;
05923         Uint32 ci;
05924 
05925         /*
05926         * Check visibility of clipping rectangle
05927         */
05928         if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
05929                 return(0);
05930         }
05931 
05932         /*
05933         * Get text and clipping boundary and
05934         * test if bounding box of character is visible 
05935         */
05936 
05937         left = dst->clip_rect.x;
05938         x2 = x + charWidthLocal;
05939         if (x2<left) {
05940                 return(0);
05941         } 
05942         right = dst->clip_rect.x + dst->clip_rect.w - 1;
05943         x1 = x;
05944         if (x1>right) {
05945                 return(0);
05946         } 
05947         top = dst->clip_rect.y;
05948         y2 = y + charHeightLocal;
05949         if (y2<top) {
05950                 return(0);
05951         } 
05952         bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
05953         y1 = y;
05954         if (y1>bottom) {
05955                 return(0);
05956         } 
05957 
05958         /*
05959         * Setup source rectangle
05960         */
05961         srect.x = 0;
05962         srect.y = 0;
05963         srect.w = charWidthLocal;
05964         srect.h = charHeightLocal;
05965 
05966         /*
05967         * Setup destination rectangle
05968         */
05969         drect.x = x;
05970         drect.y = y;
05971         drect.w = charWidthLocal;
05972         drect.h = charHeightLocal;
05973 
05974         /* Character index in cache */
05975         ci = (unsigned char) c;
05976 
05977         /*
05978         * Create new charWidth x charHeight bitmap surface if not already present.
05979         * Might get rotated later.
05980         */
05981         if (gfxPrimitivesFont[ci] == NULL) {
05982                 gfxPrimitivesFont[ci] =
05983                         SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA,
05984                         charWidth, charHeight, 32,
05985                         0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
05986                 /*
05987                 * Check pointer 
05988                 */
05989                 if (gfxPrimitivesFont[ci] == NULL) {
05990                         return (-1);
05991                 }
05992                 /*
05993                 * Definitely redraw 
05994                 */
05995                 forced_redraw = 1;
05996         } else {
05997                 forced_redraw = 0;
05998         }
05999 
06000         /*
06001         * Check if color has changed 
06002         */
06003         if ((gfxPrimitivesFontColor[ci] != color) || (forced_redraw)) {
06004                 /*
06005                 * Redraw character 
06006                 */
06007                 SDL_SetAlpha(gfxPrimitivesFont[ci], SDL_SRCALPHA, 255);
06008                 gfxPrimitivesFontColor[ci] = color;
06009 
06010                 /* Lock font-surface */
06011                 if (SDL_LockSurface(gfxPrimitivesFont[ci]) != 0)
06012                         return (-1);
06013 
06014                 /*
06015                 * Variable setup 
06016                 */
06017                 charpos = currentFontdata + ci * charSize;
06018                 linepos = (Uint8 *) gfxPrimitivesFont[ci]->pixels;
06019                 pitch = gfxPrimitivesFont[ci]->pitch;
06020 
06021                 /*
06022                 * Drawing loop 
06023                 */
06024                 patt = 0;
06025                 for (iy = 0; iy < charHeight; iy++) {
06026                         mask = 0x00;
06027                         curpos = linepos;
06028                         for (ix = 0; ix < charWidth; ix++) {
06029                                 if (!(mask >>= 1)) {
06030                                         patt = *charpos++;
06031                                         mask = 0x80;
06032                                 }
06033 
06034                                 if (patt & mask)
06035                                         *(Uint32 *)curpos = color;
06036                                 else
06037                                         *(Uint32 *)curpos = 0;
06038                                 curpos += 4;
06039                         }
06040                         linepos += pitch;
06041                 }
06042 
06043                 /* Unlock font-surface */
06044                 SDL_UnlockSurface(gfxPrimitivesFont[ci]);
06045 
06046                 /* Maybe rotate and replace cached image */
06047                 if (charRotation>0)
06048                 {
06049                         rotatedCharacter = rotateSurface90Degrees(gfxPrimitivesFont[ci], charRotation);
06050                         SDL_FreeSurface(gfxPrimitivesFont[ci]);
06051                         gfxPrimitivesFont[ci] = rotatedCharacter;
06052                 }
06053         }
06054 
06055         /*
06056         * Draw bitmap onto destination surface 
06057         */
06058         result = SDL_BlitSurface(gfxPrimitivesFont[ci], &srect, dst, &drect);
06059 
06060         return (result);
06061 }
06062 
06077 int characterRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
06078 {
06079         /*
06080         * Draw 
06081         */
06082         return (characterColor(dst, x, y, c, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
06083 }
06084 
06099 int stringColor(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint32 color)
06100 {
06101         int result = 0;
06102         Sint16 curx = x;
06103         Sint16 cury = y;
06104         const char *curchar = s;
06105 
06106         while (*curchar && !result) {
06107                 result |= characterColor(dst, curx, cury, *curchar, color);
06108                 switch (charRotation)
06109                 {
06110                 case 0:
06111                         curx += charWidthLocal;
06112                         break;
06113                 case 2:
06114                         curx -= charWidthLocal;
06115                         break;
06116                 case 1:
06117                         cury += charHeightLocal;
06118                         break;
06119                 case 3:
06120                         cury -= charHeightLocal;
06121                         break;
06122                 }
06123                 curchar++;
06124         }
06125 
06126         return (result);
06127 }
06128 
06143 int stringRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
06144 {
06145         /*
06146         * Draw 
06147         */
06148         return (stringColor(dst, x, y, s, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
06149 }
06150 
06151 /* ---- Bezier curve */
06152 
06162 double _evaluateBezier (double *data, int ndata, double t) 
06163 {
06164         double mu, result;
06165         int n,k,kn,nn,nkn;
06166         double blend,muk,munk;
06167 
06168         /* Sanity check bounds */
06169         if (t<0.0) {
06170                 return(data[0]);
06171         }
06172         if (t>=(double)ndata) {
06173                 return(data[ndata-1]);
06174         }
06175 
06176         /* Adjust t to the range 0.0 to 1.0 */ 
06177         mu=t/(double)ndata;
06178 
06179         /* Calculate interpolate */
06180         n=ndata-1;
06181         result=0.0;
06182         muk = 1;
06183         munk = pow(1-mu,(double)n);
06184         for (k=0;k<=n;k++) {
06185                 nn = n;
06186                 kn = k;
06187                 nkn = n - k;
06188                 blend = muk * munk;
06189                 muk *= mu;
06190                 munk /= (1-mu);
06191                 while (nn >= 1) {
06192                         blend *= nn;
06193                         nn--;
06194                         if (kn > 1) {
06195                                 blend /= (double)kn;
06196                                 kn--;
06197                         }
06198                         if (nkn > 1) {
06199                                 blend /= (double)nkn;
06200                                 nkn--;
06201                         }
06202                 }
06203                 result += data[k] * blend;
06204         }
06205 
06206         return (result);
06207 }
06208 
06221 int bezierColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color)
06222 {
06223         int result;
06224         int i;
06225         double *x, *y, t, stepsize;
06226         Sint16 x1, y1, x2, y2;
06227 
06228         /*
06229         * Sanity check 
06230         */
06231         if (n < 3) {
06232                 return (-1);
06233         }
06234         if (s < 2) {
06235                 return (-1);
06236         }
06237 
06238         /*
06239         * Variable setup 
06240         */
06241         stepsize=(double)1.0/(double)s;
06242 
06243         /* Transfer vertices into float arrays */
06244         if ((x=(double *)malloc(sizeof(double)*(n+1)))==NULL) {
06245                 return(-1);
06246         }
06247         if ((y=(double *)malloc(sizeof(double)*(n+1)))==NULL) {
06248                 free(x);
06249                 return(-1);
06250         }    
06251         for (i=0; i<n; i++) {
06252                 x[i]=(double)vx[i];
06253                 y[i]=(double)vy[i];
06254         }      
06255         x[n]=(double)vx[0];
06256         y[n]=(double)vy[0];
06257 
06258         /*
06259         * Draw 
06260         */
06261         result = 0;
06262         t=0.0;
06263         x1=(Sint16)lrint(_evaluateBezier(x,n+1,t));
06264         y1=(Sint16)lrint(_evaluateBezier(y,n+1,t));
06265         for (i = 0; i <= (n*s); i++) {
06266                 t += stepsize;
06267                 x2=(Sint16)_evaluateBezier(x,n,t);
06268                 y2=(Sint16)_evaluateBezier(y,n,t);
06269                 result |= lineColor(dst, x1, y1, x2, y2, color);
06270                 x1 = x2;
06271                 y1 = y2;
06272         }
06273 
06274         /* Clean up temporary array */
06275         free(x);
06276         free(y);
06277 
06278         return (result);
06279 }
06280 
06296 int bezierRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
06297 {
06298         /*
06299         * Draw 
06300         */
06301         return (bezierColor(dst, vx, vy, n, s, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
06302 }
06303 
06304 
06323 int _bresenhamInitialize(SDL_gfxBresenhamIterator *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
06324 {
06325         int temp;
06326 
06327         if (b==NULL) {
06328                 return(-1);
06329         }
06330 
06331         b->x = x1;
06332         b->y = y1;
06333 
06334         /* dx = abs(x2-x1), s1 = sign(x2-x1) */
06335         if ((b->dx = x2 - x1) != 0) {
06336                 if (b->dx < 0) {
06337                         b->dx = -b->dx;
06338                         b->s1 = -1;
06339                 } else {
06340                         b->s1 = 1;
06341                 }
06342         } else {
06343                 b->s1 = 0;      
06344         }
06345 
06346         /* dy = abs(y2-y1), s2 = sign(y2-y1)    */
06347         if ((b->dy = y2 - y1) != 0) {
06348                 if (b->dy < 0) {
06349                         b->dy = -b->dy;
06350                         b->s2 = -1;
06351                 } else {
06352                         b->s2 = 1;
06353                 }
06354         } else {
06355                 b->s2 = 0;      
06356         }
06357 
06358         if (b->dy > b->dx) {
06359                 temp = b->dx;
06360                 b->dx = b->dy;
06361                 b->dy = temp;
06362                 b->swapdir = 1;
06363         } else {
06364                 b->swapdir = 0;
06365         }
06366 
06367         b->count = (b->dx<0) ? 0 : (unsigned int)b->dx;
06368         b->dy <<= 1;
06369         b->error = b->dy - b->dx;
06370         b->dx <<= 1;    
06371 
06372         return(0);
06373 }
06374 
06375 
06385 int _bresenhamIterate(SDL_gfxBresenhamIterator *b)
06386 {       
06387         if (b==NULL) {
06388                 return (-1);
06389         }
06390 
06391         /* last point check */
06392         if (b->count==0) {
06393                 return (2);
06394         }
06395 
06396         while (b->error >= 0) {
06397                 if (b->swapdir) {
06398                         b->x += b->s1;
06399                 } else  {
06400                         b->y += b->s2;
06401                 }
06402 
06403                 b->error -= b->dx;
06404         }
06405 
06406         if (b->swapdir) {
06407                 b->y += b->s2;
06408         } else {
06409                 b->x += b->s1;
06410         }
06411 
06412         b->error += b->dy;      
06413         b->count--;             
06414 
06415         /* count==0 indicates "end-of-line" */
06416         return ((b->count) ? 0 : 1);
06417 }
06418 
06419 
06428 void _murphyParaline(SDL_gfxMurphyIterator *m, Sint16 x, Sint16 y, int d1)
06429 {
06430         int p;
06431         d1 = -d1;
06432 
06433         /*
06434         * Lock the surface 
06435         */
06436         if (SDL_MUSTLOCK(m->dst)) {
06437                 SDL_LockSurface(m->dst);
06438         }
06439 
06440         for (p = 0; p <= m->u; p++) {
06441 
06442                 pixelColorNolock(m->dst, x, y, m->color);
06443 
06444                 if (d1 <= m->kt) {
06445                         if (m->oct2 == 0) {
06446                                 x++;
06447                         } else {
06448                                 if (m->quad4 == 0) {
06449                                         y++;
06450                                 } else {
06451                                         y--;
06452                                 }
06453                         }
06454                         d1 += m->kv;
06455                 } else {        
06456                         x++;
06457                         if (m->quad4 == 0) {
06458                                 y++;
06459                         } else {
06460                                 y--;
06461                         }
06462                         d1 += m->kd;
06463                 }
06464         }
06465 
06466         /* Unlock surface */
06467         if (SDL_MUSTLOCK(m->dst)) {
06468                 SDL_UnlockSurface(m->dst);
06469         }
06470 
06471         m->tempx = x;
06472         m->tempy = y;
06473 }
06474 
06490 void _murphyIteration(SDL_gfxMurphyIterator *m, Uint8 miter, 
06491         Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by, 
06492         Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)
06493 {
06494         int atemp1, atemp2;
06495         int ftmp1, ftmp2;
06496         Uint16 m1x, m1y, m2x, m2y;      
06497         Uint16 fix, fiy, lax, lay, curx, cury;
06498         Uint16 px[4], py[4];
06499         SDL_gfxBresenhamIterator b;
06500 
06501         if (miter > 1) {
06502                 if (m->first1x != -32768) {
06503                         fix = (m->first1x + m->first2x) / 2;
06504                         fiy = (m->first1y + m->first2y) / 2;
06505                         lax = (m->last1x + m->last2x) / 2;
06506                         lay = (m->last1y + m->last2y) / 2;
06507                         curx = (ml1x + ml2x) / 2;
06508                         cury = (ml1y + ml2y) / 2;
06509 
06510                         atemp1 = (fix - curx);
06511                         atemp2 = (fiy - cury);
06512                         ftmp1 = atemp1 * atemp1 + atemp2 * atemp2;
06513                         atemp1 = (lax - curx);
06514                         atemp2 = (lay - cury);
06515                         ftmp2 = atemp1 * atemp1 + atemp2 * atemp2;
06516 
06517                         if (ftmp1 <= ftmp2) {
06518                                 m1x = m->first1x;
06519                                 m1y = m->first1y;
06520                                 m2x = m->first2x;
06521                                 m2y = m->first2y;
06522                         } else {
06523                                 m1x = m->last1x;
06524                                 m1y = m->last1y;
06525                                 m2x = m->last2x;
06526                                 m2y = m->last2y;
06527                         }
06528 
06529                         atemp1 = (m2x - ml2x);
06530                         atemp2 = (m2y - ml2y);
06531                         ftmp1 = atemp1 * atemp1 + atemp2 * atemp2;
06532                         atemp1 = (m2x - ml2bx);
06533                         atemp2 = (m2y - ml2by);
06534                         ftmp2 = atemp1 * atemp1 + atemp2 * atemp2;
06535 
06536                         if (ftmp2 >= ftmp1) {
06537                                 ftmp1 = ml2bx;
06538                                 ftmp2 = ml2by;
06539                                 ml2bx = ml2x;
06540                                 ml2by = ml2y;
06541                                 ml2x = ftmp1;
06542                                 ml2y = ftmp2;
06543                                 ftmp1 = ml1bx;
06544                                 ftmp2 = ml1by;
06545                                 ml1bx = ml1x;
06546                                 ml1by = ml1y;
06547                                 ml1x = ftmp1;
06548                                 ml1y = ftmp2;
06549                         }
06550 
06551                         /*
06552                         * Lock the surface 
06553                         */
06554                         if (SDL_MUSTLOCK(m->dst)) {
06555                                 SDL_LockSurface(m->dst);
06556                         }
06557 
06558                         _bresenhamInitialize(&b, m2x, m2y, m1x, m1y);
06559                         do {
06560                                 pixelColorNolock(m->dst, b.x, b.y, m->color);
06561                         } while (_bresenhamIterate(&b)==0);
06562 
06563                         _bresenhamInitialize(&b, m1x, m1y, ml1bx, ml1by);
06564                         do {
06565                                 pixelColorNolock(m->dst, b.x, b.y, m->color);
06566                         } while (_bresenhamIterate(&b)==0);
06567 
06568                         _bresenhamInitialize(&b, ml1bx, ml1by, ml2bx, ml2by);
06569                         do {
06570                                 pixelColorNolock(m->dst, b.x, b.y, m->color);
06571                         } while (_bresenhamIterate(&b)==0);
06572 
06573                         _bresenhamInitialize(&b, ml2bx, ml2by, m2x, m2y);
06574                         do {
06575                                 pixelColorNolock(m->dst, b.x, b.y, m->color);
06576                         } while (_bresenhamIterate(&b)==0);
06577 
06578                         /* Unlock surface */
06579                         if (SDL_MUSTLOCK(m->dst)) {
06580                                 SDL_UnlockSurface(m->dst);
06581                         }
06582 
06583                         px[0] = m1x;
06584                         px[1] = m2x;
06585                         px[2] = ml1bx;
06586                         px[3] = ml2bx;
06587                         py[0] = m1y;
06588                         py[1] = m2y;
06589                         py[2] = ml1by;
06590                         py[3] = ml2by;                  
06591                         polygonColor(m->dst, px, py, 4, m->color);                                              
06592                 }
06593         }
06594 
06595         m->last1x = ml1x;
06596         m->last1y = ml1y;
06597         m->last2x = ml2x;
06598         m->last2y = ml2y;
06599         m->first1x = ml1bx;
06600         m->first1y = ml1by;
06601         m->first2x = ml2bx;
06602         m->first2y = ml2by;
06603 }
06604 
06605 
06606 #define HYPOT(x,y) sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y)) 
06607 
06622 void _murphyWideline(SDL_gfxMurphyIterator *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)
06623 {       
06624         float offset = (float)width / 2.f;
06625 
06626         Sint16 temp;
06627         Sint16 ptx, pty, ptxx, ptxy, ml1x, ml1y, ml2x, ml2y, ml1bx, ml1by, ml2bx, ml2by;
06628 
06629         int d0, d1;             /* difference terms d0=perpendicular to line, d1=along line */
06630 
06631         int q;                  /* pel counter,q=perpendicular to line */
06632         int tmp;
06633 
06634         int dd;                 /* distance along line */
06635         int tk;                 /* thickness threshold */
06636         double ang;             /* angle for initial point calculation */
06637         double sang, cang;
06638 
06639         /* Initialisation */
06640         m->u = x2 - x1; /* delta x */
06641         m->v = y2 - y1; /* delta y */
06642 
06643         if (m->u < 0) { /* swap to make sure we are in quadrants 1 or 4 */
06644                 temp = x1;
06645                 x1 = x2;
06646                 x2 = temp;
06647                 temp = y1;
06648                 y1 = y2;
06649                 y2 = temp;              
06650                 m->u *= -1;
06651                 m->v *= -1;
06652         }
06653 
06654         if (m->v < 0) { /* swap to 1st quadrant and flag */
06655                 m->v *= -1;
06656                 m->quad4 = 1;
06657         } else {
06658                 m->quad4 = 0;
06659         }
06660 
06661         if (m->v > m->u) {      /* swap things if in 2 octant */
06662                 tmp = m->u;
06663                 m->u = m->v;
06664                 m->v = tmp;
06665                 m->oct2 = 1;
06666         } else {
06667                 m->oct2 = 0;
06668         }
06669 
06670         m->ku = m->u + m->u;    /* change in l for square shift */
06671         m->kv = m->v + m->v;    /* change in d for square shift */
06672         m->kd = m->kv - m->ku;  /* change in d for diagonal shift */
06673         m->kt = m->u - m->kv;   /* diag/square decision threshold */
06674 
06675         d0 = 0;
06676         d1 = 0;
06677         dd = 0;
06678 
06679         ang = atan((double) m->v / (double) m->u);      /* calc new initial point - offset both sides of ideal */       
06680         sang = sin(ang);
06681         cang = cos(ang);
06682 
06683         if (m->oct2 == 0) {
06684                 ptx = x1 + (Sint16)lrint(offset * sang);
06685                 if (m->quad4 == 0) {
06686                         pty = y1 - (Sint16)lrint(offset * cang);
06687                 } else {
06688                         pty = y1 + (Sint16)lrint(offset * cang);
06689                 }
06690         } else {
06691                 ptx = x1 - (Sint16)lrint(offset * cang);
06692                 if (m->quad4 == 0) {
06693                         pty = y1 + (Sint16)lrint(offset * sang);
06694                 } else {
06695                         pty = y1 - (Sint16)lrint(offset * sang);
06696                 }
06697         }
06698 
06699         /* used here for constant thickness line */
06700         tk = (int) (4. * HYPOT(ptx - x1, pty - y1) * HYPOT(m->u, m->v));
06701 
06702         if (miter == 0) {
06703                 m->first1x = -32768;
06704                 m->first1y = -32768;
06705                 m->first2x = -32768;
06706                 m->first2y = -32768;
06707                 m->last1x = -32768;
06708                 m->last1y = -32768;
06709                 m->last2x = -32768;
06710                 m->last2y = -32768;
06711         }
06712         ptxx = ptx;
06713         ptxy = pty;
06714 
06715         for (q = 0; dd <= tk; q++) {    /* outer loop, stepping perpendicular to line */
06716 
06717                 _murphyParaline(m, ptx, pty, d1);       /* call to inner loop - right edge */
06718                 if (q == 0) {
06719                         ml1x = ptx;
06720                         ml1y = pty;
06721                         ml1bx = m->tempx;
06722                         ml1by = m->tempy;
06723                 } else {
06724                         ml2x = ptx;
06725                         ml2y = pty;
06726                         ml2bx = m->tempx;
06727                         ml2by = m->tempy;
06728                 }
06729                 if (d0 < m->kt) {       /* square move */
06730                         if (m->oct2 == 0) {
06731                                 if (m->quad4 == 0) {
06732                                         pty++;
06733                                 } else {
06734                                         pty--;
06735                                 }
06736                         } else {
06737                                 ptx++;
06738                         }
06739                 } else {        /* diagonal move */
06740                         dd += m->kv;
06741                         d0 -= m->ku;
06742                         if (d1 < m->kt) {       /* normal diagonal */
06743                                 if (m->oct2 == 0) {
06744                                         ptx--;
06745                                         if (m->quad4 == 0) {
06746                                                 pty++;
06747                                         } else {
06748                                                 pty--;
06749                                         }
06750                                 } else {
06751                                         ptx++;
06752                                         if (m->quad4 == 0) {
06753                                                 pty--;
06754                                         } else {
06755                                                 pty++;
06756                                         }
06757                                 }
06758                                 d1 += m->kv;
06759                         } else {        /* double square move, extra parallel line */
06760                                 if (m->oct2 == 0) {
06761                                         ptx--;
06762                                 } else {
06763                                         if (m->quad4 == 0) {
06764                                                 pty--;
06765                                         } else {
06766                                                 pty++;
06767                                         }
06768                                 }
06769                                 d1 += m->kd;
06770                                 if (dd > tk) {
06771                                         _murphyIteration(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y);
06772                                         return; /* breakout on the extra line */
06773                                 }
06774                                 _murphyParaline(m, ptx, pty, d1);
06775                                 if (m->oct2 == 0) {
06776                                         if (m->quad4 == 0) {
06777                                                 pty++;
06778                                         } else {
06779 
06780                                                 pty--;
06781                                         }
06782                                 } else {
06783                                         ptx++;
06784                                 }
06785                         }
06786                 }
06787                 dd += m->ku;
06788                 d0 += m->kv;
06789         }
06790 
06791         _murphyIteration(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y);
06792 }
06793 
06794 
06808 int thickLineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
06809 {       
06810         int wh;
06811         SDL_gfxMurphyIterator m;
06812 
06813         if (dst == NULL) return -1;
06814         if (width < 1) return -1;
06815 
06816         /* Special case: thick "point" */
06817         if ((x1 == x2) && (y1 == y2)) {
06818                 wh = width / 2;
06819                 return boxColor(dst, x1 - wh, y1 - wh, x2 + width, y2 + width, color);          
06820         }
06821 
06822         m.dst = dst;
06823         m.color = color;
06824 
06825         _murphyWideline(&m, x1, y1, x2, y2, width, 0);
06826         _murphyWideline(&m, x1, y1, x2, y2, width, 1);
06827 
06828         return(0);
06829 }
06830 
06847 int thickLineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
06848 {
06849         return (thickLineColor(dst, x1, y1, x2, y2, width, 
06850                 ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
06851 }
sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_primitives_8h.html000066400000000000000000007320011225506657100227210ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.h File Reference
I:/Sources/sdlgfx/SDL_gfxPrimitives.h File Reference
#include <math.h>
#include "SDL.h"

Go to the source code of this file.

Defines

#define M_PI   3.1415926535897932384626433832795
#define SDL_GFXPRIMITIVES_MAJOR   2
#define SDL_GFXPRIMITIVES_MINOR   0
#define SDL_GFXPRIMITIVES_MICRO   25
#define SDL_GFXPRIMITIVES_SCOPE   extern

Functions

SDL_GFXPRIMITIVES_SCOPE int pixelColor (SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
 Pixel draw with blending enabled if a<255.
SDL_GFXPRIMITIVES_SCOPE int pixelRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Pixel draw with blending enabled if a<255.
SDL_GFXPRIMITIVES_SCOPE int hlineColor (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
 Draw horizontal line with blending.
SDL_GFXPRIMITIVES_SCOPE int hlineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw horizontal line with blending.
SDL_GFXPRIMITIVES_SCOPE int vlineColor (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
 Draw vertical line with blending.
SDL_GFXPRIMITIVES_SCOPE int vlineRGBA (SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw vertical line with blending.
SDL_GFXPRIMITIVES_SCOPE int rectangleColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw rectangle with blending.
SDL_GFXPRIMITIVES_SCOPE int rectangleRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rectangle with blending.
SDL_GFXPRIMITIVES_SCOPE int roundedRectangleColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner rectangle with blending.
SDL_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner rectangle with blending.
SDL_GFXPRIMITIVES_SCOPE int boxColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw box (filled rectangle) with blending.
SDL_GFXPRIMITIVES_SCOPE int boxRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw box (filled rectangle) with blending.
SDL_GFXPRIMITIVES_SCOPE int roundedBoxColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
 Draw rounded-corner box (filled rectangle) with blending.
SDL_GFXPRIMITIVES_SCOPE int roundedBoxRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw rounded-corner box (filled rectangle) with blending.
SDL_GFXPRIMITIVES_SCOPE int lineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Draw line with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int lineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw line with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int aalineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
 Ddraw anti-aliased line with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int aalineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased line with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int thickLineColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
 Draw a thick line with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int thickLineRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a thick line with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int circleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw circle with blending.
SDL_GFXPRIMITIVES_SCOPE int circleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw circle with blending.
SDL_GFXPRIMITIVES_SCOPE int arcColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Arc with blending.
SDL_GFXPRIMITIVES_SCOPE int arcRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Arc with blending.
SDL_GFXPRIMITIVES_SCOPE int aacircleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
 Draw anti-aliased circle with blending.
SDL_GFXPRIMITIVES_SCOPE int aacircleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased circle with blending.
SDL_GFXPRIMITIVES_SCOPE int filledCircleColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color)
 Draw filled circle with blending.
SDL_GFXPRIMITIVES_SCOPE int filledCircleRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled circle with blending.
SDL_GFXPRIMITIVES_SCOPE int ellipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw ellipse with blending.
SDL_GFXPRIMITIVES_SCOPE int ellipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw ellipse with blending.
SDL_GFXPRIMITIVES_SCOPE int aaellipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw anti-aliased ellipse with blending.
SDL_GFXPRIMITIVES_SCOPE int aaellipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased ellipse with blending.
SDL_GFXPRIMITIVES_SCOPE int filledEllipseColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
 Draw filled ellipse with blending.
SDL_GFXPRIMITIVES_SCOPE int filledEllipseRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled ellipse with blending.
SDL_GFXPRIMITIVES_SCOPE int pieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw pie (outline) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int pieRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw pie (outline) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int filledPieColor (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
 Draw filled pie with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int filledPieRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled pie with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int trigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw trigon (triangle outline) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int trigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw trigon (triangle outline) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int aatrigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int aatrigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased trigon (triangle outline) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int filledTrigonColor (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
 Draw filled trigon (triangle) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int filledTrigonRGBA (SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled trigon (triangle) with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int polygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw polygon with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int polygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw polygon with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int aapolygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw anti-aliased polygon with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int aapolygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw anti-aliased polygon with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int filledPolygonColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color)
 Draw filled polygon with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw filled polygon with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int texturedPolygon (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
 Draws a polygon filled with the given texture.
SDL_GFXPRIMITIVES_SCOPE int filledPolygonColorMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint32 color, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBAMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
 Draw filled polygon with alpha blending (multi-threaded capable).
SDL_GFXPRIMITIVES_SCOPE int texturedPolygonMT (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)
 Draws a polygon filled with the given texture (Multi-Threading Capable).
SDL_GFXPRIMITIVES_SCOPE int bezierColor (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint32 color)
 Draw a bezier curve with alpha blending.
SDL_GFXPRIMITIVES_SCOPE int bezierRGBA (SDL_Surface *dst, const Sint16 *vx, const Sint16 *vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a bezier curve with alpha blending.
SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont (const void *fontdata, Uint32 cw, Uint32 ch)
 Sets or resets the current global font data.
SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation (Uint32 rotation)
 Sets current global font character rotation steps.
SDL_GFXPRIMITIVES_SCOPE int characterColor (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint32 color)
 Draw a character of the currently set font.
SDL_GFXPRIMITIVES_SCOPE int characterRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a character of the currently set font.
SDL_GFXPRIMITIVES_SCOPE int stringColor (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint32 color)
 Draw a string in the currently set font.
SDL_GFXPRIMITIVES_SCOPE int stringRGBA (SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Draw a string in the currently set font.

Define Documentation

#define M_PI   3.1415926535897932384626433832795

Definition at line 35 of file SDL_gfxPrimitives.h.

#define SDL_GFXPRIMITIVES_MAJOR   2

Definition at line 47 of file SDL_gfxPrimitives.h.

#define SDL_GFXPRIMITIVES_MICRO   25

Definition at line 49 of file SDL_gfxPrimitives.h.

#define SDL_GFXPRIMITIVES_MINOR   0

Definition at line 48 of file SDL_gfxPrimitives.h.

#define SDL_GFXPRIMITIVES_SCOPE   extern

Definition at line 64 of file SDL_gfxPrimitives.h.


Function Documentation

SDL_GFXPRIMITIVES_SCOPE int aacircleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw anti-aliased circle with blending.

Note: The AA-circle routine is based on AA-ellipse with identical radii.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
colorThe color value of the aa-circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3512 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aacircleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-circle.
yY coordinate of the center of the aa-circle.
radRadius in pixels of the aa-circle.
rThe red value of the aa-circle to draw.
gThe green value of the aa-circle to draw.
bThe blue value of the aa-circle to draw.
aThe alpha value of the aa-circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3531 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aaellipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw anti-aliased ellipse with blending.

Note: Based on code from Anders Lindstroem, which is based on code from sge library, which is based on code from TwinLib.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
colorThe color value of the aa-ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4088 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aaellipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the aa-ellipse.
yY coordinate of the center of the aa-ellipse.
rxHorizontal radius in pixels of the aa-ellipse.
ryVertical radius in pixels of the aa-ellipse.
rThe red value of the aa-ellipse to draw.
gThe green value of the aa-ellipse to draw.
bThe blue value of the aa-ellipse to draw.
aThe alpha value of the aa-ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4328 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aalineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Ddraw anti-aliased line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
colorThe color value of the aa-line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2828 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aalineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-line.
y1Y coordinate of the first point of the aa-line.
x2X coordinate of the second point of the aa-line.
y2Y coordinate of the second point of the aa-line.
rThe red value of the aa-line to draw.
gThe green value of the aa-line to draw.
bThe blue value of the aa-line to draw.
aThe alpha value of the aa-line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2848 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aapolygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the aa-polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5077 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aapolygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the aa-polygon.
vyVertex array containing Y coordinates of the points of the aa-polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the aa-polygon to draw.
gThe green value of the aa-polygon to draw.
bThe blue value of the aa-polygon to draw.
aThe alpha value of the aa-polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5145 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aatrigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
colorThe color value of the aa-trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4859 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int aatrigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw anti-aliased trigon (triangle outline) with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the aa-trigon.
y1Y coordinate of the first point of the aa-trigon.
x2X coordinate of the second point of the aa-trigon.
y2Y coordinate of the second point of the aa-trigon.
x3X coordinate of the third point of the aa-trigon.
y3Y coordinate of the third point of the aa-trigon.
rThe red value of the aa-trigon to draw.
gThe green value of the aa-trigon to draw.
bThe blue value of the aa-trigon to draw.
aThe alpha value of the aa-trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4891 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int arcColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Arc with blending.

Note Arc drawing is based on circle algorithm by A. Schiffler and written by D. Raber. Calculates which octants arc goes through and renders pixels accordingly.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
colorThe color value of the arc to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3117 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int arcRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Arc with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the arc.
yY coordinate of the center of the arc.
radRadius in pixels of the arc.
startStarting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
endEnding radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
rThe red value of the arc to draw.
gThe green value of the arc to draw.
bThe blue value of the arc to draw.
aThe alpha value of the arc to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3488 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int bezierColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint32  color 
)

Draw a bezier curve with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
colorThe color value of the bezier curve to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6221 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int bezierRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
int  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a bezier curve with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the bezier curve.
vyVertex array containing Y coordinates of the points of the bezier curve.
nNumber of points in the vertex array. Minimum number is 3.
sNumber of steps for the interpolation. Minimum number is 2.
rThe red value of the bezier curve to draw.
gThe green value of the bezier curve to draw.
bThe blue value of the bezier curve to draw.
aThe alpha value of the bezier curve to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6296 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int boxColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2107 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int boxRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2319 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int characterColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
char  c,
Uint32  color 
)

Draw a character of the currently set font.

On first call for a particular character and color combination, the function needs to generate the character surface (slower. Subsequent calls blit a cached surface (fast). Uses alpha blending if A<255 in color.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
colorThe color value of the character to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5908 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int characterRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
char  c,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a character of the currently set font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the character.
yY (vertical) coordinate of the upper left corner of the character.
cThe character to draw.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6077 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int circleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw circle with blending.

Note: Circle drawing routine is based on an algorithms from the sge library, but modified by A. Schiffler for multiple pixel-draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
colorThe color value of the circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2872 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int circleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
radRadius in pixels of the circle.
rThe red value of the circle to draw.
gThe green value of the circle to draw.
bThe blue value of the circle to draw.
aThe alpha value of the circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3090 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int ellipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw ellipse with blending.

Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-pixel draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
colorThe color value of the ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3709 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int ellipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the ellipse.
yY coordinate of the center of the ellipse.
rxHorizontal radius in pixels of the ellipse.
ryVertical radius in pixels of the ellipse.
rThe red value of the ellipse to draw.
gThe green value of the ellipse to draw.
bThe blue value of the ellipse to draw.
aThe alpha value of the ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4023 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledCircleColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)

Draw filled circle with blending.

Note: Based on algorithms from sge library with modifications by A. Schiffler for multiple-hline draw removal and other minor speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
colorThe color value of the filled circle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3556 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledCircleRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled circle with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled circle.
yY coordinate of the center of the filled circle.
radRadius in pixels of the filled circle.
rThe red value of the filled circle to draw.
gThe green value of the filled circle to draw.
bThe blue value of the filled circle to draw.
aThe alpha value of the filled circle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 3683 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledEllipseColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint32  color 
)

Draw filled ellipse with blending.

Note: Based on algorithm from sge library with multiple-hline draw removal and other speedup changes.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
colorThe color value of the filled ellipse to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4358 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledEllipseRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rx,
Sint16  ry,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled ellipse with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled ellipse.
yY coordinate of the center of the filled ellipse.
rxHorizontal radius in pixels of the filled ellipse.
ryVertical radius in pixels of the filled ellipse.
rThe red value of the filled ellipse to draw.
gThe green value of the filled ellipse to draw.
bThe blue value of the filled ellipse to draw.
aThe alpha value of the filled ellipse to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4526 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledPieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw filled pie with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
colorThe color value of the filled pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4747 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledPieRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled pie with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the filled pie.
yY coordinate of the center of the filled pie.
radRadius in pixels of the filled pie.
startStarting radius in degrees of the filled pie.
endEnding radius in degrees of the filled pie.
rThe red value of the filled pie to draw.
gThe green value of the filled pie to draw.
bThe blue value of the filled pie to draw.
aThe alpha value of the filled pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4768 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledPolygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw filled polygon with alpha blending.

Note: Standard filledPolygon function is calling multithreaded version with NULL parameters to use the global vertex cache.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5394 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledPolygonColorMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the filled polygon to draw (0xRRGGBBAA).
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5197 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5416 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBAMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a,
int **  polyInts,
int *  polyAllocated 
)

Draw filled polygon with alpha blending (multi-threaded capable).

Note: The last two parameters are optional; but are required for multithreaded operation.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the filled polygon.
vyVertex array containing Y coordinates of the points of the filled polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the filled polygon to draw.
gThe green value of the filled polygon to draw.
bThe blue value of the filed polygon to draw.
aThe alpha value of the filled polygon to draw.
polyIntsPreallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
polyAllocatedFlag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5372 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledTrigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
colorThe color value of the filled trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4925 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int filledTrigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw filled trigon (triangle) with alpha blending.

Note: Creates vertex array and uses aapolygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the filled trigon.
y1Y coordinate of the first point of the filled trigon.
x2X coordinate of the second point of the filled trigon.
y2Y coordinate of the second point of the filled trigon.
x3X coordinate of the third point of the filled trigon.
y3Y coordinate of the third point of the filled trigon.
rThe red value of the filled trigon to draw.
gThe green value of the filled trigon to draw.
bThe blue value of the filled trigon to draw.
aThe alpha value of the filled trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4959 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont ( const void *  fontdata,
Uint32  cw,
Uint32  ch 
)

Sets or resets the current global font data.

The font data array is organized in follows: [fontdata] = [character 0][character 1]...[character 255] where [character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where [byte n] = [bit 0]...[bit 7] where [bit n] = [0 for transparent pixel|1 for colored pixel]

Parameters:
fontdataPointer to array of font data. Set to NULL, to reset global font to the default 8x8 font.
cwWidth of character in bytes. Ignored if fontdata==NULL.
chHeight of character in bytes. Ignored if fontdata==NULL.

Definition at line 5815 of file SDL_gfxPrimitives.c.

Sets current global font character rotation steps.

Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache.

Parameters:
rotationNumber of 90deg clockwise steps to rotate

Definition at line 5861 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int hlineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint32  color 
)

Draw horizontal line with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1204 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int hlineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  x2,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw horizontal line with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. left) of the line.
x2X coordinate of the second point (i.e. right) of the line.
yY coordinate of the points of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1373 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int lineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2347 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int lineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 2556 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int pieColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint32  color 
)

Draw pie (outline) with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
colorThe color value of the pie to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4703 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int pieRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Sint16  start,
Sint16  end,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw pie (outline) with alpha blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the center of the pie.
yY coordinate of the center of the pie.
radRadius in pixels of the pie.
startStarting radius in degrees of the pie.
endEnding radius in degrees of the pie.
rThe red value of the pie to draw.
gThe green value of the pie to draw.
bThe blue value of the pie to draw.
aThe alpha value of the pie to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4726 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int pixelColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint32  color 
)

Pixel draw with blending enabled if a<255.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
colorThe color value of the pixel to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 509 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int pixelRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Pixel draw with blending enabled if a<255.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the pixel.
yY (vertical) coordinate of the pixel.
rThe red color value of the pixel to draw.
gThe green color value of the pixel to draw.
bThe blue color value of the pixel to draw.
aThe alpha value of the pixel to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 995 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int polygonColor ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint32  color 
)

Draw polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
colorThe color value of the polygon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4988 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int polygonRGBA ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw polygon with alpha blending.

Parameters:
dstThe surface to draw on.
vxVertex array containing X coordinates of the points of the polygon.
vyVertex array containing Y coordinates of the points of the polygon.
nNumber of points in the vertex array. Minimum number is 3.
rThe red value of the polygon to draw.
gThe green value of the polygon to draw.
bThe blue value of the polygon to draw.
aThe alpha value of the polygon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5056 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int rectangleColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint32  color 
)

Draw rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1580 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int rectangleRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1663 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int roundedBoxColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
colorThe color value of the box to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1837 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int roundedBoxRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner box (filled rectangle) with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the box.
y1Y coordinate of the first point (i.e. top right) of the box.
x2X coordinate of the second point (i.e. bottom left) of the box.
y2Y coordinate of the second point (i.e. bottom left) of the box.
radThe radius of the corner arcs of the box.
rThe red value of the box to draw.
gThe green value of the box to draw.
bThe blue value of the box to draw.
aThe alpha value of the box to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1970 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int roundedRectangleColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint32  color 
)

Draw rounded-corner rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
colorThe color value of the rectangle to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1685 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  rad,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw rounded-corner rectangle with blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point (i.e. top right) of the rectangle.
y1Y coordinate of the first point (i.e. top right) of the rectangle.
x2X coordinate of the second point (i.e. bottom left) of the rectangle.
y2Y coordinate of the second point (i.e. bottom left) of the rectangle.
radThe radius of the corner arc.
rThe red value of the rectangle to draw.
gThe green value of the rectangle to draw.
bThe blue value of the rectangle to draw.
aThe alpha value of the rectangle to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1815 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int stringColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
const char *  s,
Uint32  color 
)

Draw a string in the currently set font.

The spacing between consequtive characters in the string is the fixed number of pixels of the character width of the current global font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
colorThe color value of the string to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6099 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int stringRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y,
const char *  s,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a string in the currently set font.

Parameters:
dstThe surface to draw on.
xX (horizontal) coordinate of the upper left corner of the string.
yY (vertical) coordinate of the upper left corner of the string.
sThe string to draw.
rThe red value of the string to draw.
gThe green value of the string to draw.
bThe blue value of the string to draw.
aThe alpha value of the string to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6143 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int texturedPolygon ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy 
)

Draws a polygon filled with the given texture.

This standard version is calling multithreaded versions with NULL cache parameters.

Parameters:
dstthe destination surface,
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5741 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int texturedPolygonMT ( SDL_Surface *  dst,
const Sint16 *  vx,
const Sint16 *  vy,
int  n,
SDL_Surface *  texture,
int  texture_dx,
int  texture_dy,
int **  polyInts,
int *  polyAllocated 
)

Draws a polygon filled with the given texture (Multi-Threading Capable).

This operation use internally SDL_BlitSurface for lines of the source texture. It supports alpha drawing.

To get the best performance of this operation you need to make sure the texture and the dst surface have the same format (see http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html). The last two parameters are optional, but required for multithreaded operation. When set to NULL, uses global static temp array.

Parameters:
dstthe destination surface,
vxarray of x vector components
vyarray of x vector components
nthe amount of vectors in the vx and vy array
texturethe sdl surface to use to fill the polygon
texture_dxthe offset of the texture relative to the screeen. if you move the polygon 10 pixels to the left and want the texture to apear the same you need to increase the texture_dx value
texture_dysee texture_dx
polyIntspreallocated temp array storage for vertex sorting (used for multi-threaded operation)
polyAllocatedflag indicating oif the temp array was allocated (used for multi-threaded operation)
Returns:
Returns 0 on success, -1 on failure.

Definition at line 5574 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int thickLineColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint32  color 
)

Draw a thick line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6808 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int thickLineRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Uint8  width,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw a thick line with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the line.
y1Y coordinate of the first point of the line.
x2X coordinate of the second point of the line.
y2Y coordinate of the second point of the line.
widthWidth of the line in pixels. Must be >0.
rThe red value of the character to draw.
gThe green value of the character to draw.
bThe blue value of the character to draw.
aThe alpha value of the character to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 6847 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int trigonColor ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint32  color 
)

Draw trigon (triangle outline) with alpha blending.

Note: Creates vertex array and uses polygon routine to render.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
colorThe color value of the trigon to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4793 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int trigonRGBA ( SDL_Surface *  dst,
Sint16  x1,
Sint16  y1,
Sint16  x2,
Sint16  y2,
Sint16  x3,
Sint16  y3,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw trigon (triangle outline) with alpha blending.

Parameters:
dstThe surface to draw on.
x1X coordinate of the first point of the trigon.
y1Y coordinate of the first point of the trigon.
x2X coordinate of the second point of the trigon.
y2Y coordinate of the second point of the trigon.
x3X coordinate of the third point of the trigon.
y3Y coordinate of the third point of the trigon.
rThe red value of the trigon to draw.
gThe green value of the trigon to draw.
bThe blue value of the trigon to draw.
aThe alpha value of the trigon to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 4825 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int vlineColor ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint32  color 
)

Draw vertical line with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
colorThe color value of the line to draw (0xRRGGBBAA).
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1392 of file SDL_gfxPrimitives.c.

SDL_GFXPRIMITIVES_SCOPE int vlineRGBA ( SDL_Surface *  dst,
Sint16  x,
Sint16  y1,
Sint16  y2,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)

Draw vertical line with blending.

Parameters:
dstThe surface to draw on.
xX coordinate of the points of the line.
y1Y coordinate of the first point (i.e. top) of the line.
y2Y coordinate of the second point (i.e. bottom) of the line.
rThe red value of the line to draw.
gThe green value of the line to draw.
bThe blue value of the line to draw.
aThe alpha value of the line to draw.
Returns:
Returns 0 on success, -1 on failure.

Definition at line 1560 of file SDL_gfxPrimitives.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_primitives_8h_source.html000066400000000000000000001237471225506657100243140ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives.h Source File
I:/Sources/sdlgfx/SDL_gfxPrimitives.h
Go to the documentation of this file.
00001 /* 
00002 
00003 SDL_gfxPrimitives.h: graphics primitives for SDL
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL_gfxPrimitives_h
00031 #define _SDL_gfxPrimitives_h
00032 
00033 #include <math.h>
00034 #ifndef M_PI
00035 #define M_PI    3.1415926535897932384626433832795
00036 #endif
00037 
00038 #include "SDL.h"
00039 
00040 /* Set up for C function definitions, even when using C++ */
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045         /* ----- Versioning */
00046 
00047 #define SDL_GFXPRIMITIVES_MAJOR 2
00048 #define SDL_GFXPRIMITIVES_MINOR 0
00049 #define SDL_GFXPRIMITIVES_MICRO 25
00050 
00051 
00052         /* ---- Function Prototypes */
00053 
00054 #ifdef _MSC_VER
00055 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
00056 #    define SDL_GFXPRIMITIVES_SCOPE __declspec(dllexport)
00057 #  else
00058 #    ifdef LIBSDL_GFX_DLL_IMPORT
00059 #      define SDL_GFXPRIMITIVES_SCOPE __declspec(dllimport)
00060 #    endif
00061 #  endif
00062 #endif
00063 #ifndef SDL_GFXPRIMITIVES_SCOPE
00064 #  define SDL_GFXPRIMITIVES_SCOPE extern
00065 #endif
00066 
00067         /* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */
00068 
00069         /* Pixel */
00070 
00071         SDL_GFXPRIMITIVES_SCOPE int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color);
00072         SDL_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00073 
00074         /* Horizontal line */
00075 
00076         SDL_GFXPRIMITIVES_SCOPE int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color);
00077         SDL_GFXPRIMITIVES_SCOPE int hlineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00078 
00079         /* Vertical line */
00080 
00081         SDL_GFXPRIMITIVES_SCOPE int vlineColor(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color);
00082         SDL_GFXPRIMITIVES_SCOPE int vlineRGBA(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00083 
00084         /* Rectangle */
00085 
00086         SDL_GFXPRIMITIVES_SCOPE int rectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00087         SDL_GFXPRIMITIVES_SCOPE int rectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
00088                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00089 
00090         /* Rounded-Corner Rectangle */
00091 
00092         SDL_GFXPRIMITIVES_SCOPE int roundedRectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
00093         SDL_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
00094                 Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00095 
00096         /* Filled rectangle (Box) */
00097 
00098         SDL_GFXPRIMITIVES_SCOPE int boxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00099         SDL_GFXPRIMITIVES_SCOPE int boxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
00100                 Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00101 
00102         /* Rounded-Corner Filled rectangle (Box) */
00103 
00104         SDL_GFXPRIMITIVES_SCOPE int roundedBoxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
00105         SDL_GFXPRIMITIVES_SCOPE int roundedBoxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
00106                 Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00107 
00108         /* Line */
00109 
00110         SDL_GFXPRIMITIVES_SCOPE int lineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00111         SDL_GFXPRIMITIVES_SCOPE int lineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
00112                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00113 
00114         /* AA Line */
00115 
00116         SDL_GFXPRIMITIVES_SCOPE int aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
00117         SDL_GFXPRIMITIVES_SCOPE int aalineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
00118                 Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00119 
00120         /* Thick Line */
00121         SDL_GFXPRIMITIVES_SCOPE int thickLineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, 
00122                 Uint8 width, Uint32 color);
00123         SDL_GFXPRIMITIVES_SCOPE int thickLineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, 
00124                 Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00125 
00126         /* Circle */
00127 
00128         SDL_GFXPRIMITIVES_SCOPE int circleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
00129         SDL_GFXPRIMITIVES_SCOPE int circleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00130 
00131         /* Arc */
00132 
00133         SDL_GFXPRIMITIVES_SCOPE int arcColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color);
00134         SDL_GFXPRIMITIVES_SCOPE int arcRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, 
00135                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00136 
00137         /* AA Circle */
00138 
00139         SDL_GFXPRIMITIVES_SCOPE int aacircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
00140         SDL_GFXPRIMITIVES_SCOPE int aacircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
00141                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00142 
00143         /* Filled Circle */
00144 
00145         SDL_GFXPRIMITIVES_SCOPE int filledCircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color);
00146         SDL_GFXPRIMITIVES_SCOPE int filledCircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
00147                 Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00148 
00149         /* Ellipse */
00150 
00151         SDL_GFXPRIMITIVES_SCOPE int ellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
00152         SDL_GFXPRIMITIVES_SCOPE int ellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
00153                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00154 
00155         /* AA Ellipse */
00156 
00157         SDL_GFXPRIMITIVES_SCOPE int aaellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
00158         SDL_GFXPRIMITIVES_SCOPE int aaellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
00159                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00160 
00161         /* Filled Ellipse */
00162 
00163         SDL_GFXPRIMITIVES_SCOPE int filledEllipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
00164         SDL_GFXPRIMITIVES_SCOPE int filledEllipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
00165                 Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00166 
00167         /* Pie */
00168 
00169         SDL_GFXPRIMITIVES_SCOPE int pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
00170                 Sint16 start, Sint16 end, Uint32 color);
00171         SDL_GFXPRIMITIVES_SCOPE int pieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
00172                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00173 
00174         /* Filled Pie */
00175 
00176         SDL_GFXPRIMITIVES_SCOPE int filledPieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
00177                 Sint16 start, Sint16 end, Uint32 color);
00178         SDL_GFXPRIMITIVES_SCOPE int filledPieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
00179                 Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00180 
00181         /* Trigon */
00182 
00183         SDL_GFXPRIMITIVES_SCOPE int trigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
00184         SDL_GFXPRIMITIVES_SCOPE int trigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
00185                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00186 
00187         /* AA-Trigon */
00188 
00189         SDL_GFXPRIMITIVES_SCOPE int aatrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
00190         SDL_GFXPRIMITIVES_SCOPE int aatrigonRGBA(SDL_Surface * dst,  Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
00191                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00192 
00193         /* Filled Trigon */
00194 
00195         SDL_GFXPRIMITIVES_SCOPE int filledTrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
00196         SDL_GFXPRIMITIVES_SCOPE int filledTrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
00197                 Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00198 
00199         /* Polygon */
00200 
00201         SDL_GFXPRIMITIVES_SCOPE int polygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
00202         SDL_GFXPRIMITIVES_SCOPE int polygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
00203                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00204 
00205         /* AA-Polygon */
00206 
00207         SDL_GFXPRIMITIVES_SCOPE int aapolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
00208         SDL_GFXPRIMITIVES_SCOPE int aapolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
00209                 int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00210 
00211         /* Filled Polygon */
00212 
00213         SDL_GFXPRIMITIVES_SCOPE int filledPolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
00214         SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBA(SDL_Surface * dst, const Sint16 * vx,
00215                 const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00216         SDL_GFXPRIMITIVES_SCOPE int texturedPolygon(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy);
00217 
00218         /* (Note: These MT versions are required for multi-threaded operation.) */
00219 
00220         SDL_GFXPRIMITIVES_SCOPE int filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated);
00221         SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBAMT(SDL_Surface * dst, const Sint16 * vx,
00222                 const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
00223                 int **polyInts, int *polyAllocated);
00224         SDL_GFXPRIMITIVES_SCOPE int texturedPolygonMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy, int **polyInts, int *polyAllocated);
00225 
00226         /* Bezier */
00227 
00228         SDL_GFXPRIMITIVES_SCOPE int bezierColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color);
00229         SDL_GFXPRIMITIVES_SCOPE int bezierRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
00230                 int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00231 
00232         /* Characters/Strings */
00233 
00234         SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch);
00235         SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation(Uint32 rotation);
00236         SDL_GFXPRIMITIVES_SCOPE int characterColor(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint32 color);
00237         SDL_GFXPRIMITIVES_SCOPE int characterRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00238         SDL_GFXPRIMITIVES_SCOPE int stringColor(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint32 color);
00239         SDL_GFXPRIMITIVES_SCOPE int stringRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
00240 
00241         /* Ends C function definitions when using C++ */
00242 #ifdef __cplusplus
00243 }
00244 #endif
00245 
00246 #endif                          /* _SDL_gfxPrimitives_h */
sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_primitives__font_8h.html000066400000000000000000000057741225506657100241200ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h File Reference
I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h File Reference

Go to the source code of this file.

Defines

#define GFX_FONTDATAMAX   (8*256)

Define Documentation

#define GFX_FONTDATAMAX   (8*256)

Definition at line 6 of file SDL_gfxPrimitives_font.h.

sdlgfx-2.0.25/Docs/html/_s_d_l__gfx_primitives__font_8h_source.html000066400000000000000000010363071225506657100254750ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h Source File
I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h
Go to the documentation of this file.
00001 
00002 /* ---- 8x8 font definition ---- */
00003 
00004 /*  ZLIB (c) A. Schiffler 2001-2012 */
00005 
00006 #define GFX_FONTDATAMAX (8*256)
00007 
00008 static unsigned char gfxPrimitivesFontdata[GFX_FONTDATAMAX] = {
00009 
00010         /*
00011         * 0 0x00 '^@' 
00012         */
00013         0x00,                   /* 00000000 */
00014         0x00,                   /* 00000000 */
00015         0x00,                   /* 00000000 */
00016         0x00,                   /* 00000000 */
00017         0x00,                   /* 00000000 */
00018         0x00,                   /* 00000000 */
00019         0x00,                   /* 00000000 */
00020         0x00,                   /* 00000000 */
00021 
00022         /*
00023         * 1 0x01 '^A' 
00024         */
00025         0x7e,                   /* 01111110 */
00026         0x81,                   /* 10000001 */
00027         0xa5,                   /* 10100101 */
00028         0x81,                   /* 10000001 */
00029         0xbd,                   /* 10111101 */
00030         0x99,                   /* 10011001 */
00031         0x81,                   /* 10000001 */
00032         0x7e,                   /* 01111110 */
00033 
00034         /*
00035         * 2 0x02 '^B' 
00036         */
00037         0x7e,                   /* 01111110 */
00038         0xff,                   /* 11111111 */
00039         0xdb,                   /* 11011011 */
00040         0xff,                   /* 11111111 */
00041         0xc3,                   /* 11000011 */
00042         0xe7,                   /* 11100111 */
00043         0xff,                   /* 11111111 */
00044         0x7e,                   /* 01111110 */
00045 
00046         /*
00047         * 3 0x03 '^C' 
00048         */
00049         0x6c,                   /* 01101100 */
00050         0xfe,                   /* 11111110 */
00051         0xfe,                   /* 11111110 */
00052         0xfe,                   /* 11111110 */
00053         0x7c,                   /* 01111100 */
00054         0x38,                   /* 00111000 */
00055         0x10,                   /* 00010000 */
00056         0x00,                   /* 00000000 */
00057 
00058         /*
00059         * 4 0x04 '^D' 
00060         */
00061         0x10,                   /* 00010000 */
00062         0x38,                   /* 00111000 */
00063         0x7c,                   /* 01111100 */
00064         0xfe,                   /* 11111110 */
00065         0x7c,                   /* 01111100 */
00066         0x38,                   /* 00111000 */
00067         0x10,                   /* 00010000 */
00068         0x00,                   /* 00000000 */
00069 
00070         /*
00071         * 5 0x05 '^E' 
00072         */
00073         0x38,                   /* 00111000 */
00074         0x7c,                   /* 01111100 */
00075         0x38,                   /* 00111000 */
00076         0xfe,                   /* 11111110 */
00077         0xfe,                   /* 11111110 */
00078         0xd6,                   /* 11010110 */
00079         0x10,                   /* 00010000 */
00080         0x38,                   /* 00111000 */
00081 
00082         /*
00083         * 6 0x06 '^F' 
00084         */
00085         0x10,                   /* 00010000 */
00086         0x38,                   /* 00111000 */
00087         0x7c,                   /* 01111100 */
00088         0xfe,                   /* 11111110 */
00089         0xfe,                   /* 11111110 */
00090         0x7c,                   /* 01111100 */
00091         0x10,                   /* 00010000 */
00092         0x38,                   /* 00111000 */
00093 
00094         /*
00095         * 7 0x07 '^G' 
00096         */
00097         0x00,                   /* 00000000 */
00098         0x00,                   /* 00000000 */
00099         0x18,                   /* 00011000 */
00100         0x3c,                   /* 00111100 */
00101         0x3c,                   /* 00111100 */
00102         0x18,                   /* 00011000 */
00103         0x00,                   /* 00000000 */
00104         0x00,                   /* 00000000 */
00105 
00106         /*
00107         * 8 0x08 '^H' 
00108         */
00109         0xff,                   /* 11111111 */
00110         0xff,                   /* 11111111 */
00111         0xe7,                   /* 11100111 */
00112         0xc3,                   /* 11000011 */
00113         0xc3,                   /* 11000011 */
00114         0xe7,                   /* 11100111 */
00115         0xff,                   /* 11111111 */
00116         0xff,                   /* 11111111 */
00117 
00118         /*
00119         * 9 0x09 '^I' 
00120         */
00121         0x00,                   /* 00000000 */
00122         0x3c,                   /* 00111100 */
00123         0x66,                   /* 01100110 */
00124         0x42,                   /* 01000010 */
00125         0x42,                   /* 01000010 */
00126         0x66,                   /* 01100110 */
00127         0x3c,                   /* 00111100 */
00128         0x00,                   /* 00000000 */
00129 
00130         /*
00131         * 10 0x0a '^J' 
00132         */
00133         0xff,                   /* 11111111 */
00134         0xc3,                   /* 11000011 */
00135         0x99,                   /* 10011001 */
00136         0xbd,                   /* 10111101 */
00137         0xbd,                   /* 10111101 */
00138         0x99,                   /* 10011001 */
00139         0xc3,                   /* 11000011 */
00140         0xff,                   /* 11111111 */
00141 
00142         /*
00143         * 11 0x0b '^K' 
00144         */
00145         0x0f,                   /* 00001111 */
00146         0x07,                   /* 00000111 */
00147         0x0f,                   /* 00001111 */
00148         0x7d,                   /* 01111101 */
00149         0xcc,                   /* 11001100 */
00150         0xcc,                   /* 11001100 */
00151         0xcc,                   /* 11001100 */
00152         0x78,                   /* 01111000 */
00153 
00154         /*
00155         * 12 0x0c '^L' 
00156         */
00157         0x3c,                   /* 00111100 */
00158         0x66,                   /* 01100110 */
00159         0x66,                   /* 01100110 */
00160         0x66,                   /* 01100110 */
00161         0x3c,                   /* 00111100 */
00162         0x18,                   /* 00011000 */
00163         0x7e,                   /* 01111110 */
00164         0x18,                   /* 00011000 */
00165 
00166         /*
00167         * 13 0x0d '^M' 
00168         */
00169         0x3f,                   /* 00111111 */
00170         0x33,                   /* 00110011 */
00171         0x3f,                   /* 00111111 */
00172         0x30,                   /* 00110000 */
00173         0x30,                   /* 00110000 */
00174         0x70,                   /* 01110000 */
00175         0xf0,                   /* 11110000 */
00176         0xe0,                   /* 11100000 */
00177 
00178         /*
00179         * 14 0x0e '^N' 
00180         */
00181         0x7f,                   /* 01111111 */
00182         0x63,                   /* 01100011 */
00183         0x7f,                   /* 01111111 */
00184         0x63,                   /* 01100011 */
00185         0x63,                   /* 01100011 */
00186         0x67,                   /* 01100111 */
00187         0xe6,                   /* 11100110 */
00188         0xc0,                   /* 11000000 */
00189 
00190         /*
00191         * 15 0x0f '^O' 
00192         */
00193         0x18,                   /* 00011000 */
00194         0xdb,                   /* 11011011 */
00195         0x3c,                   /* 00111100 */
00196         0xe7,                   /* 11100111 */
00197         0xe7,                   /* 11100111 */
00198         0x3c,                   /* 00111100 */
00199         0xdb,                   /* 11011011 */
00200         0x18,                   /* 00011000 */
00201 
00202         /*
00203         * 16 0x10 '^P' 
00204         */
00205         0x80,                   /* 10000000 */
00206         0xe0,                   /* 11100000 */
00207         0xf8,                   /* 11111000 */
00208         0xfe,                   /* 11111110 */
00209         0xf8,                   /* 11111000 */
00210         0xe0,                   /* 11100000 */
00211         0x80,                   /* 10000000 */
00212         0x00,                   /* 00000000 */
00213 
00214         /*
00215         * 17 0x11 '^Q' 
00216         */
00217         0x02,                   /* 00000010 */
00218         0x0e,                   /* 00001110 */
00219         0x3e,                   /* 00111110 */
00220         0xfe,                   /* 11111110 */
00221         0x3e,                   /* 00111110 */
00222         0x0e,                   /* 00001110 */
00223         0x02,                   /* 00000010 */
00224         0x00,                   /* 00000000 */
00225 
00226         /*
00227         * 18 0x12 '^R' 
00228         */
00229         0x18,                   /* 00011000 */
00230         0x3c,                   /* 00111100 */
00231         0x7e,                   /* 01111110 */
00232         0x18,                   /* 00011000 */
00233         0x18,                   /* 00011000 */
00234         0x7e,                   /* 01111110 */
00235         0x3c,                   /* 00111100 */
00236         0x18,                   /* 00011000 */
00237 
00238         /*
00239         * 19 0x13 '^S' 
00240         */
00241         0x66,                   /* 01100110 */
00242         0x66,                   /* 01100110 */
00243         0x66,                   /* 01100110 */
00244         0x66,                   /* 01100110 */
00245         0x66,                   /* 01100110 */
00246         0x00,                   /* 00000000 */
00247         0x66,                   /* 01100110 */
00248         0x00,                   /* 00000000 */
00249 
00250         /*
00251         * 20 0x14 '^T' 
00252         */
00253         0x7f,                   /* 01111111 */
00254         0xdb,                   /* 11011011 */
00255         0xdb,                   /* 11011011 */
00256         0x7b,                   /* 01111011 */
00257         0x1b,                   /* 00011011 */
00258         0x1b,                   /* 00011011 */
00259         0x1b,                   /* 00011011 */
00260         0x00,                   /* 00000000 */
00261 
00262         /*
00263         * 21 0x15 '^U' 
00264         */
00265         0x3e,                   /* 00111110 */
00266         0x61,                   /* 01100001 */
00267         0x3c,                   /* 00111100 */
00268         0x66,                   /* 01100110 */
00269         0x66,                   /* 01100110 */
00270         0x3c,                   /* 00111100 */
00271         0x86,                   /* 10000110 */
00272         0x7c,                   /* 01111100 */
00273 
00274         /*
00275         * 22 0x16 '^V' 
00276         */
00277         0x00,                   /* 00000000 */
00278         0x00,                   /* 00000000 */
00279         0x00,                   /* 00000000 */
00280         0x00,                   /* 00000000 */
00281         0x7e,                   /* 01111110 */
00282         0x7e,                   /* 01111110 */
00283         0x7e,                   /* 01111110 */
00284         0x00,                   /* 00000000 */
00285 
00286         /*
00287         * 23 0x17 '^W' 
00288         */
00289         0x18,                   /* 00011000 */
00290         0x3c,                   /* 00111100 */
00291         0x7e,                   /* 01111110 */
00292         0x18,                   /* 00011000 */
00293         0x7e,                   /* 01111110 */
00294         0x3c,                   /* 00111100 */
00295         0x18,                   /* 00011000 */
00296         0xff,                   /* 11111111 */
00297 
00298         /*
00299         * 24 0x18 '^X' 
00300         */
00301         0x18,                   /* 00011000 */
00302         0x3c,                   /* 00111100 */
00303         0x7e,                   /* 01111110 */
00304         0x18,                   /* 00011000 */
00305         0x18,                   /* 00011000 */
00306         0x18,                   /* 00011000 */
00307         0x18,                   /* 00011000 */
00308         0x00,                   /* 00000000 */
00309 
00310         /*
00311         * 25 0x19 '^Y' 
00312         */
00313         0x18,                   /* 00011000 */
00314         0x18,                   /* 00011000 */
00315         0x18,                   /* 00011000 */
00316         0x18,                   /* 00011000 */
00317         0x7e,                   /* 01111110 */
00318         0x3c,                   /* 00111100 */
00319         0x18,                   /* 00011000 */
00320         0x00,                   /* 00000000 */
00321 
00322         /*
00323         * 26 0x1a '^Z' 
00324         */
00325         0x00,                   /* 00000000 */
00326         0x18,                   /* 00011000 */
00327         0x0c,                   /* 00001100 */
00328         0xfe,                   /* 11111110 */
00329         0x0c,                   /* 00001100 */
00330         0x18,                   /* 00011000 */
00331         0x00,                   /* 00000000 */
00332         0x00,                   /* 00000000 */
00333 
00334         /*
00335         * 27 0x1b '^[' 
00336         */
00337         0x00,                   /* 00000000 */
00338         0x30,                   /* 00110000 */
00339         0x60,                   /* 01100000 */
00340         0xfe,                   /* 11111110 */
00341         0x60,                   /* 01100000 */
00342         0x30,                   /* 00110000 */
00343         0x00,                   /* 00000000 */
00344         0x00,                   /* 00000000 */
00345 
00346         /*
00347         * 28 0x1c '^\' 
00348         */
00349         0x00,                   /* 00000000 */
00350         0x00,                   /* 00000000 */
00351         0xc0,                   /* 11000000 */
00352         0xc0,                   /* 11000000 */
00353         0xc0,                   /* 11000000 */
00354         0xfe,                   /* 11111110 */
00355         0x00,                   /* 00000000 */
00356         0x00,                   /* 00000000 */
00357 
00358         /*
00359         * 29 0x1d '^]' 
00360         */
00361         0x00,                   /* 00000000 */
00362         0x24,                   /* 00100100 */
00363         0x66,                   /* 01100110 */
00364         0xff,                   /* 11111111 */
00365         0x66,                   /* 01100110 */
00366         0x24,                   /* 00100100 */
00367         0x00,                   /* 00000000 */
00368         0x00,                   /* 00000000 */
00369 
00370         /*
00371         * 30 0x1e '^^' 
00372         */
00373         0x00,                   /* 00000000 */
00374         0x18,                   /* 00011000 */
00375         0x3c,                   /* 00111100 */
00376         0x7e,                   /* 01111110 */
00377         0xff,                   /* 11111111 */
00378         0xff,                   /* 11111111 */
00379         0x00,                   /* 00000000 */
00380         0x00,                   /* 00000000 */
00381 
00382         /*
00383         * 31 0x1f '^_' 
00384         */
00385         0x00,                   /* 00000000 */
00386         0xff,                   /* 11111111 */
00387         0xff,                   /* 11111111 */
00388         0x7e,                   /* 01111110 */
00389         0x3c,                   /* 00111100 */
00390         0x18,                   /* 00011000 */
00391         0x00,                   /* 00000000 */
00392         0x00,                   /* 00000000 */
00393 
00394         /*
00395         * 32 0x20 ' ' 
00396         */
00397         0x00,                   /* 00000000 */
00398         0x00,                   /* 00000000 */
00399         0x00,                   /* 00000000 */
00400         0x00,                   /* 00000000 */
00401         0x00,                   /* 00000000 */
00402         0x00,                   /* 00000000 */
00403         0x00,                   /* 00000000 */
00404         0x00,                   /* 00000000 */
00405 
00406         /*
00407         * 33 0x21 '!' 
00408         */
00409         0x18,                   /* 00011000 */
00410         0x3c,                   /* 00111100 */
00411         0x3c,                   /* 00111100 */
00412         0x18,                   /* 00011000 */
00413         0x18,                   /* 00011000 */
00414         0x00,                   /* 00000000 */
00415         0x18,                   /* 00011000 */
00416         0x00,                   /* 00000000 */
00417 
00418         /*
00419         * 34 0x22 '"' 
00420         */
00421         0x66,                   /* 01100110 */
00422         0x66,                   /* 01100110 */
00423         0x24,                   /* 00100100 */
00424         0x00,                   /* 00000000 */
00425         0x00,                   /* 00000000 */
00426         0x00,                   /* 00000000 */
00427         0x00,                   /* 00000000 */
00428         0x00,                   /* 00000000 */
00429 
00430         /*
00431         * 35 0x23 '#' 
00432         */
00433         0x6c,                   /* 01101100 */
00434         0x6c,                   /* 01101100 */
00435         0xfe,                   /* 11111110 */
00436         0x6c,                   /* 01101100 */
00437         0xfe,                   /* 11111110 */
00438         0x6c,                   /* 01101100 */
00439         0x6c,                   /* 01101100 */
00440         0x00,                   /* 00000000 */
00441 
00442         /*
00443         * 36 0x24 '$' 
00444         */
00445         0x18,                   /* 00011000 */
00446         0x3e,                   /* 00111110 */
00447         0x60,                   /* 01100000 */
00448         0x3c,                   /* 00111100 */
00449         0x06,                   /* 00000110 */
00450         0x7c,                   /* 01111100 */
00451         0x18,                   /* 00011000 */
00452         0x00,                   /* 00000000 */
00453 
00454         /*
00455         * 37 0x25 '%' 
00456         */
00457         0x00,                   /* 00000000 */
00458         0xc6,                   /* 11000110 */
00459         0xcc,                   /* 11001100 */
00460         0x18,                   /* 00011000 */
00461         0x30,                   /* 00110000 */
00462         0x66,                   /* 01100110 */
00463         0xc6,                   /* 11000110 */
00464         0x00,                   /* 00000000 */
00465 
00466         /*
00467         * 38 0x26 '&' 
00468         */
00469         0x38,                   /* 00111000 */
00470         0x6c,                   /* 01101100 */
00471         0x38,                   /* 00111000 */
00472         0x76,                   /* 01110110 */
00473         0xdc,                   /* 11011100 */
00474         0xcc,                   /* 11001100 */
00475         0x76,                   /* 01110110 */
00476         0x00,                   /* 00000000 */
00477 
00478         /*
00479         * 39 0x27 ''' 
00480         */
00481         0x18,                   /* 00011000 */
00482         0x18,                   /* 00011000 */
00483         0x30,                   /* 00110000 */
00484         0x00,                   /* 00000000 */
00485         0x00,                   /* 00000000 */
00486         0x00,                   /* 00000000 */
00487         0x00,                   /* 00000000 */
00488         0x00,                   /* 00000000 */
00489 
00490         /*
00491         * 40 0x28 '(' 
00492         */
00493         0x0c,                   /* 00001100 */
00494         0x18,                   /* 00011000 */
00495         0x30,                   /* 00110000 */
00496         0x30,                   /* 00110000 */
00497         0x30,                   /* 00110000 */
00498         0x18,                   /* 00011000 */
00499         0x0c,                   /* 00001100 */
00500         0x00,                   /* 00000000 */
00501 
00502         /*
00503         * 41 0x29 ')' 
00504         */
00505         0x30,                   /* 00110000 */
00506         0x18,                   /* 00011000 */
00507         0x0c,                   /* 00001100 */
00508         0x0c,                   /* 00001100 */
00509         0x0c,                   /* 00001100 */
00510         0x18,                   /* 00011000 */
00511         0x30,                   /* 00110000 */
00512         0x00,                   /* 00000000 */
00513 
00514         /*
00515         * 42 0x2a '*' 
00516         */
00517         0x00,                   /* 00000000 */
00518         0x66,                   /* 01100110 */
00519         0x3c,                   /* 00111100 */
00520         0xff,                   /* 11111111 */
00521         0x3c,                   /* 00111100 */
00522         0x66,                   /* 01100110 */
00523         0x00,                   /* 00000000 */
00524         0x00,                   /* 00000000 */
00525 
00526         /*
00527         * 43 0x2b '+' 
00528         */
00529         0x00,                   /* 00000000 */
00530         0x18,                   /* 00011000 */
00531         0x18,                   /* 00011000 */
00532         0x7e,                   /* 01111110 */
00533         0x18,                   /* 00011000 */
00534         0x18,                   /* 00011000 */
00535         0x00,                   /* 00000000 */
00536         0x00,                   /* 00000000 */
00537 
00538         /*
00539         * 44 0x2c ',' 
00540         */
00541         0x00,                   /* 00000000 */
00542         0x00,                   /* 00000000 */
00543         0x00,                   /* 00000000 */
00544         0x00,                   /* 00000000 */
00545         0x00,                   /* 00000000 */
00546         0x18,                   /* 00011000 */
00547         0x18,                   /* 00011000 */
00548         0x30,                   /* 00110000 */
00549 
00550         /*
00551         * 45 0x2d '-' 
00552         */
00553         0x00,                   /* 00000000 */
00554         0x00,                   /* 00000000 */
00555         0x00,                   /* 00000000 */
00556         0x7e,                   /* 01111110 */
00557         0x00,                   /* 00000000 */
00558         0x00,                   /* 00000000 */
00559         0x00,                   /* 00000000 */
00560         0x00,                   /* 00000000 */
00561 
00562         /*
00563         * 46 0x2e '.' 
00564         */
00565         0x00,                   /* 00000000 */
00566         0x00,                   /* 00000000 */
00567         0x00,                   /* 00000000 */
00568         0x00,                   /* 00000000 */
00569         0x00,                   /* 00000000 */
00570         0x18,                   /* 00011000 */
00571         0x18,                   /* 00011000 */
00572         0x00,                   /* 00000000 */
00573 
00574         /*
00575         * 47 0x2f '/' 
00576         */
00577         0x06,                   /* 00000110 */
00578         0x0c,                   /* 00001100 */
00579         0x18,                   /* 00011000 */
00580         0x30,                   /* 00110000 */
00581         0x60,                   /* 01100000 */
00582         0xc0,                   /* 11000000 */
00583         0x80,                   /* 10000000 */
00584         0x00,                   /* 00000000 */
00585 
00586         /*
00587         * 48 0x30 '0' 
00588         */
00589         0x38,                   /* 00111000 */
00590         0x6c,                   /* 01101100 */
00591         0xc6,                   /* 11000110 */
00592         0xd6,                   /* 11010110 */
00593         0xc6,                   /* 11000110 */
00594         0x6c,                   /* 01101100 */
00595         0x38,                   /* 00111000 */
00596         0x00,                   /* 00000000 */
00597 
00598         /*
00599         * 49 0x31 '1' 
00600         */
00601         0x18,                   /* 00011000 */
00602         0x38,                   /* 00111000 */
00603         0x18,                   /* 00011000 */
00604         0x18,                   /* 00011000 */
00605         0x18,                   /* 00011000 */
00606         0x18,                   /* 00011000 */
00607         0x7e,                   /* 01111110 */
00608         0x00,                   /* 00000000 */
00609 
00610         /*
00611         * 50 0x32 '2' 
00612         */
00613         0x7c,                   /* 01111100 */
00614         0xc6,                   /* 11000110 */
00615         0x06,                   /* 00000110 */
00616         0x1c,                   /* 00011100 */
00617         0x30,                   /* 00110000 */
00618         0x66,                   /* 01100110 */
00619         0xfe,                   /* 11111110 */
00620         0x00,                   /* 00000000 */
00621 
00622         /*
00623         * 51 0x33 '3' 
00624         */
00625         0x7c,                   /* 01111100 */
00626         0xc6,                   /* 11000110 */
00627         0x06,                   /* 00000110 */
00628         0x3c,                   /* 00111100 */
00629         0x06,                   /* 00000110 */
00630         0xc6,                   /* 11000110 */
00631         0x7c,                   /* 01111100 */
00632         0x00,                   /* 00000000 */
00633 
00634         /*
00635         * 52 0x34 '4' 
00636         */
00637         0x1c,                   /* 00011100 */
00638         0x3c,                   /* 00111100 */
00639         0x6c,                   /* 01101100 */
00640         0xcc,                   /* 11001100 */
00641         0xfe,                   /* 11111110 */
00642         0x0c,                   /* 00001100 */
00643         0x1e,                   /* 00011110 */
00644         0x00,                   /* 00000000 */
00645 
00646         /*
00647         * 53 0x35 '5' 
00648         */
00649         0xfe,                   /* 11111110 */
00650         0xc0,                   /* 11000000 */
00651         0xc0,                   /* 11000000 */
00652         0xfc,                   /* 11111100 */
00653         0x06,                   /* 00000110 */
00654         0xc6,                   /* 11000110 */
00655         0x7c,                   /* 01111100 */
00656         0x00,                   /* 00000000 */
00657 
00658         /*
00659         * 54 0x36 '6' 
00660         */
00661         0x38,                   /* 00111000 */
00662         0x60,                   /* 01100000 */
00663         0xc0,                   /* 11000000 */
00664         0xfc,                   /* 11111100 */
00665         0xc6,                   /* 11000110 */
00666         0xc6,                   /* 11000110 */
00667         0x7c,                   /* 01111100 */
00668         0x00,                   /* 00000000 */
00669 
00670         /*
00671         * 55 0x37 '7' 
00672         */
00673         0xfe,                   /* 11111110 */
00674         0xc6,                   /* 11000110 */
00675         0x0c,                   /* 00001100 */
00676         0x18,                   /* 00011000 */
00677         0x30,                   /* 00110000 */
00678         0x30,                   /* 00110000 */
00679         0x30,                   /* 00110000 */
00680         0x00,                   /* 00000000 */
00681 
00682         /*
00683         * 56 0x38 '8' 
00684         */
00685         0x7c,                   /* 01111100 */
00686         0xc6,                   /* 11000110 */
00687         0xc6,                   /* 11000110 */
00688         0x7c,                   /* 01111100 */
00689         0xc6,                   /* 11000110 */
00690         0xc6,                   /* 11000110 */
00691         0x7c,                   /* 01111100 */
00692         0x00,                   /* 00000000 */
00693 
00694         /*
00695         * 57 0x39 '9' 
00696         */
00697         0x7c,                   /* 01111100 */
00698         0xc6,                   /* 11000110 */
00699         0xc6,                   /* 11000110 */
00700         0x7e,                   /* 01111110 */
00701         0x06,                   /* 00000110 */
00702         0x0c,                   /* 00001100 */
00703         0x78,                   /* 01111000 */
00704         0x00,                   /* 00000000 */
00705 
00706         /*
00707         * 58 0x3a ':' 
00708         */
00709         0x00,                   /* 00000000 */
00710         0x18,                   /* 00011000 */
00711         0x18,                   /* 00011000 */
00712         0x00,                   /* 00000000 */
00713         0x00,                   /* 00000000 */
00714         0x18,                   /* 00011000 */
00715         0x18,                   /* 00011000 */
00716         0x00,                   /* 00000000 */
00717 
00718         /*
00719         * 59 0x3b ';' 
00720         */
00721         0x00,                   /* 00000000 */
00722         0x18,                   /* 00011000 */
00723         0x18,                   /* 00011000 */
00724         0x00,                   /* 00000000 */
00725         0x00,                   /* 00000000 */
00726         0x18,                   /* 00011000 */
00727         0x18,                   /* 00011000 */
00728         0x30,                   /* 00110000 */
00729 
00730         /*
00731         * 60 0x3c '<' 
00732         */
00733         0x06,                   /* 00000110 */
00734         0x0c,                   /* 00001100 */
00735         0x18,                   /* 00011000 */
00736         0x30,                   /* 00110000 */
00737         0x18,                   /* 00011000 */
00738         0x0c,                   /* 00001100 */
00739         0x06,                   /* 00000110 */
00740         0x00,                   /* 00000000 */
00741 
00742         /*
00743         * 61 0x3d '=' 
00744         */
00745         0x00,                   /* 00000000 */
00746         0x00,                   /* 00000000 */
00747         0x7e,                   /* 01111110 */
00748         0x00,                   /* 00000000 */
00749         0x00,                   /* 00000000 */
00750         0x7e,                   /* 01111110 */
00751         0x00,                   /* 00000000 */
00752         0x00,                   /* 00000000 */
00753 
00754         /*
00755         * 62 0x3e '>' 
00756         */
00757         0x60,                   /* 01100000 */
00758         0x30,                   /* 00110000 */
00759         0x18,                   /* 00011000 */
00760         0x0c,                   /* 00001100 */
00761         0x18,                   /* 00011000 */
00762         0x30,                   /* 00110000 */
00763         0x60,                   /* 01100000 */
00764         0x00,                   /* 00000000 */
00765 
00766         /*
00767         * 63 0x3f '?' 
00768         */
00769         0x7c,                   /* 01111100 */
00770         0xc6,                   /* 11000110 */
00771         0x0c,                   /* 00001100 */
00772         0x18,                   /* 00011000 */
00773         0x18,                   /* 00011000 */
00774         0x00,                   /* 00000000 */
00775         0x18,                   /* 00011000 */
00776         0x00,                   /* 00000000 */
00777 
00778         /*
00779         * 64 0x40 '@' 
00780         */
00781         0x7c,                   /* 01111100 */
00782         0xc6,                   /* 11000110 */
00783         0xde,                   /* 11011110 */
00784         0xde,                   /* 11011110 */
00785         0xde,                   /* 11011110 */
00786         0xc0,                   /* 11000000 */
00787         0x78,                   /* 01111000 */
00788         0x00,                   /* 00000000 */
00789 
00790         /*
00791         * 65 0x41 'A' 
00792         */
00793         0x38,                   /* 00111000 */
00794         0x6c,                   /* 01101100 */
00795         0xc6,                   /* 11000110 */
00796         0xfe,                   /* 11111110 */
00797         0xc6,                   /* 11000110 */
00798         0xc6,                   /* 11000110 */
00799         0xc6,                   /* 11000110 */
00800         0x00,                   /* 00000000 */
00801 
00802         /*
00803         * 66 0x42 'B' 
00804         */
00805         0xfc,                   /* 11111100 */
00806         0x66,                   /* 01100110 */
00807         0x66,                   /* 01100110 */
00808         0x7c,                   /* 01111100 */
00809         0x66,                   /* 01100110 */
00810         0x66,                   /* 01100110 */
00811         0xfc,                   /* 11111100 */
00812         0x00,                   /* 00000000 */
00813 
00814         /*
00815         * 67 0x43 'C' 
00816         */
00817         0x3c,                   /* 00111100 */
00818         0x66,                   /* 01100110 */
00819         0xc0,                   /* 11000000 */
00820         0xc0,                   /* 11000000 */
00821         0xc0,                   /* 11000000 */
00822         0x66,                   /* 01100110 */
00823         0x3c,                   /* 00111100 */
00824         0x00,                   /* 00000000 */
00825 
00826         /*
00827         * 68 0x44 'D' 
00828         */
00829         0xf8,                   /* 11111000 */
00830         0x6c,                   /* 01101100 */
00831         0x66,                   /* 01100110 */
00832         0x66,                   /* 01100110 */
00833         0x66,                   /* 01100110 */
00834         0x6c,                   /* 01101100 */
00835         0xf8,                   /* 11111000 */
00836         0x00,                   /* 00000000 */
00837 
00838         /*
00839         * 69 0x45 'E' 
00840         */
00841         0xfe,                   /* 11111110 */
00842         0x62,                   /* 01100010 */
00843         0x68,                   /* 01101000 */
00844         0x78,                   /* 01111000 */
00845         0x68,                   /* 01101000 */
00846         0x62,                   /* 01100010 */
00847         0xfe,                   /* 11111110 */
00848         0x00,                   /* 00000000 */
00849 
00850         /*
00851         * 70 0x46 'F' 
00852         */
00853         0xfe,                   /* 11111110 */
00854         0x62,                   /* 01100010 */
00855         0x68,                   /* 01101000 */
00856         0x78,                   /* 01111000 */
00857         0x68,                   /* 01101000 */
00858         0x60,                   /* 01100000 */
00859         0xf0,                   /* 11110000 */
00860         0x00,                   /* 00000000 */
00861 
00862         /*
00863         * 71 0x47 'G' 
00864         */
00865         0x3c,                   /* 00111100 */
00866         0x66,                   /* 01100110 */
00867         0xc0,                   /* 11000000 */
00868         0xc0,                   /* 11000000 */
00869         0xce,                   /* 11001110 */
00870         0x66,                   /* 01100110 */
00871         0x3a,                   /* 00111010 */
00872         0x00,                   /* 00000000 */
00873 
00874         /*
00875         * 72 0x48 'H' 
00876         */
00877         0xc6,                   /* 11000110 */
00878         0xc6,                   /* 11000110 */
00879         0xc6,                   /* 11000110 */
00880         0xfe,                   /* 11111110 */
00881         0xc6,                   /* 11000110 */
00882         0xc6,                   /* 11000110 */
00883         0xc6,                   /* 11000110 */
00884         0x00,                   /* 00000000 */
00885 
00886         /*
00887         * 73 0x49 'I' 
00888         */
00889         0x3c,                   /* 00111100 */
00890         0x18,                   /* 00011000 */
00891         0x18,                   /* 00011000 */
00892         0x18,                   /* 00011000 */
00893         0x18,                   /* 00011000 */
00894         0x18,                   /* 00011000 */
00895         0x3c,                   /* 00111100 */
00896         0x00,                   /* 00000000 */
00897 
00898         /*
00899         * 74 0x4a 'J' 
00900         */
00901         0x1e,                   /* 00011110 */
00902         0x0c,                   /* 00001100 */
00903         0x0c,                   /* 00001100 */
00904         0x0c,                   /* 00001100 */
00905         0xcc,                   /* 11001100 */
00906         0xcc,                   /* 11001100 */
00907         0x78,                   /* 01111000 */
00908         0x00,                   /* 00000000 */
00909 
00910         /*
00911         * 75 0x4b 'K' 
00912         */
00913         0xe6,                   /* 11100110 */
00914         0x66,                   /* 01100110 */
00915         0x6c,                   /* 01101100 */
00916         0x78,                   /* 01111000 */
00917         0x6c,                   /* 01101100 */
00918         0x66,                   /* 01100110 */
00919         0xe6,                   /* 11100110 */
00920         0x00,                   /* 00000000 */
00921 
00922         /*
00923         * 76 0x4c 'L' 
00924         */
00925         0xf0,                   /* 11110000 */
00926         0x60,                   /* 01100000 */
00927         0x60,                   /* 01100000 */
00928         0x60,                   /* 01100000 */
00929         0x62,                   /* 01100010 */
00930         0x66,                   /* 01100110 */
00931         0xfe,                   /* 11111110 */
00932         0x00,                   /* 00000000 */
00933 
00934         /*
00935         * 77 0x4d 'M' 
00936         */
00937         0xc6,                   /* 11000110 */
00938         0xee,                   /* 11101110 */
00939         0xfe,                   /* 11111110 */
00940         0xfe,                   /* 11111110 */
00941         0xd6,                   /* 11010110 */
00942         0xc6,                   /* 11000110 */
00943         0xc6,                   /* 11000110 */
00944         0x00,                   /* 00000000 */
00945 
00946         /*
00947         * 78 0x4e 'N' 
00948         */
00949         0xc6,                   /* 11000110 */
00950         0xe6,                   /* 11100110 */
00951         0xf6,                   /* 11110110 */
00952         0xde,                   /* 11011110 */
00953         0xce,                   /* 11001110 */
00954         0xc6,                   /* 11000110 */
00955         0xc6,                   /* 11000110 */
00956         0x00,                   /* 00000000 */
00957 
00958         /*
00959         * 79 0x4f 'O' 
00960         */
00961         0x7c,                   /* 01111100 */
00962         0xc6,                   /* 11000110 */
00963         0xc6,                   /* 11000110 */
00964         0xc6,                   /* 11000110 */
00965         0xc6,                   /* 11000110 */
00966         0xc6,                   /* 11000110 */
00967         0x7c,                   /* 01111100 */
00968         0x00,                   /* 00000000 */
00969 
00970         /*
00971         * 80 0x50 'P' 
00972         */
00973         0xfc,                   /* 11111100 */
00974         0x66,                   /* 01100110 */
00975         0x66,                   /* 01100110 */
00976         0x7c,                   /* 01111100 */
00977         0x60,                   /* 01100000 */
00978         0x60,                   /* 01100000 */
00979         0xf0,                   /* 11110000 */
00980         0x00,                   /* 00000000 */
00981 
00982         /*
00983         * 81 0x51 'Q' 
00984         */
00985         0x7c,                   /* 01111100 */
00986         0xc6,                   /* 11000110 */
00987         0xc6,                   /* 11000110 */
00988         0xc6,                   /* 11000110 */
00989         0xc6,                   /* 11000110 */
00990         0xce,                   /* 11001110 */
00991         0x7c,                   /* 01111100 */
00992         0x0e,                   /* 00001110 */
00993 
00994         /*
00995         * 82 0x52 'R' 
00996         */
00997         0xfc,                   /* 11111100 */
00998         0x66,                   /* 01100110 */
00999         0x66,                   /* 01100110 */
01000         0x7c,                   /* 01111100 */
01001         0x6c,                   /* 01101100 */
01002         0x66,                   /* 01100110 */
01003         0xe6,                   /* 11100110 */
01004         0x00,                   /* 00000000 */
01005 
01006         /*
01007         * 83 0x53 'S' 
01008         */
01009         0x3c,                   /* 00111100 */
01010         0x66,                   /* 01100110 */
01011         0x30,                   /* 00110000 */
01012         0x18,                   /* 00011000 */
01013         0x0c,                   /* 00001100 */
01014         0x66,                   /* 01100110 */
01015         0x3c,                   /* 00111100 */
01016         0x00,                   /* 00000000 */
01017 
01018         /*
01019         * 84 0x54 'T' 
01020         */
01021         0x7e,                   /* 01111110 */
01022         0x7e,                   /* 01111110 */
01023         0x5a,                   /* 01011010 */
01024         0x18,                   /* 00011000 */
01025         0x18,                   /* 00011000 */
01026         0x18,                   /* 00011000 */
01027         0x3c,                   /* 00111100 */
01028         0x00,                   /* 00000000 */
01029 
01030         /*
01031         * 85 0x55 'U' 
01032         */
01033         0xc6,                   /* 11000110 */
01034         0xc6,                   /* 11000110 */
01035         0xc6,                   /* 11000110 */
01036         0xc6,                   /* 11000110 */
01037         0xc6,                   /* 11000110 */
01038         0xc6,                   /* 11000110 */
01039         0x7c,                   /* 01111100 */
01040         0x00,                   /* 00000000 */
01041 
01042         /*
01043         * 86 0x56 'V' 
01044         */
01045         0xc6,                   /* 11000110 */
01046         0xc6,                   /* 11000110 */
01047         0xc6,                   /* 11000110 */
01048         0xc6,                   /* 11000110 */
01049         0xc6,                   /* 11000110 */
01050         0x6c,                   /* 01101100 */
01051         0x38,                   /* 00111000 */
01052         0x00,                   /* 00000000 */
01053 
01054         /*
01055         * 87 0x57 'W' 
01056         */
01057         0xc6,                   /* 11000110 */
01058         0xc6,                   /* 11000110 */
01059         0xc6,                   /* 11000110 */
01060         0xd6,                   /* 11010110 */
01061         0xd6,                   /* 11010110 */
01062         0xfe,                   /* 11111110 */
01063         0x6c,                   /* 01101100 */
01064         0x00,                   /* 00000000 */
01065 
01066         /*
01067         * 88 0x58 'X' 
01068         */
01069         0xc6,                   /* 11000110 */
01070         0xc6,                   /* 11000110 */
01071         0x6c,                   /* 01101100 */
01072         0x38,                   /* 00111000 */
01073         0x6c,                   /* 01101100 */
01074         0xc6,                   /* 11000110 */
01075         0xc6,                   /* 11000110 */
01076         0x00,                   /* 00000000 */
01077 
01078         /*
01079         * 89 0x59 'Y' 
01080         */
01081         0x66,                   /* 01100110 */
01082         0x66,                   /* 01100110 */
01083         0x66,                   /* 01100110 */
01084         0x3c,                   /* 00111100 */
01085         0x18,                   /* 00011000 */
01086         0x18,                   /* 00011000 */
01087         0x3c,                   /* 00111100 */
01088         0x00,                   /* 00000000 */
01089 
01090         /*
01091         * 90 0x5a 'Z' 
01092         */
01093         0xfe,                   /* 11111110 */
01094         0xc6,                   /* 11000110 */
01095         0x8c,                   /* 10001100 */
01096         0x18,                   /* 00011000 */
01097         0x32,                   /* 00110010 */
01098         0x66,                   /* 01100110 */
01099         0xfe,                   /* 11111110 */
01100         0x00,                   /* 00000000 */
01101 
01102         /*
01103         * 91 0x5b '[' 
01104         */
01105         0x3c,                   /* 00111100 */
01106         0x30,                   /* 00110000 */
01107         0x30,                   /* 00110000 */
01108         0x30,                   /* 00110000 */
01109         0x30,                   /* 00110000 */
01110         0x30,                   /* 00110000 */
01111         0x3c,                   /* 00111100 */
01112         0x00,                   /* 00000000 */
01113 
01114         /*
01115         * 92 0x5c '\' 
01116         */
01117         0xc0,                   /* 11000000 */
01118         0x60,                   /* 01100000 */
01119         0x30,                   /* 00110000 */
01120         0x18,                   /* 00011000 */
01121         0x0c,                   /* 00001100 */
01122         0x06,                   /* 00000110 */
01123         0x02,                   /* 00000010 */
01124         0x00,                   /* 00000000 */
01125 
01126         /*
01127         * 93 0x5d ']' 
01128         */
01129         0x3c,                   /* 00111100 */
01130         0x0c,                   /* 00001100 */
01131         0x0c,                   /* 00001100 */
01132         0x0c,                   /* 00001100 */
01133         0x0c,                   /* 00001100 */
01134         0x0c,                   /* 00001100 */
01135         0x3c,                   /* 00111100 */
01136         0x00,                   /* 00000000 */
01137 
01138         /*
01139         * 94 0x5e '^' 
01140         */
01141         0x10,                   /* 00010000 */
01142         0x38,                   /* 00111000 */
01143         0x6c,                   /* 01101100 */
01144         0xc6,                   /* 11000110 */
01145         0x00,                   /* 00000000 */
01146         0x00,                   /* 00000000 */
01147         0x00,                   /* 00000000 */
01148         0x00,                   /* 00000000 */
01149 
01150         /*
01151         * 95 0x5f '_' 
01152         */
01153         0x00,                   /* 00000000 */
01154         0x00,                   /* 00000000 */
01155         0x00,                   /* 00000000 */
01156         0x00,                   /* 00000000 */
01157         0x00,                   /* 00000000 */
01158         0x00,                   /* 00000000 */
01159         0x00,                   /* 00000000 */
01160         0xff,                   /* 11111111 */
01161 
01162         /*
01163         * 96 0x60 '`' 
01164         */
01165         0x30,                   /* 00110000 */
01166         0x18,                   /* 00011000 */
01167         0x0c,                   /* 00001100 */
01168         0x00,                   /* 00000000 */
01169         0x00,                   /* 00000000 */
01170         0x00,                   /* 00000000 */
01171         0x00,                   /* 00000000 */
01172         0x00,                   /* 00000000 */
01173 
01174         /*
01175         * 97 0x61 'a' 
01176         */
01177         0x00,                   /* 00000000 */
01178         0x00,                   /* 00000000 */
01179         0x78,                   /* 01111000 */
01180         0x0c,                   /* 00001100 */
01181         0x7c,                   /* 01111100 */
01182         0xcc,                   /* 11001100 */
01183         0x76,                   /* 01110110 */
01184         0x00,                   /* 00000000 */
01185 
01186         /*
01187         * 98 0x62 'b' 
01188         */
01189         0xe0,                   /* 11100000 */
01190         0x60,                   /* 01100000 */
01191         0x7c,                   /* 01111100 */
01192         0x66,                   /* 01100110 */
01193         0x66,                   /* 01100110 */
01194         0x66,                   /* 01100110 */
01195         0xdc,                   /* 11011100 */
01196         0x00,                   /* 00000000 */
01197 
01198         /*
01199         * 99 0x63 'c' 
01200         */
01201         0x00,                   /* 00000000 */
01202         0x00,                   /* 00000000 */
01203         0x7c,                   /* 01111100 */
01204         0xc6,                   /* 11000110 */
01205         0xc0,                   /* 11000000 */
01206         0xc6,                   /* 11000110 */
01207         0x7c,                   /* 01111100 */
01208         0x00,                   /* 00000000 */
01209 
01210         /*
01211         * 100 0x64 'd' 
01212         */
01213         0x1c,                   /* 00011100 */
01214         0x0c,                   /* 00001100 */
01215         0x7c,                   /* 01111100 */
01216         0xcc,                   /* 11001100 */
01217         0xcc,                   /* 11001100 */
01218         0xcc,                   /* 11001100 */
01219         0x76,                   /* 01110110 */
01220         0x00,                   /* 00000000 */
01221 
01222         /*
01223         * 101 0x65 'e' 
01224         */
01225         0x00,                   /* 00000000 */
01226         0x00,                   /* 00000000 */
01227         0x7c,                   /* 01111100 */
01228         0xc6,                   /* 11000110 */
01229         0xfe,                   /* 11111110 */
01230         0xc0,                   /* 11000000 */
01231         0x7c,                   /* 01111100 */
01232         0x00,                   /* 00000000 */
01233 
01234         /*
01235         * 102 0x66 'f' 
01236         */
01237         0x3c,                   /* 00111100 */
01238         0x66,                   /* 01100110 */
01239         0x60,                   /* 01100000 */
01240         0xf8,                   /* 11111000 */
01241         0x60,                   /* 01100000 */
01242         0x60,                   /* 01100000 */
01243         0xf0,                   /* 11110000 */
01244         0x00,                   /* 00000000 */
01245 
01246         /*
01247         * 103 0x67 'g' 
01248         */
01249         0x00,                   /* 00000000 */
01250         0x00,                   /* 00000000 */
01251         0x76,                   /* 01110110 */
01252         0xcc,                   /* 11001100 */
01253         0xcc,                   /* 11001100 */
01254         0x7c,                   /* 01111100 */
01255         0x0c,                   /* 00001100 */
01256         0xf8,                   /* 11111000 */
01257 
01258         /*
01259         * 104 0x68 'h' 
01260         */
01261         0xe0,                   /* 11100000 */
01262         0x60,                   /* 01100000 */
01263         0x6c,                   /* 01101100 */
01264         0x76,                   /* 01110110 */
01265         0x66,                   /* 01100110 */
01266         0x66,                   /* 01100110 */
01267         0xe6,                   /* 11100110 */
01268         0x00,                   /* 00000000 */
01269 
01270         /*
01271         * 105 0x69 'i' 
01272         */
01273         0x18,                   /* 00011000 */
01274         0x00,                   /* 00000000 */
01275         0x38,                   /* 00111000 */
01276         0x18,                   /* 00011000 */
01277         0x18,                   /* 00011000 */
01278         0x18,                   /* 00011000 */
01279         0x3c,                   /* 00111100 */
01280         0x00,                   /* 00000000 */
01281 
01282         /*
01283         * 106 0x6a 'j' 
01284         */
01285         0x06,                   /* 00000110 */
01286         0x00,                   /* 00000000 */
01287         0x06,                   /* 00000110 */
01288         0x06,                   /* 00000110 */
01289         0x06,                   /* 00000110 */
01290         0x66,                   /* 01100110 */
01291         0x66,                   /* 01100110 */
01292         0x3c,                   /* 00111100 */
01293 
01294         /*
01295         * 107 0x6b 'k' 
01296         */
01297         0xe0,                   /* 11100000 */
01298         0x60,                   /* 01100000 */
01299         0x66,                   /* 01100110 */
01300         0x6c,                   /* 01101100 */
01301         0x78,                   /* 01111000 */
01302         0x6c,                   /* 01101100 */
01303         0xe6,                   /* 11100110 */
01304         0x00,                   /* 00000000 */
01305 
01306         /*
01307         * 108 0x6c 'l' 
01308         */
01309         0x38,                   /* 00111000 */
01310         0x18,                   /* 00011000 */
01311         0x18,                   /* 00011000 */
01312         0x18,                   /* 00011000 */
01313         0x18,                   /* 00011000 */
01314         0x18,                   /* 00011000 */
01315         0x3c,                   /* 00111100 */
01316         0x00,                   /* 00000000 */
01317 
01318         /*
01319         * 109 0x6d 'm' 
01320         */
01321         0x00,                   /* 00000000 */
01322         0x00,                   /* 00000000 */
01323         0xec,                   /* 11101100 */
01324         0xfe,                   /* 11111110 */
01325         0xd6,                   /* 11010110 */
01326         0xd6,                   /* 11010110 */
01327         0xd6,                   /* 11010110 */
01328         0x00,                   /* 00000000 */
01329 
01330         /*
01331         * 110 0x6e 'n' 
01332         */
01333         0x00,                   /* 00000000 */
01334         0x00,                   /* 00000000 */
01335         0xdc,                   /* 11011100 */
01336         0x66,                   /* 01100110 */
01337         0x66,                   /* 01100110 */
01338         0x66,                   /* 01100110 */
01339         0x66,                   /* 01100110 */
01340         0x00,                   /* 00000000 */
01341 
01342         /*
01343         * 111 0x6f 'o' 
01344         */
01345         0x00,                   /* 00000000 */
01346         0x00,                   /* 00000000 */
01347         0x7c,                   /* 01111100 */
01348         0xc6,                   /* 11000110 */
01349         0xc6,                   /* 11000110 */
01350         0xc6,                   /* 11000110 */
01351         0x7c,                   /* 01111100 */
01352         0x00,                   /* 00000000 */
01353 
01354         /*
01355         * 112 0x70 'p' 
01356         */
01357         0x00,                   /* 00000000 */
01358         0x00,                   /* 00000000 */
01359         0xdc,                   /* 11011100 */
01360         0x66,                   /* 01100110 */
01361         0x66,                   /* 01100110 */
01362         0x7c,                   /* 01111100 */
01363         0x60,                   /* 01100000 */
01364         0xf0,                   /* 11110000 */
01365 
01366         /*
01367         * 113 0x71 'q' 
01368         */
01369         0x00,                   /* 00000000 */
01370         0x00,                   /* 00000000 */
01371         0x76,                   /* 01110110 */
01372         0xcc,                   /* 11001100 */
01373         0xcc,                   /* 11001100 */
01374         0x7c,                   /* 01111100 */
01375         0x0c,                   /* 00001100 */
01376         0x1e,                   /* 00011110 */
01377 
01378         /*
01379         * 114 0x72 'r' 
01380         */
01381         0x00,                   /* 00000000 */
01382         0x00,                   /* 00000000 */
01383         0xdc,                   /* 11011100 */
01384         0x76,                   /* 01110110 */
01385         0x60,                   /* 01100000 */
01386         0x60,                   /* 01100000 */
01387         0xf0,                   /* 11110000 */
01388         0x00,                   /* 00000000 */
01389 
01390         /*
01391         * 115 0x73 's' 
01392         */
01393         0x00,                   /* 00000000 */
01394         0x00,                   /* 00000000 */
01395         0x7e,                   /* 01111110 */
01396         0xc0,                   /* 11000000 */
01397         0x7c,                   /* 01111100 */
01398         0x06,                   /* 00000110 */
01399         0xfc,                   /* 11111100 */
01400         0x00,                   /* 00000000 */
01401 
01402         /*
01403         * 116 0x74 't' 
01404         */
01405         0x30,                   /* 00110000 */
01406         0x30,                   /* 00110000 */
01407         0xfc,                   /* 11111100 */
01408         0x30,                   /* 00110000 */
01409         0x30,                   /* 00110000 */
01410         0x36,                   /* 00110110 */
01411         0x1c,                   /* 00011100 */
01412         0x00,                   /* 00000000 */
01413 
01414         /*
01415         * 117 0x75 'u' 
01416         */
01417         0x00,                   /* 00000000 */
01418         0x00,                   /* 00000000 */
01419         0xcc,                   /* 11001100 */
01420         0xcc,                   /* 11001100 */
01421         0xcc,                   /* 11001100 */
01422         0xcc,                   /* 11001100 */
01423         0x76,                   /* 01110110 */
01424         0x00,                   /* 00000000 */
01425 
01426         /*
01427         * 118 0x76 'v' 
01428         */
01429         0x00,                   /* 00000000 */
01430         0x00,                   /* 00000000 */
01431         0xc6,                   /* 11000110 */
01432         0xc6,                   /* 11000110 */
01433         0xc6,                   /* 11000110 */
01434         0x6c,                   /* 01101100 */
01435         0x38,                   /* 00111000 */
01436         0x00,                   /* 00000000 */
01437 
01438         /*
01439         * 119 0x77 'w' 
01440         */
01441         0x00,                   /* 00000000 */
01442         0x00,                   /* 00000000 */
01443         0xc6,                   /* 11000110 */
01444         0xd6,                   /* 11010110 */
01445         0xd6,                   /* 11010110 */
01446         0xfe,                   /* 11111110 */
01447         0x6c,                   /* 01101100 */
01448         0x00,                   /* 00000000 */
01449 
01450         /*
01451         * 120 0x78 'x' 
01452         */
01453         0x00,                   /* 00000000 */
01454         0x00,                   /* 00000000 */
01455         0xc6,                   /* 11000110 */
01456         0x6c,                   /* 01101100 */
01457         0x38,                   /* 00111000 */
01458         0x6c,                   /* 01101100 */
01459         0xc6,                   /* 11000110 */
01460         0x00,                   /* 00000000 */
01461 
01462         /*
01463         * 121 0x79 'y' 
01464         */
01465         0x00,                   /* 00000000 */
01466         0x00,                   /* 00000000 */
01467         0xc6,                   /* 11000110 */
01468         0xc6,                   /* 11000110 */
01469         0xc6,                   /* 11000110 */
01470         0x7e,                   /* 01111110 */
01471         0x06,                   /* 00000110 */
01472         0xfc,                   /* 11111100 */
01473 
01474         /*
01475         * 122 0x7a 'z' 
01476         */
01477         0x00,                   /* 00000000 */
01478         0x00,                   /* 00000000 */
01479         0x7e,                   /* 01111110 */
01480         0x4c,                   /* 01001100 */
01481         0x18,                   /* 00011000 */
01482         0x32,                   /* 00110010 */
01483         0x7e,                   /* 01111110 */
01484         0x00,                   /* 00000000 */
01485 
01486         /*
01487         * 123 0x7b '{' 
01488         */
01489         0x0e,                   /* 00001110 */
01490         0x18,                   /* 00011000 */
01491         0x18,                   /* 00011000 */
01492         0x70,                   /* 01110000 */
01493         0x18,                   /* 00011000 */
01494         0x18,                   /* 00011000 */
01495         0x0e,                   /* 00001110 */
01496         0x00,                   /* 00000000 */
01497 
01498         /*
01499         * 124 0x7c '|' 
01500         */
01501         0x18,                   /* 00011000 */
01502         0x18,                   /* 00011000 */
01503         0x18,                   /* 00011000 */
01504         0x18,                   /* 00011000 */
01505         0x18,                   /* 00011000 */
01506         0x18,                   /* 00011000 */
01507         0x18,                   /* 00011000 */
01508         0x00,                   /* 00000000 */
01509 
01510         /*
01511         * 125 0x7d '}' 
01512         */
01513         0x70,                   /* 01110000 */
01514         0x18,                   /* 00011000 */
01515         0x18,                   /* 00011000 */
01516         0x0e,                   /* 00001110 */
01517         0x18,                   /* 00011000 */
01518         0x18,                   /* 00011000 */
01519         0x70,                   /* 01110000 */
01520         0x00,                   /* 00000000 */
01521 
01522         /*
01523         * 126 0x7e '~' 
01524         */
01525         0x76,                   /* 01110110 */
01526         0xdc,                   /* 11011100 */
01527         0x00,                   /* 00000000 */
01528         0x00,                   /* 00000000 */
01529         0x00,                   /* 00000000 */
01530         0x00,                   /* 00000000 */
01531         0x00,                   /* 00000000 */
01532         0x00,                   /* 00000000 */
01533 
01534         /*
01535         * 127 0x7f '' 
01536         */
01537         0x00,                   /* 00000000 */
01538         0x10,                   /* 00010000 */
01539         0x38,                   /* 00111000 */
01540         0x6c,                   /* 01101100 */
01541         0xc6,                   /* 11000110 */
01542         0xc6,                   /* 11000110 */
01543         0xfe,                   /* 11111110 */
01544         0x00,                   /* 00000000 */
01545 
01546         /*
01547         * 128 0x80 '' 
01548         */
01549         0x7c,                   /* 01111100 */
01550         0xc6,                   /* 11000110 */
01551         0xc0,                   /* 11000000 */
01552         0xc0,                   /* 11000000 */
01553         0xc6,                   /* 11000110 */
01554         0x7c,                   /* 01111100 */
01555         0x0c,                   /* 00001100 */
01556         0x78,                   /* 01111000 */
01557 
01558         /*
01559         * 129 0x81 '' 
01560         */
01561         0xcc,                   /* 11001100 */
01562         0x00,                   /* 00000000 */
01563         0xcc,                   /* 11001100 */
01564         0xcc,                   /* 11001100 */
01565         0xcc,                   /* 11001100 */
01566         0xcc,                   /* 11001100 */
01567         0x76,                   /* 01110110 */
01568         0x00,                   /* 00000000 */
01569 
01570         /*
01571         * 130 0x82 '' 
01572         */
01573         0x0c,                   /* 00001100 */
01574         0x18,                   /* 00011000 */
01575         0x7c,                   /* 01111100 */
01576         0xc6,                   /* 11000110 */
01577         0xfe,                   /* 11111110 */
01578         0xc0,                   /* 11000000 */
01579         0x7c,                   /* 01111100 */
01580         0x00,                   /* 00000000 */
01581 
01582         /*
01583         * 131 0x83 '' 
01584         */
01585         0x7c,                   /* 01111100 */
01586         0x82,                   /* 10000010 */
01587         0x78,                   /* 01111000 */
01588         0x0c,                   /* 00001100 */
01589         0x7c,                   /* 01111100 */
01590         0xcc,                   /* 11001100 */
01591         0x76,                   /* 01110110 */
01592         0x00,                   /* 00000000 */
01593 
01594         /*
01595         * 132 0x84 '' 
01596         */
01597         0xc6,                   /* 11000110 */
01598         0x00,                   /* 00000000 */
01599         0x78,                   /* 01111000 */
01600         0x0c,                   /* 00001100 */
01601         0x7c,                   /* 01111100 */
01602         0xcc,                   /* 11001100 */
01603         0x76,                   /* 01110110 */
01604         0x00,                   /* 00000000 */
01605 
01606         /*
01607         * 133 0x85 '' 
01608         */
01609         0x30,                   /* 00110000 */
01610         0x18,                   /* 00011000 */
01611         0x78,                   /* 01111000 */
01612         0x0c,                   /* 00001100 */
01613         0x7c,                   /* 01111100 */
01614         0xcc,                   /* 11001100 */
01615         0x76,                   /* 01110110 */
01616         0x00,                   /* 00000000 */
01617 
01618         /*
01619         * 134 0x86 '' 
01620         */
01621         0x30,                   /* 00110000 */
01622         0x30,                   /* 00110000 */
01623         0x78,                   /* 01111000 */
01624         0x0c,                   /* 00001100 */
01625         0x7c,                   /* 01111100 */
01626         0xcc,                   /* 11001100 */
01627         0x76,                   /* 01110110 */
01628         0x00,                   /* 00000000 */
01629 
01630         /*
01631         * 135 0x87 '' 
01632         */
01633         0x00,                   /* 00000000 */
01634         0x00,                   /* 00000000 */
01635         0x7e,                   /* 01111110 */
01636         0xc0,                   /* 11000000 */
01637         0xc0,                   /* 11000000 */
01638         0x7e,                   /* 01111110 */
01639         0x0c,                   /* 00001100 */
01640         0x38,                   /* 00111000 */
01641 
01642         /*
01643         * 136 0x88 '' 
01644         */
01645         0x7c,                   /* 01111100 */
01646         0x82,                   /* 10000010 */
01647         0x7c,                   /* 01111100 */
01648         0xc6,                   /* 11000110 */
01649         0xfe,                   /* 11111110 */
01650         0xc0,                   /* 11000000 */
01651         0x7c,                   /* 01111100 */
01652         0x00,                   /* 00000000 */
01653 
01654         /*
01655         * 137 0x89 '' 
01656         */
01657         0xc6,                   /* 11000110 */
01658         0x00,                   /* 00000000 */
01659         0x7c,                   /* 01111100 */
01660         0xc6,                   /* 11000110 */
01661         0xfe,                   /* 11111110 */
01662         0xc0,                   /* 11000000 */
01663         0x7c,                   /* 01111100 */
01664         0x00,                   /* 00000000 */
01665 
01666         /*
01667         * 138 0x8a '' 
01668         */
01669         0x30,                   /* 00110000 */
01670         0x18,                   /* 00011000 */
01671         0x7c,                   /* 01111100 */
01672         0xc6,                   /* 11000110 */
01673         0xfe,                   /* 11111110 */
01674         0xc0,                   /* 11000000 */
01675         0x7c,                   /* 01111100 */
01676         0x00,                   /* 00000000 */
01677 
01678         /*
01679         * 139 0x8b '' 
01680         */
01681         0x66,                   /* 01100110 */
01682         0x00,                   /* 00000000 */
01683         0x38,                   /* 00111000 */
01684         0x18,                   /* 00011000 */
01685         0x18,                   /* 00011000 */
01686         0x18,                   /* 00011000 */
01687         0x3c,                   /* 00111100 */
01688         0x00,                   /* 00000000 */
01689 
01690         /*
01691         * 140 0x8c '' 
01692         */
01693         0x7c,                   /* 01111100 */
01694         0x82,                   /* 10000010 */
01695         0x38,                   /* 00111000 */
01696         0x18,                   /* 00011000 */
01697         0x18,                   /* 00011000 */
01698         0x18,                   /* 00011000 */
01699         0x3c,                   /* 00111100 */
01700         0x00,                   /* 00000000 */
01701 
01702         /*
01703         * 141 0x8d '' 
01704         */
01705         0x30,                   /* 00110000 */
01706         0x18,                   /* 00011000 */
01707         0x00,                   /* 00000000 */
01708         0x38,                   /* 00111000 */
01709         0x18,                   /* 00011000 */
01710         0x18,                   /* 00011000 */
01711         0x3c,                   /* 00111100 */
01712         0x00,                   /* 00000000 */
01713 
01714         /*
01715         * 142 0x8e '' 
01716         */
01717         0xc6,                   /* 11000110 */
01718         0x38,                   /* 00111000 */
01719         0x6c,                   /* 01101100 */
01720         0xc6,                   /* 11000110 */
01721         0xfe,                   /* 11111110 */
01722         0xc6,                   /* 11000110 */
01723         0xc6,                   /* 11000110 */
01724         0x00,                   /* 00000000 */
01725 
01726         /*
01727         * 143 0x8f '' 
01728         */
01729         0x38,                   /* 00111000 */
01730         0x6c,                   /* 01101100 */
01731         0x7c,                   /* 01111100 */
01732         0xc6,                   /* 11000110 */
01733         0xfe,                   /* 11111110 */
01734         0xc6,                   /* 11000110 */
01735         0xc6,                   /* 11000110 */
01736         0x00,                   /* 00000000 */
01737 
01738         /*
01739         * 144 0x90 '' 
01740         */
01741         0x18,                   /* 00011000 */
01742         0x30,                   /* 00110000 */
01743         0xfe,                   /* 11111110 */
01744         0xc0,                   /* 11000000 */
01745         0xf8,                   /* 11111000 */
01746         0xc0,                   /* 11000000 */
01747         0xfe,                   /* 11111110 */
01748         0x00,                   /* 00000000 */
01749 
01750         /*
01751         * 145 0x91 '' 
01752         */
01753         0x00,                   /* 00000000 */
01754         0x00,                   /* 00000000 */
01755         0x7e,                   /* 01111110 */
01756         0x18,                   /* 00011000 */
01757         0x7e,                   /* 01111110 */
01758         0xd8,                   /* 11011000 */
01759         0x7e,                   /* 01111110 */
01760         0x00,                   /* 00000000 */
01761 
01762         /*
01763         * 146 0x92 '' 
01764         */
01765         0x3e,                   /* 00111110 */
01766         0x6c,                   /* 01101100 */
01767         0xcc,                   /* 11001100 */
01768         0xfe,                   /* 11111110 */
01769         0xcc,                   /* 11001100 */
01770         0xcc,                   /* 11001100 */
01771         0xce,                   /* 11001110 */
01772         0x00,                   /* 00000000 */
01773 
01774         /*
01775         * 147 0x93 '' 
01776         */
01777         0x7c,                   /* 01111100 */
01778         0x82,                   /* 10000010 */
01779         0x7c,                   /* 01111100 */
01780         0xc6,                   /* 11000110 */
01781         0xc6,                   /* 11000110 */
01782         0xc6,                   /* 11000110 */
01783         0x7c,                   /* 01111100 */
01784         0x00,                   /* 00000000 */
01785 
01786         /*
01787         * 148 0x94 '' 
01788         */
01789         0xc6,                   /* 11000110 */
01790         0x00,                   /* 00000000 */
01791         0x7c,                   /* 01111100 */
01792         0xc6,                   /* 11000110 */
01793         0xc6,                   /* 11000110 */
01794         0xc6,                   /* 11000110 */
01795         0x7c,                   /* 01111100 */
01796         0x00,                   /* 00000000 */
01797 
01798         /*
01799         * 149 0x95 '' 
01800         */
01801         0x30,                   /* 00110000 */
01802         0x18,                   /* 00011000 */
01803         0x7c,                   /* 01111100 */
01804         0xc6,                   /* 11000110 */
01805         0xc6,                   /* 11000110 */
01806         0xc6,                   /* 11000110 */
01807         0x7c,                   /* 01111100 */
01808         0x00,                   /* 00000000 */
01809 
01810         /*
01811         * 150 0x96 '' 
01812         */
01813         0x78,                   /* 01111000 */
01814         0x84,                   /* 10000100 */
01815         0x00,                   /* 00000000 */
01816         0xcc,                   /* 11001100 */
01817         0xcc,                   /* 11001100 */
01818         0xcc,                   /* 11001100 */
01819         0x76,                   /* 01110110 */
01820         0x00,                   /* 00000000 */
01821 
01822         /*
01823         * 151 0x97 '' 
01824         */
01825         0x60,                   /* 01100000 */
01826         0x30,                   /* 00110000 */
01827         0xcc,                   /* 11001100 */
01828         0xcc,                   /* 11001100 */
01829         0xcc,                   /* 11001100 */
01830         0xcc,                   /* 11001100 */
01831         0x76,                   /* 01110110 */
01832         0x00,                   /* 00000000 */
01833 
01834         /*
01835         * 152 0x98 '' 
01836         */
01837         0xc6,                   /* 11000110 */
01838         0x00,                   /* 00000000 */
01839         0xc6,                   /* 11000110 */
01840         0xc6,                   /* 11000110 */
01841         0xc6,                   /* 11000110 */
01842         0x7e,                   /* 01111110 */
01843         0x06,                   /* 00000110 */
01844         0xfc,                   /* 11111100 */
01845 
01846         /*
01847         * 153 0x99 '' 
01848         */
01849         0xc6,                   /* 11000110 */
01850         0x38,                   /* 00111000 */
01851         0x6c,                   /* 01101100 */
01852         0xc6,                   /* 11000110 */
01853         0xc6,                   /* 11000110 */
01854         0x6c,                   /* 01101100 */
01855         0x38,                   /* 00111000 */
01856         0x00,                   /* 00000000 */
01857 
01858         /*
01859         * 154 0x9a '' 
01860         */
01861         0xc6,                   /* 11000110 */
01862         0x00,                   /* 00000000 */
01863         0xc6,                   /* 11000110 */
01864         0xc6,                   /* 11000110 */
01865         0xc6,                   /* 11000110 */
01866         0xc6,                   /* 11000110 */
01867         0x7c,                   /* 01111100 */
01868         0x00,                   /* 00000000 */
01869 
01870         /*
01871         * 155 0x9b '' 
01872         */
01873         0x18,                   /* 00011000 */
01874         0x18,                   /* 00011000 */
01875         0x7e,                   /* 01111110 */
01876         0xc0,                   /* 11000000 */
01877         0xc0,                   /* 11000000 */
01878         0x7e,                   /* 01111110 */
01879         0x18,                   /* 00011000 */
01880         0x18,                   /* 00011000 */
01881 
01882         /*
01883         * 156 0x9c '' 
01884         */
01885         0x38,                   /* 00111000 */
01886         0x6c,                   /* 01101100 */
01887         0x64,                   /* 01100100 */
01888         0xf0,                   /* 11110000 */
01889         0x60,                   /* 01100000 */
01890         0x66,                   /* 01100110 */
01891         0xfc,                   /* 11111100 */
01892         0x00,                   /* 00000000 */
01893 
01894         /*
01895         * 157 0x9d '' 
01896         */
01897         0x66,                   /* 01100110 */
01898         0x66,                   /* 01100110 */
01899         0x3c,                   /* 00111100 */
01900         0x7e,                   /* 01111110 */
01901         0x18,                   /* 00011000 */
01902         0x7e,                   /* 01111110 */
01903         0x18,                   /* 00011000 */
01904         0x18,                   /* 00011000 */
01905 
01906         /*
01907         * 158 0x9e '' 
01908         */
01909         0xf8,                   /* 11111000 */
01910         0xcc,                   /* 11001100 */
01911         0xcc,                   /* 11001100 */
01912         0xfa,                   /* 11111010 */
01913         0xc6,                   /* 11000110 */
01914         0xcf,                   /* 11001111 */
01915         0xc6,                   /* 11000110 */
01916         0xc7,                   /* 11000111 */
01917 
01918         /*
01919         * 159 0x9f '' 
01920         */
01921         0x0e,                   /* 00001110 */
01922         0x1b,                   /* 00011011 */
01923         0x18,                   /* 00011000 */
01924         0x3c,                   /* 00111100 */
01925         0x18,                   /* 00011000 */
01926         0xd8,                   /* 11011000 */
01927         0x70,                   /* 01110000 */
01928         0x00,                   /* 00000000 */
01929 
01930         /*
01931         * 160 0xa0 '' 
01932         */
01933         0x18,                   /* 00011000 */
01934         0x30,                   /* 00110000 */
01935         0x78,                   /* 01111000 */
01936         0x0c,                   /* 00001100 */
01937         0x7c,                   /* 01111100 */
01938         0xcc,                   /* 11001100 */
01939         0x76,                   /* 01110110 */
01940         0x00,                   /* 00000000 */
01941 
01942         /*
01943         * 161 0xa1 '' 
01944         */
01945         0x0c,                   /* 00001100 */
01946         0x18,                   /* 00011000 */
01947         0x00,                   /* 00000000 */
01948         0x38,                   /* 00111000 */
01949         0x18,                   /* 00011000 */
01950         0x18,                   /* 00011000 */
01951         0x3c,                   /* 00111100 */
01952         0x00,                   /* 00000000 */
01953 
01954         /*
01955         * 162 0xa2 '' 
01956         */
01957         0x0c,                   /* 00001100 */
01958         0x18,                   /* 00011000 */
01959         0x7c,                   /* 01111100 */
01960         0xc6,                   /* 11000110 */
01961         0xc6,                   /* 11000110 */
01962         0xc6,                   /* 11000110 */
01963         0x7c,                   /* 01111100 */
01964         0x00,                   /* 00000000 */
01965 
01966         /*
01967         * 163 0xa3 '' 
01968         */
01969         0x18,                   /* 00011000 */
01970         0x30,                   /* 00110000 */
01971         0xcc,                   /* 11001100 */
01972         0xcc,                   /* 11001100 */
01973         0xcc,                   /* 11001100 */
01974         0xcc,                   /* 11001100 */
01975         0x76,                   /* 01110110 */
01976         0x00,                   /* 00000000 */
01977 
01978         /*
01979         * 164 0xa4 '' 
01980         */
01981         0x76,                   /* 01110110 */
01982         0xdc,                   /* 11011100 */
01983         0x00,                   /* 00000000 */
01984         0xdc,                   /* 11011100 */
01985         0x66,                   /* 01100110 */
01986         0x66,                   /* 01100110 */
01987         0x66,                   /* 01100110 */
01988         0x00,                   /* 00000000 */
01989 
01990         /*
01991         * 165 0xa5 '' 
01992         */
01993         0x76,                   /* 01110110 */
01994         0xdc,                   /* 11011100 */
01995         0x00,                   /* 00000000 */
01996         0xe6,                   /* 11100110 */
01997         0xf6,                   /* 11110110 */
01998         0xde,                   /* 11011110 */
01999         0xce,                   /* 11001110 */
02000         0x00,                   /* 00000000 */
02001 
02002         /*
02003         * 166 0xa6 '' 
02004         */
02005         0x3c,                   /* 00111100 */
02006         0x6c,                   /* 01101100 */
02007         0x6c,                   /* 01101100 */
02008         0x3e,                   /* 00111110 */
02009         0x00,                   /* 00000000 */
02010         0x7e,                   /* 01111110 */
02011         0x00,                   /* 00000000 */
02012         0x00,                   /* 00000000 */
02013 
02014         /*
02015         * 167 0xa7 '' 
02016         */
02017         0x38,                   /* 00111000 */
02018         0x6c,                   /* 01101100 */
02019         0x6c,                   /* 01101100 */
02020         0x38,                   /* 00111000 */
02021         0x00,                   /* 00000000 */
02022         0x7c,                   /* 01111100 */
02023         0x00,                   /* 00000000 */
02024         0x00,                   /* 00000000 */
02025 
02026         /*
02027         * 168 0xa8 '' 
02028         */
02029         0x18,                   /* 00011000 */
02030         0x00,                   /* 00000000 */
02031         0x18,                   /* 00011000 */
02032         0x18,                   /* 00011000 */
02033         0x30,                   /* 00110000 */
02034         0x63,                   /* 01100011 */
02035         0x3e,                   /* 00111110 */
02036         0x00,                   /* 00000000 */
02037 
02038         /*
02039         * 169 0xa9 '' 
02040         */
02041         0x00,                   /* 00000000 */
02042         0x00,                   /* 00000000 */
02043         0x00,                   /* 00000000 */
02044         0xfe,                   /* 11111110 */
02045         0xc0,                   /* 11000000 */
02046         0xc0,                   /* 11000000 */
02047         0x00,                   /* 00000000 */
02048         0x00,                   /* 00000000 */
02049 
02050         /*
02051         * 170 0xaa '' 
02052         */
02053         0x00,                   /* 00000000 */
02054         0x00,                   /* 00000000 */
02055         0x00,                   /* 00000000 */
02056         0xfe,                   /* 11111110 */
02057         0x06,                   /* 00000110 */
02058         0x06,                   /* 00000110 */
02059         0x00,                   /* 00000000 */
02060         0x00,                   /* 00000000 */
02061 
02062         /*
02063         * 171 0xab '' 
02064         */
02065         0x63,                   /* 01100011 */
02066         0xe6,                   /* 11100110 */
02067         0x6c,                   /* 01101100 */
02068         0x7e,                   /* 01111110 */
02069         0x33,                   /* 00110011 */
02070         0x66,                   /* 01100110 */
02071         0xcc,                   /* 11001100 */
02072         0x0f,                   /* 00001111 */
02073 
02074         /*
02075         * 172 0xac '' 
02076         */
02077         0x63,                   /* 01100011 */
02078         0xe6,                   /* 11100110 */
02079         0x6c,                   /* 01101100 */
02080         0x7a,                   /* 01111010 */
02081         0x36,                   /* 00110110 */
02082         0x6a,                   /* 01101010 */
02083         0xdf,                   /* 11011111 */
02084         0x06,                   /* 00000110 */
02085 
02086         /*
02087         * 173 0xad '' 
02088         */
02089         0x18,                   /* 00011000 */
02090         0x00,                   /* 00000000 */
02091         0x18,                   /* 00011000 */
02092         0x18,                   /* 00011000 */
02093         0x3c,                   /* 00111100 */
02094         0x3c,                   /* 00111100 */
02095         0x18,                   /* 00011000 */
02096         0x00,                   /* 00000000 */
02097 
02098         /*
02099         * 174 0xae '' 
02100         */
02101         0x00,                   /* 00000000 */
02102         0x33,                   /* 00110011 */
02103         0x66,                   /* 01100110 */
02104         0xcc,                   /* 11001100 */
02105         0x66,                   /* 01100110 */
02106         0x33,                   /* 00110011 */
02107         0x00,                   /* 00000000 */
02108         0x00,                   /* 00000000 */
02109 
02110         /*
02111         * 175 0xaf '' 
02112         */
02113         0x00,                   /* 00000000 */
02114         0xcc,                   /* 11001100 */
02115         0x66,                   /* 01100110 */
02116         0x33,                   /* 00110011 */
02117         0x66,                   /* 01100110 */
02118         0xcc,                   /* 11001100 */
02119         0x00,                   /* 00000000 */
02120         0x00,                   /* 00000000 */
02121 
02122         /*
02123         * 176 0xb0 '' 
02124         */
02125         0x22,                   /* 00100010 */
02126         0x88,                   /* 10001000 */
02127         0x22,                   /* 00100010 */
02128         0x88,                   /* 10001000 */
02129         0x22,                   /* 00100010 */
02130         0x88,                   /* 10001000 */
02131         0x22,                   /* 00100010 */
02132         0x88,                   /* 10001000 */
02133 
02134         /*
02135         * 177 0xb1 '' 
02136         */
02137         0x55,                   /* 01010101 */
02138         0xaa,                   /* 10101010 */
02139         0x55,                   /* 01010101 */
02140         0xaa,                   /* 10101010 */
02141         0x55,                   /* 01010101 */
02142         0xaa,                   /* 10101010 */
02143         0x55,                   /* 01010101 */
02144         0xaa,                   /* 10101010 */
02145 
02146         /*
02147         * 178 0xb2 '' 
02148         */
02149         0x77,                   /* 01110111 */
02150         0xdd,                   /* 11011101 */
02151         0x77,                   /* 01110111 */
02152         0xdd,                   /* 11011101 */
02153         0x77,                   /* 01110111 */
02154         0xdd,                   /* 11011101 */
02155         0x77,                   /* 01110111 */
02156         0xdd,                   /* 11011101 */
02157 
02158         /*
02159         * 179 0xb3 '' 
02160         */
02161         0x18,                   /* 00011000 */
02162         0x18,                   /* 00011000 */
02163         0x18,                   /* 00011000 */
02164         0x18,                   /* 00011000 */
02165         0x18,                   /* 00011000 */
02166         0x18,                   /* 00011000 */
02167         0x18,                   /* 00011000 */
02168         0x18,                   /* 00011000 */
02169 
02170         /*
02171         * 180 0xb4 '' 
02172         */
02173         0x18,                   /* 00011000 */
02174         0x18,                   /* 00011000 */
02175         0x18,                   /* 00011000 */
02176         0x18,                   /* 00011000 */
02177         0xf8,                   /* 11111000 */
02178         0x18,                   /* 00011000 */
02179         0x18,                   /* 00011000 */
02180         0x18,                   /* 00011000 */
02181 
02182         /*
02183         * 181 0xb5 '' 
02184         */
02185         0x18,                   /* 00011000 */
02186         0x18,                   /* 00011000 */
02187         0xf8,                   /* 11111000 */
02188         0x18,                   /* 00011000 */
02189         0xf8,                   /* 11111000 */
02190         0x18,                   /* 00011000 */
02191         0x18,                   /* 00011000 */
02192         0x18,                   /* 00011000 */
02193 
02194         /*
02195         * 182 0xb6 '' 
02196         */
02197         0x36,                   /* 00110110 */
02198         0x36,                   /* 00110110 */
02199         0x36,                   /* 00110110 */
02200         0x36,                   /* 00110110 */
02201         0xf6,                   /* 11110110 */
02202         0x36,                   /* 00110110 */
02203         0x36,                   /* 00110110 */
02204         0x36,                   /* 00110110 */
02205 
02206         /*
02207         * 183 0xb7 '' 
02208         */
02209         0x00,                   /* 00000000 */
02210         0x00,                   /* 00000000 */
02211         0x00,                   /* 00000000 */
02212         0x00,                   /* 00000000 */
02213         0xfe,                   /* 11111110 */
02214         0x36,                   /* 00110110 */
02215         0x36,                   /* 00110110 */
02216         0x36,                   /* 00110110 */
02217 
02218         /*
02219         * 184 0xb8 '' 
02220         */
02221         0x00,                   /* 00000000 */
02222         0x00,                   /* 00000000 */
02223         0xf8,                   /* 11111000 */
02224         0x18,                   /* 00011000 */
02225         0xf8,                   /* 11111000 */
02226         0x18,                   /* 00011000 */
02227         0x18,                   /* 00011000 */
02228         0x18,                   /* 00011000 */
02229 
02230         /*
02231         * 185 0xb9 '' 
02232         */
02233         0x36,                   /* 00110110 */
02234         0x36,                   /* 00110110 */
02235         0xf6,                   /* 11110110 */
02236         0x06,                   /* 00000110 */
02237         0xf6,                   /* 11110110 */
02238         0x36,                   /* 00110110 */
02239         0x36,                   /* 00110110 */
02240         0x36,                   /* 00110110 */
02241 
02242         /*
02243         * 186 0xba '' 
02244         */
02245         0x36,                   /* 00110110 */
02246         0x36,                   /* 00110110 */
02247         0x36,                   /* 00110110 */
02248         0x36,                   /* 00110110 */
02249         0x36,                   /* 00110110 */
02250         0x36,                   /* 00110110 */
02251         0x36,                   /* 00110110 */
02252         0x36,                   /* 00110110 */
02253 
02254         /*
02255         * 187 0xbb '' 
02256         */
02257         0x00,                   /* 00000000 */
02258         0x00,                   /* 00000000 */
02259         0xfe,                   /* 11111110 */
02260         0x06,                   /* 00000110 */
02261         0xf6,                   /* 11110110 */
02262         0x36,                   /* 00110110 */
02263         0x36,                   /* 00110110 */
02264         0x36,                   /* 00110110 */
02265 
02266         /*
02267         * 188 0xbc '' 
02268         */
02269         0x36,                   /* 00110110 */
02270         0x36,                   /* 00110110 */
02271         0xf6,                   /* 11110110 */
02272         0x06,                   /* 00000110 */
02273         0xfe,                   /* 11111110 */
02274         0x00,                   /* 00000000 */
02275         0x00,                   /* 00000000 */
02276         0x00,                   /* 00000000 */
02277 
02278         /*
02279         * 189 0xbd '' 
02280         */
02281         0x36,                   /* 00110110 */
02282         0x36,                   /* 00110110 */
02283         0x36,                   /* 00110110 */
02284         0x36,                   /* 00110110 */
02285         0xfe,                   /* 11111110 */
02286         0x00,                   /* 00000000 */
02287         0x00,                   /* 00000000 */
02288         0x00,                   /* 00000000 */
02289 
02290         /*
02291         * 190 0xbe '' 
02292         */
02293         0x18,                   /* 00011000 */
02294         0x18,                   /* 00011000 */
02295         0xf8,                   /* 11111000 */
02296         0x18,                   /* 00011000 */
02297         0xf8,                   /* 11111000 */
02298         0x00,                   /* 00000000 */
02299         0x00,                   /* 00000000 */
02300         0x00,                   /* 00000000 */
02301 
02302         /*
02303         * 191 0xbf '' 
02304         */
02305         0x00,                   /* 00000000 */
02306         0x00,                   /* 00000000 */
02307         0x00,                   /* 00000000 */
02308         0x00,                   /* 00000000 */
02309         0xf8,                   /* 11111000 */
02310         0x18,                   /* 00011000 */
02311         0x18,                   /* 00011000 */
02312         0x18,                   /* 00011000 */
02313 
02314         /*
02315         * 192 0xc0 '' 
02316         */
02317         0x18,                   /* 00011000 */
02318         0x18,                   /* 00011000 */
02319         0x18,                   /* 00011000 */
02320         0x18,                   /* 00011000 */
02321         0x1f,                   /* 00011111 */
02322         0x00,                   /* 00000000 */
02323         0x00,                   /* 00000000 */
02324         0x00,                   /* 00000000 */
02325 
02326         /*
02327         * 193 0xc1 '' 
02328         */
02329         0x18,                   /* 00011000 */
02330         0x18,                   /* 00011000 */
02331         0x18,                   /* 00011000 */
02332         0x18,                   /* 00011000 */
02333         0xff,                   /* 11111111 */
02334         0x00,                   /* 00000000 */
02335         0x00,                   /* 00000000 */
02336         0x00,                   /* 00000000 */
02337 
02338         /*
02339         * 194 0xc2 '' 
02340         */
02341         0x00,                   /* 00000000 */
02342         0x00,                   /* 00000000 */
02343         0x00,                   /* 00000000 */
02344         0x00,                   /* 00000000 */
02345         0xff,                   /* 11111111 */
02346         0x18,                   /* 00011000 */
02347         0x18,                   /* 00011000 */
02348         0x18,                   /* 00011000 */
02349 
02350         /*
02351         * 195 0xc3 '' 
02352         */
02353         0x18,                   /* 00011000 */
02354         0x18,                   /* 00011000 */
02355         0x18,                   /* 00011000 */
02356         0x18,                   /* 00011000 */
02357         0x1f,                   /* 00011111 */
02358         0x18,                   /* 00011000 */
02359         0x18,                   /* 00011000 */
02360         0x18,                   /* 00011000 */
02361 
02362         /*
02363         * 196 0xc4 '' 
02364         */
02365         0x00,                   /* 00000000 */
02366         0x00,                   /* 00000000 */
02367         0x00,                   /* 00000000 */
02368         0x00,                   /* 00000000 */
02369         0xff,                   /* 11111111 */
02370         0x00,                   /* 00000000 */
02371         0x00,                   /* 00000000 */
02372         0x00,                   /* 00000000 */
02373 
02374         /*
02375         * 197 0xc5 '' 
02376         */
02377         0x18,                   /* 00011000 */
02378         0x18,                   /* 00011000 */
02379         0x18,                   /* 00011000 */
02380         0x18,                   /* 00011000 */
02381         0xff,                   /* 11111111 */
02382         0x18,                   /* 00011000 */
02383         0x18,                   /* 00011000 */
02384         0x18,                   /* 00011000 */
02385 
02386         /*
02387         * 198 0xc6 '' 
02388         */
02389         0x18,                   /* 00011000 */
02390         0x18,                   /* 00011000 */
02391         0x1f,                   /* 00011111 */
02392         0x18,                   /* 00011000 */
02393         0x1f,                   /* 00011111 */
02394         0x18,                   /* 00011000 */
02395         0x18,                   /* 00011000 */
02396         0x18,                   /* 00011000 */
02397 
02398         /*
02399         * 199 0xc7 '' 
02400         */
02401         0x36,                   /* 00110110 */
02402         0x36,                   /* 00110110 */
02403         0x36,                   /* 00110110 */
02404         0x36,                   /* 00110110 */
02405         0x37,                   /* 00110111 */
02406         0x36,                   /* 00110110 */
02407         0x36,                   /* 00110110 */
02408         0x36,                   /* 00110110 */
02409 
02410         /*
02411         * 200 0xc8 '' 
02412         */
02413         0x36,                   /* 00110110 */
02414         0x36,                   /* 00110110 */
02415         0x37,                   /* 00110111 */
02416         0x30,                   /* 00110000 */
02417         0x3f,                   /* 00111111 */
02418         0x00,                   /* 00000000 */
02419         0x00,                   /* 00000000 */
02420         0x00,                   /* 00000000 */
02421 
02422         /*
02423         * 201 0xc9 '' 
02424         */
02425         0x00,                   /* 00000000 */
02426         0x00,                   /* 00000000 */
02427         0x3f,                   /* 00111111 */
02428         0x30,                   /* 00110000 */
02429         0x37,                   /* 00110111 */
02430         0x36,                   /* 00110110 */
02431         0x36,                   /* 00110110 */
02432         0x36,                   /* 00110110 */
02433 
02434         /*
02435         * 202 0xca '' 
02436         */
02437         0x36,                   /* 00110110 */
02438         0x36,                   /* 00110110 */
02439         0xf7,                   /* 11110111 */
02440         0x00,                   /* 00000000 */
02441         0xff,                   /* 11111111 */
02442         0x00,                   /* 00000000 */
02443         0x00,                   /* 00000000 */
02444         0x00,                   /* 00000000 */
02445 
02446         /*
02447         * 203 0xcb '' 
02448         */
02449         0x00,                   /* 00000000 */
02450         0x00,                   /* 00000000 */
02451         0xff,                   /* 11111111 */
02452         0x00,                   /* 00000000 */
02453         0xf7,                   /* 11110111 */
02454         0x36,                   /* 00110110 */
02455         0x36,                   /* 00110110 */
02456         0x36,                   /* 00110110 */
02457 
02458         /*
02459         * 204 0xcc '' 
02460         */
02461         0x36,                   /* 00110110 */
02462         0x36,                   /* 00110110 */
02463         0x37,                   /* 00110111 */
02464         0x30,                   /* 00110000 */
02465         0x37,                   /* 00110111 */
02466         0x36,                   /* 00110110 */
02467         0x36,                   /* 00110110 */
02468         0x36,                   /* 00110110 */
02469 
02470         /*
02471         * 205 0xcd '' 
02472         */
02473         0x00,                   /* 00000000 */
02474         0x00,                   /* 00000000 */
02475         0xff,                   /* 11111111 */
02476         0x00,                   /* 00000000 */
02477         0xff,                   /* 11111111 */
02478         0x00,                   /* 00000000 */
02479         0x00,                   /* 00000000 */
02480         0x00,                   /* 00000000 */
02481 
02482         /*
02483         * 206 0xce '' 
02484         */
02485         0x36,                   /* 00110110 */
02486         0x36,                   /* 00110110 */
02487         0xf7,                   /* 11110111 */
02488         0x00,                   /* 00000000 */
02489         0xf7,                   /* 11110111 */
02490         0x36,                   /* 00110110 */
02491         0x36,                   /* 00110110 */
02492         0x36,                   /* 00110110 */
02493 
02494         /*
02495         * 207 0xcf '' 
02496         */
02497         0x18,                   /* 00011000 */
02498         0x18,                   /* 00011000 */
02499         0xff,                   /* 11111111 */
02500         0x00,                   /* 00000000 */
02501         0xff,                   /* 11111111 */
02502         0x00,                   /* 00000000 */
02503         0x00,                   /* 00000000 */
02504         0x00,                   /* 00000000 */
02505 
02506         /*
02507         * 208 0xd0 '' 
02508         */
02509         0x36,                   /* 00110110 */
02510         0x36,                   /* 00110110 */
02511         0x36,                   /* 00110110 */
02512         0x36,                   /* 00110110 */
02513         0xff,                   /* 11111111 */
02514         0x00,                   /* 00000000 */
02515         0x00,                   /* 00000000 */
02516         0x00,                   /* 00000000 */
02517 
02518         /*
02519         * 209 0xd1 '' 
02520         */
02521         0x00,                   /* 00000000 */
02522         0x00,                   /* 00000000 */
02523         0xff,                   /* 11111111 */
02524         0x00,                   /* 00000000 */
02525         0xff,                   /* 11111111 */
02526         0x18,                   /* 00011000 */
02527         0x18,                   /* 00011000 */
02528         0x18,                   /* 00011000 */
02529 
02530         /*
02531         * 210 0xd2 '' 
02532         */
02533         0x00,                   /* 00000000 */
02534         0x00,                   /* 00000000 */
02535         0x00,                   /* 00000000 */
02536         0x00,                   /* 00000000 */
02537         0xff,                   /* 11111111 */
02538         0x36,                   /* 00110110 */
02539         0x36,                   /* 00110110 */
02540         0x36,                   /* 00110110 */
02541 
02542         /*
02543         * 211 0xd3 '' 
02544         */
02545         0x36,                   /* 00110110 */
02546         0x36,                   /* 00110110 */
02547         0x36,                   /* 00110110 */
02548         0x36,                   /* 00110110 */
02549         0x3f,                   /* 00111111 */
02550         0x00,                   /* 00000000 */
02551         0x00,                   /* 00000000 */
02552         0x00,                   /* 00000000 */
02553 
02554         /*
02555         * 212 0xd4 '' 
02556         */
02557         0x18,                   /* 00011000 */
02558         0x18,                   /* 00011000 */
02559         0x1f,                   /* 00011111 */
02560         0x18,                   /* 00011000 */
02561         0x1f,                   /* 00011111 */
02562         0x00,                   /* 00000000 */
02563         0x00,                   /* 00000000 */
02564         0x00,                   /* 00000000 */
02565 
02566         /*
02567         * 213 0xd5 '' 
02568         */
02569         0x00,                   /* 00000000 */
02570         0x00,                   /* 00000000 */
02571         0x1f,                   /* 00011111 */
02572         0x18,                   /* 00011000 */
02573         0x1f,                   /* 00011111 */
02574         0x18,                   /* 00011000 */
02575         0x18,                   /* 00011000 */
02576         0x18,                   /* 00011000 */
02577 
02578         /*
02579         * 214 0xd6 '' 
02580         */
02581         0x00,                   /* 00000000 */
02582         0x00,                   /* 00000000 */
02583         0x00,                   /* 00000000 */
02584         0x00,                   /* 00000000 */
02585         0x3f,                   /* 00111111 */
02586         0x36,                   /* 00110110 */
02587         0x36,                   /* 00110110 */
02588         0x36,                   /* 00110110 */
02589 
02590         /*
02591         * 215 0xd7 '' 
02592         */
02593         0x36,                   /* 00110110 */
02594         0x36,                   /* 00110110 */
02595         0x36,                   /* 00110110 */
02596         0x36,                   /* 00110110 */
02597         0xff,                   /* 11111111 */
02598         0x36,                   /* 00110110 */
02599         0x36,                   /* 00110110 */
02600         0x36,                   /* 00110110 */
02601 
02602         /*
02603         * 216 0xd8 '' 
02604         */
02605         0x18,                   /* 00011000 */
02606         0x18,                   /* 00011000 */
02607         0xff,                   /* 11111111 */
02608         0x18,                   /* 00011000 */
02609         0xff,                   /* 11111111 */
02610         0x18,                   /* 00011000 */
02611         0x18,                   /* 00011000 */
02612         0x18,                   /* 00011000 */
02613 
02614         /*
02615         * 217 0xd9 '' 
02616         */
02617         0x18,                   /* 00011000 */
02618         0x18,                   /* 00011000 */
02619         0x18,                   /* 00011000 */
02620         0x18,                   /* 00011000 */
02621         0xf8,                   /* 11111000 */
02622         0x00,                   /* 00000000 */
02623         0x00,                   /* 00000000 */
02624         0x00,                   /* 00000000 */
02625 
02626         /*
02627         * 218 0xda '' 
02628         */
02629         0x00,                   /* 00000000 */
02630         0x00,                   /* 00000000 */
02631         0x00,                   /* 00000000 */
02632         0x00,                   /* 00000000 */
02633         0x1f,                   /* 00011111 */
02634         0x18,                   /* 00011000 */
02635         0x18,                   /* 00011000 */
02636         0x18,                   /* 00011000 */
02637 
02638         /*
02639         * 219 0xdb '' 
02640         */
02641         0xff,                   /* 11111111 */
02642         0xff,                   /* 11111111 */
02643         0xff,                   /* 11111111 */
02644         0xff,                   /* 11111111 */
02645         0xff,                   /* 11111111 */
02646         0xff,                   /* 11111111 */
02647         0xff,                   /* 11111111 */
02648         0xff,                   /* 11111111 */
02649 
02650         /*
02651         * 220 0xdc '' 
02652         */
02653         0x00,                   /* 00000000 */
02654         0x00,                   /* 00000000 */
02655         0x00,                   /* 00000000 */
02656         0x00,                   /* 00000000 */
02657         0xff,                   /* 11111111 */
02658         0xff,                   /* 11111111 */
02659         0xff,                   /* 11111111 */
02660         0xff,                   /* 11111111 */
02661 
02662         /*
02663         * 221 0xdd '' 
02664         */
02665         0xf0,                   /* 11110000 */
02666         0xf0,                   /* 11110000 */
02667         0xf0,                   /* 11110000 */
02668         0xf0,                   /* 11110000 */
02669         0xf0,                   /* 11110000 */
02670         0xf0,                   /* 11110000 */
02671         0xf0,                   /* 11110000 */
02672         0xf0,                   /* 11110000 */
02673 
02674         /*
02675         * 222 0xde '' 
02676         */
02677         0x0f,                   /* 00001111 */
02678         0x0f,                   /* 00001111 */
02679         0x0f,                   /* 00001111 */
02680         0x0f,                   /* 00001111 */
02681         0x0f,                   /* 00001111 */
02682         0x0f,                   /* 00001111 */
02683         0x0f,                   /* 00001111 */
02684         0x0f,                   /* 00001111 */
02685 
02686         /*
02687         * 223 0xdf '' 
02688         */
02689         0xff,                   /* 11111111 */
02690         0xff,                   /* 11111111 */
02691         0xff,                   /* 11111111 */
02692         0xff,                   /* 11111111 */
02693         0x00,                   /* 00000000 */
02694         0x00,                   /* 00000000 */
02695         0x00,                   /* 00000000 */
02696         0x00,                   /* 00000000 */
02697 
02698         /*
02699         * 224 0xe0 '' 
02700         */
02701         0x00,                   /* 00000000 */
02702         0x00,                   /* 00000000 */
02703         0x76,                   /* 01110110 */
02704         0xdc,                   /* 11011100 */
02705         0xc8,                   /* 11001000 */
02706         0xdc,                   /* 11011100 */
02707         0x76,                   /* 01110110 */
02708         0x00,                   /* 00000000 */
02709 
02710         /*
02711         * 225 0xe1 '' 
02712         */
02713         0x78,                   /* 01111000 */
02714         0xcc,                   /* 11001100 */
02715         0xcc,                   /* 11001100 */
02716         0xd8,                   /* 11011000 */
02717         0xcc,                   /* 11001100 */
02718         0xc6,                   /* 11000110 */
02719         0xcc,                   /* 11001100 */
02720         0x00,                   /* 00000000 */
02721 
02722         /*
02723         * 226 0xe2 '' 
02724         */
02725         0xfe,                   /* 11111110 */
02726         0xc6,                   /* 11000110 */
02727         0xc0,                   /* 11000000 */
02728         0xc0,                   /* 11000000 */
02729         0xc0,                   /* 11000000 */
02730         0xc0,                   /* 11000000 */
02731         0xc0,                   /* 11000000 */
02732         0x00,                   /* 00000000 */
02733 
02734         /*
02735         * 227 0xe3 '' 
02736         */
02737         0x00,                   /* 00000000 */
02738         0x00,                   /* 00000000 */
02739         0xfe,                   /* 11111110 */
02740         0x6c,                   /* 01101100 */
02741         0x6c,                   /* 01101100 */
02742         0x6c,                   /* 01101100 */
02743         0x6c,                   /* 01101100 */
02744         0x00,                   /* 00000000 */
02745 
02746         /*
02747         * 228 0xe4 '' 
02748         */
02749         0xfe,                   /* 11111110 */
02750         0xc6,                   /* 11000110 */
02751         0x60,                   /* 01100000 */
02752         0x30,                   /* 00110000 */
02753         0x60,                   /* 01100000 */
02754         0xc6,                   /* 11000110 */
02755         0xfe,                   /* 11111110 */
02756         0x00,                   /* 00000000 */
02757 
02758         /*
02759         * 229 0xe5 '' 
02760         */
02761         0x00,                   /* 00000000 */
02762         0x00,                   /* 00000000 */
02763         0x7e,                   /* 01111110 */
02764         0xd8,                   /* 11011000 */
02765         0xd8,                   /* 11011000 */
02766         0xd8,                   /* 11011000 */
02767         0x70,                   /* 01110000 */
02768         0x00,                   /* 00000000 */
02769 
02770         /*
02771         * 230 0xe6 '' 
02772         */
02773         0x00,                   /* 00000000 */
02774         0x00,                   /* 00000000 */
02775         0x66,                   /* 01100110 */
02776         0x66,                   /* 01100110 */
02777         0x66,                   /* 01100110 */
02778         0x66,                   /* 01100110 */
02779         0x7c,                   /* 01111100 */
02780         0xc0,                   /* 11000000 */
02781 
02782         /*
02783         * 231 0xe7 '' 
02784         */
02785         0x00,                   /* 00000000 */
02786         0x76,                   /* 01110110 */
02787         0xdc,                   /* 11011100 */
02788         0x18,                   /* 00011000 */
02789         0x18,                   /* 00011000 */
02790         0x18,                   /* 00011000 */
02791         0x18,                   /* 00011000 */
02792         0x00,                   /* 00000000 */
02793 
02794         /*
02795         * 232 0xe8 '' 
02796         */
02797         0x7e,                   /* 01111110 */
02798         0x18,                   /* 00011000 */
02799         0x3c,                   /* 00111100 */
02800         0x66,                   /* 01100110 */
02801         0x66,                   /* 01100110 */
02802         0x3c,                   /* 00111100 */
02803         0x18,                   /* 00011000 */
02804         0x7e,                   /* 01111110 */
02805 
02806         /*
02807         * 233 0xe9 '' 
02808         */
02809         0x38,                   /* 00111000 */
02810         0x6c,                   /* 01101100 */
02811         0xc6,                   /* 11000110 */
02812         0xfe,                   /* 11111110 */
02813         0xc6,                   /* 11000110 */
02814         0x6c,                   /* 01101100 */
02815         0x38,                   /* 00111000 */
02816         0x00,                   /* 00000000 */
02817 
02818         /*
02819         * 234 0xea '' 
02820         */
02821         0x38,                   /* 00111000 */
02822         0x6c,                   /* 01101100 */
02823         0xc6,                   /* 11000110 */
02824         0xc6,                   /* 11000110 */
02825         0x6c,                   /* 01101100 */
02826         0x6c,                   /* 01101100 */
02827         0xee,                   /* 11101110 */
02828         0x00,                   /* 00000000 */
02829 
02830         /*
02831         * 235 0xeb '' 
02832         */
02833         0x0e,                   /* 00001110 */
02834         0x18,                   /* 00011000 */
02835         0x0c,                   /* 00001100 */
02836         0x3e,                   /* 00111110 */
02837         0x66,                   /* 01100110 */
02838         0x66,                   /* 01100110 */
02839         0x3c,                   /* 00111100 */
02840         0x00,                   /* 00000000 */
02841 
02842         /*
02843         * 236 0xec '' 
02844         */
02845         0x00,                   /* 00000000 */
02846         0x00,                   /* 00000000 */
02847         0x7e,                   /* 01111110 */
02848         0xdb,                   /* 11011011 */
02849         0xdb,                   /* 11011011 */
02850         0x7e,                   /* 01111110 */
02851         0x00,                   /* 00000000 */
02852         0x00,                   /* 00000000 */
02853 
02854         /*
02855         * 237 0xed '' 
02856         */
02857         0x06,                   /* 00000110 */
02858         0x0c,                   /* 00001100 */
02859         0x7e,                   /* 01111110 */
02860         0xdb,                   /* 11011011 */
02861         0xdb,                   /* 11011011 */
02862         0x7e,                   /* 01111110 */
02863         0x60,                   /* 01100000 */
02864         0xc0,                   /* 11000000 */
02865 
02866         /*
02867         * 238 0xee '' 
02868         */
02869         0x1e,                   /* 00011110 */
02870         0x30,                   /* 00110000 */
02871         0x60,                   /* 01100000 */
02872         0x7e,                   /* 01111110 */
02873         0x60,                   /* 01100000 */
02874         0x30,                   /* 00110000 */
02875         0x1e,                   /* 00011110 */
02876         0x00,                   /* 00000000 */
02877 
02878         /*
02879         * 239 0xef '' 
02880         */
02881         0x00,                   /* 00000000 */
02882         0x7c,                   /* 01111100 */
02883         0xc6,                   /* 11000110 */
02884         0xc6,                   /* 11000110 */
02885         0xc6,                   /* 11000110 */
02886         0xc6,                   /* 11000110 */
02887         0xc6,                   /* 11000110 */
02888         0x00,                   /* 00000000 */
02889 
02890         /*
02891         * 240 0xf0 '' 
02892         */
02893         0x00,                   /* 00000000 */
02894         0xfe,                   /* 11111110 */
02895         0x00,                   /* 00000000 */
02896         0xfe,                   /* 11111110 */
02897         0x00,                   /* 00000000 */
02898         0xfe,                   /* 11111110 */
02899         0x00,                   /* 00000000 */
02900         0x00,                   /* 00000000 */
02901 
02902         /*
02903         * 241 0xf1 '' 
02904         */
02905         0x18,                   /* 00011000 */
02906         0x18,                   /* 00011000 */
02907         0x7e,                   /* 01111110 */
02908         0x18,                   /* 00011000 */
02909         0x18,                   /* 00011000 */
02910         0x00,                   /* 00000000 */
02911         0x7e,                   /* 01111110 */
02912         0x00,                   /* 00000000 */
02913 
02914         /*
02915         * 242 0xf2 '' 
02916         */
02917         0x30,                   /* 00110000 */
02918         0x18,                   /* 00011000 */
02919         0x0c,                   /* 00001100 */
02920         0x18,                   /* 00011000 */
02921         0x30,                   /* 00110000 */
02922         0x00,                   /* 00000000 */
02923         0x7e,                   /* 01111110 */
02924         0x00,                   /* 00000000 */
02925 
02926         /*
02927         * 243 0xf3 '' 
02928         */
02929         0x0c,                   /* 00001100 */
02930         0x18,                   /* 00011000 */
02931         0x30,                   /* 00110000 */
02932         0x18,                   /* 00011000 */
02933         0x0c,                   /* 00001100 */
02934         0x00,                   /* 00000000 */
02935         0x7e,                   /* 01111110 */
02936         0x00,                   /* 00000000 */
02937 
02938         /*
02939         * 244 0xf4 '' 
02940         */
02941         0x0e,                   /* 00001110 */
02942         0x1b,                   /* 00011011 */
02943         0x1b,                   /* 00011011 */
02944         0x18,                   /* 00011000 */
02945         0x18,                   /* 00011000 */
02946         0x18,                   /* 00011000 */
02947         0x18,                   /* 00011000 */
02948         0x18,                   /* 00011000 */
02949 
02950         /*
02951         * 245 0xf5 '' 
02952         */
02953         0x18,                   /* 00011000 */
02954         0x18,                   /* 00011000 */
02955         0x18,                   /* 00011000 */
02956         0x18,                   /* 00011000 */
02957         0x18,                   /* 00011000 */
02958         0xd8,                   /* 11011000 */
02959         0xd8,                   /* 11011000 */
02960         0x70,                   /* 01110000 */
02961 
02962         /*
02963         * 246 0xf6 '' 
02964         */
02965         0x00,                   /* 00000000 */
02966         0x18,                   /* 00011000 */
02967         0x00,                   /* 00000000 */
02968         0x7e,                   /* 01111110 */
02969         0x00,                   /* 00000000 */
02970         0x18,                   /* 00011000 */
02971         0x00,                   /* 00000000 */
02972         0x00,                   /* 00000000 */
02973 
02974         /*
02975         * 247 0xf7 '' 
02976         */
02977         0x00,                   /* 00000000 */
02978         0x76,                   /* 01110110 */
02979         0xdc,                   /* 11011100 */
02980         0x00,                   /* 00000000 */
02981         0x76,                   /* 01110110 */
02982         0xdc,                   /* 11011100 */
02983         0x00,                   /* 00000000 */
02984         0x00,                   /* 00000000 */
02985 
02986         /*
02987         * 248 0xf8 '' 
02988         */
02989         0x38,                   /* 00111000 */
02990         0x6c,                   /* 01101100 */
02991         0x6c,                   /* 01101100 */
02992         0x38,                   /* 00111000 */
02993         0x00,                   /* 00000000 */
02994         0x00,                   /* 00000000 */
02995         0x00,                   /* 00000000 */
02996         0x00,                   /* 00000000 */
02997 
02998         /*
02999         * 249 0xf9 '' 
03000         */
03001         0x00,                   /* 00000000 */
03002         0x00,                   /* 00000000 */
03003         0x00,                   /* 00000000 */
03004         0x18,                   /* 00011000 */
03005         0x18,                   /* 00011000 */
03006         0x00,                   /* 00000000 */
03007         0x00,                   /* 00000000 */
03008         0x00,                   /* 00000000 */
03009 
03010         /*
03011         * 250 0xfa '' 
03012         */
03013         0x00,                   /* 00000000 */
03014         0x00,                   /* 00000000 */
03015         0x00,                   /* 00000000 */
03016         0x18,                   /* 00011000 */
03017         0x00,                   /* 00000000 */
03018         0x00,                   /* 00000000 */
03019         0x00,                   /* 00000000 */
03020         0x00,                   /* 00000000 */
03021 
03022         /*
03023         * 251 0xfb '' 
03024         */
03025         0x0f,                   /* 00001111 */
03026         0x0c,                   /* 00001100 */
03027         0x0c,                   /* 00001100 */
03028         0x0c,                   /* 00001100 */
03029         0xec,                   /* 11101100 */
03030         0x6c,                   /* 01101100 */
03031         0x3c,                   /* 00111100 */
03032         0x1c,                   /* 00011100 */
03033 
03034         /*
03035         * 252 0xfc '' 
03036         */
03037         0x6c,                   /* 01101100 */
03038         0x36,                   /* 00110110 */
03039         0x36,                   /* 00110110 */
03040         0x36,                   /* 00110110 */
03041         0x36,                   /* 00110110 */
03042         0x00,                   /* 00000000 */
03043         0x00,                   /* 00000000 */
03044         0x00,                   /* 00000000 */
03045 
03046         /*
03047         * 253 0xfd '' 
03048         */
03049         0x78,                   /* 01111000 */
03050         0x0c,                   /* 00001100 */
03051         0x18,                   /* 00011000 */
03052         0x30,                   /* 00110000 */
03053         0x7c,                   /* 01111100 */
03054         0x00,                   /* 00000000 */
03055         0x00,                   /* 00000000 */
03056         0x00,                   /* 00000000 */
03057 
03058         /*
03059         * 254 0xfe '' 
03060         */
03061         0x00,                   /* 00000000 */
03062         0x00,                   /* 00000000 */
03063         0x3c,                   /* 00111100 */
03064         0x3c,                   /* 00111100 */
03065         0x3c,                   /* 00111100 */
03066         0x3c,                   /* 00111100 */
03067         0x00,                   /* 00000000 */
03068         0x00,                   /* 00000000 */
03069 
03070         /*
03071         * 255 0xff ' ' 
03072         */
03073         0x00,                   /* 00000000 */
03074         0x00,                   /* 00000000 */
03075         0x00,                   /* 00000000 */
03076         0x00,                   /* 00000000 */
03077         0x00,                   /* 00000000 */
03078         0x00,                   /* 00000000 */
03079         0x00,                   /* 00000000 */
03080         0x00,                   /* 00000000 */
03081 
03082 };
sdlgfx-2.0.25/Docs/html/_s_d_l__image_filter_8c.html000066400000000000000000003574661225506657100223260ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.c File Reference
I:/Sources/sdlgfx/SDL_imageFilter.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL_cpuinfo.h>
#include "SDL_imageFilter.h"

Go to the source code of this file.

Defines

#define SWAP_32(x)   (((x) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | ((x) << 24))
 Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).

Functions

int SDL_imageFilterMMXdetect (void)
 MMX detection routine (with override flag).
void SDL_imageFilterMMXoff ()
 Disable MMX check for filter functions and and force to use non-MMX C based code.
void SDL_imageFilterMMXon ()
 Enable MMX check for filter functions and use MMX code if available.
int SDL_imageFilterAdd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Add: D = saturation255(S1 + S2)
int SDL_imageFilterMean (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mean: D = S1/2 + S2/2.
int SDL_imageFilterSub (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Sub: D = saturation0(S1 - S2)
int SDL_imageFilterAbsDiff (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using AbsDiff: D = | S1 - S2 |.
int SDL_imageFilterMult (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mult: D = saturation255(S1 * S2)
int SDL_imageFilterMultNorASM (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
 Internal ASM Filter using MultNor: D = S1 * S2.
int SDL_imageFilterMultNor (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultNor: D = S1 * S2.
int SDL_imageFilterMultDivby2 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby2: D = saturation255(S1/2 * S2)
int SDL_imageFilterMultDivby4 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby4: D = saturation255(S1/2 * S2/2)
int SDL_imageFilterBitAnd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitAnd: D = S1 & S2.
int SDL_imageFilterBitOr (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitOr: D = S1 | S2.
int SDL_imageFilterDiv (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Div: D = S1 / S2.
int SDL_imageFilterBitNegation (unsigned char *Src1, unsigned char *Dest, unsigned int length)
 Filter using BitNegation: D = !S.
int SDL_imageFilterAddByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByte: D = saturation255(S + C)
int SDL_imageFilterAddUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)
int SDL_imageFilterAddByteToHalf (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByteToHalf: D = saturation255(S/2 + C)
int SDL_imageFilterSubByteMMX (unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
 Internal MMX Filter using SubByte: D = saturation0(S - C)
int SDL_imageFilterSubByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using SubByte: D = saturation0(S - C)
int SDL_imageFilterSubUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)
int SDL_imageFilterShiftRight (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRight: D = saturation0(S >> N)
int SDL_imageFilterShiftRightUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)
int SDL_imageFilterMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using MultByByte: D = saturation255(S * C)
int SDL_imageFilterShiftRightAndMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C)
 Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)
int SDL_imageFilterShiftLeftByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftByte: D = (S << N)
int SDL_imageFilterShiftLeftUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftUint: D = ((uint)S << N)
int SDL_imageFilterShiftLeft (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter ShiftLeft: D = saturation255(S << N)
int SDL_imageFilterBinarizeUsingThreshold (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
 Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.
int SDL_imageFilterClipToRange (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax)
 Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.
int SDL_imageFilterNormalizeLinear (unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax)
 Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
int SDL_imageFilterConvolveKernel3x3Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel5x5Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel7x7Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel9x9Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel3x3ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel5x5ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel7x7ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
int SDL_imageFilterConvolveKernel9x9ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )
int SDL_imageFilterSobelX (unsigned char *Src, unsigned char *Dest, int rows, int columns)
 Filter using SobelX: Dij = saturation255( ... )
int SDL_imageFilterSobelXShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, unsigned char NRightShift)
 Filter using SobelXShiftRight: Dij = saturation255( ... )
void SDL_imageFilterAlignStack (void)
 Align stack to 32 byte boundary,.
void SDL_imageFilterRestoreStack (void)
 Restore previously aligned stack.

Define Documentation

#define SWAP_32 (   x)    (((x) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | ((x) << 24))

Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).

Definition at line 58 of file SDL_imageFilter.c.


Function Documentation

int SDL_imageFilterAbsDiff ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using AbsDiff: D = | S1 - S2 |.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 539 of file SDL_imageFilter.c.

int SDL_imageFilterAdd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Add: D = saturation255(S1 + S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 170 of file SDL_imageFilter.c.

int SDL_imageFilterAddByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByte: D = saturation255(S + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant value to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1788 of file SDL_imageFilter.c.

int SDL_imageFilterAddByteToHalf ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByteToHalf: D = saturation255(S/2 + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2065 of file SDL_imageFilter.c.

int SDL_imageFilterAddUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1916 of file SDL_imageFilter.c.

void SDL_imageFilterAlignStack ( void  )

Align stack to 32 byte boundary,.

Definition at line 7323 of file SDL_imageFilter.c.

int SDL_imageFilterBinarizeUsingThreshold ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  T 
)

Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TThe threshold boundary (inclusive).
Returns:
Returns 0 for success or -1 for error.

Definition at line 3531 of file SDL_imageFilter.c.

int SDL_imageFilterBitAnd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitAnd: D = S1 & S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1275 of file SDL_imageFilter.c.

int SDL_imageFilterBitNegation ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitNegation: D = !S.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1668 of file SDL_imageFilter.c.

int SDL_imageFilterBitOr ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitOr: D = S1 | S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1389 of file SDL_imageFilter.c.

int SDL_imageFilterClipToRange ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  Tmin,
unsigned char  Tmax 
)

Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TminLower (inclusive) boundary of the clipping range.
TmaxUpper (inclusive) boundary of the clipping range.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3688 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel3x3Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >2.
KernelThe 2D convolution kernel of size 3x3.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 3977 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel3x3ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >2.
KernelThe 2D convolution kernel of size 3x3.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5375 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel5x5Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >4.
columnsNumber of columns in source/destination array. Must be >4.
KernelThe 2D convolution kernel of size 5x5.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4167 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel5x5ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >4.
columnsNumber of columns in source/destination array. Must be >4.
KernelThe 2D convolution kernel of size 5x5.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5552 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel7x7Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >6.
columnsNumber of columns in source/destination array. Must be >6.
KernelThe 2D convolution kernel of size 7x7.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4470 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel7x7ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >6.
columnsNumber of columns in source/destination array. Must be >6.
KernelThe 2D convolution kernel of size 7x7.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5853 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel9x9Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >8.
columnsNumber of columns in source/destination array. Must be >8.
KernelThe 2D convolution kernel of size 9x9.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4827 of file SDL_imageFilter.c.

int SDL_imageFilterConvolveKernel9x9ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >8.
columnsNumber of columns in source/destination array. Must be >8.
KernelThe 2D convolution kernel of size 9x9.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 6216 of file SDL_imageFilter.c.

int SDL_imageFilterDiv ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Div: D = S1 / S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1546 of file SDL_imageFilter.c.

int SDL_imageFilterMean ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mean: D = S1/2 + S2/2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 305 of file SDL_imageFilter.c.

int SDL_imageFilterMMXdetect ( void  )

MMX detection routine (with override flag).

Returns:
1 of MMX was detected, 0 otherwise.

Definition at line 77 of file SDL_imageFilter.c.

void SDL_imageFilterMMXoff ( void  )

Disable MMX check for filter functions and and force to use non-MMX C based code.

Definition at line 90 of file SDL_imageFilter.c.

void SDL_imageFilterMMXon ( void  )

Enable MMX check for filter functions and use MMX code if available.

Definition at line 98 of file SDL_imageFilter.c.

int SDL_imageFilterMult ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mult: D = saturation255(S1 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 726 of file SDL_imageFilter.c.

int SDL_imageFilterMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using MultByByte: D = saturation255(S * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2787 of file SDL_imageFilter.c.

int SDL_imageFilterMultDivby2 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby2: D = saturation255(S1/2 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 997 of file SDL_imageFilter.c.

int SDL_imageFilterMultDivby4 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby4: D = saturation255(S1/2 * S2/2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1138 of file SDL_imageFilter.c.

int SDL_imageFilterMultNor ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultNor: D = S1 * S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 859 of file SDL_imageFilter.c.

int SDL_imageFilterMultNorASM ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  SrcLength 
)

Internal ASM Filter using MultNor: D = S1 * S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
SrcLengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 789 of file SDL_imageFilter.c.

int SDL_imageFilterNormalizeLinear ( unsigned char *  Src,
unsigned char *  Dest,
unsigned int  length,
int  Cmin,
int  Cmax,
int  Nmin,
int  Nmax 
)

Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)

Parameters:
SrcPointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CminNormalization constant.
CmaxNormalization constant.
NminNormalization constant.
NmaxNormalization constant.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3906 of file SDL_imageFilter.c.

void SDL_imageFilterRestoreStack ( void  )

Restore previously aligned stack.

Definition at line 7351 of file SDL_imageFilter.c.

int SDL_imageFilterShiftLeft ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter ShiftLeft: D = saturation255(S << N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3390 of file SDL_imageFilter.c.

int SDL_imageFilterShiftLeftByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftByte: D = (S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3090 of file SDL_imageFilter.c.

int SDL_imageFilterShiftLeftUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftUint: D = ((uint)S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3207 of file SDL_imageFilter.c.

int SDL_imageFilterShiftRight ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRight: D = saturation0(S >> N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2473 of file SDL_imageFilter.c.

int SDL_imageFilterShiftRightAndMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N,
unsigned char  C 
)

Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2940 of file SDL_imageFilter.c.

int SDL_imageFilterShiftRightUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2591 of file SDL_imageFilter.c.

int SDL_imageFilterSobelX ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns 
)

Filter using SobelX: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to sobel-filter. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 6796 of file SDL_imageFilter.c.

int SDL_imageFilterSobelXShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
unsigned char  NRightShift 
)

Filter using SobelXShiftRight: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to sobel-filter. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >8.
NRightShiftThe number of right bit shifts to apply to the filter sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 7049 of file SDL_imageFilter.c.

int SDL_imageFilterSub ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Sub: D = saturation0(S1 - S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 419 of file SDL_imageFilter.c.

int SDL_imageFilterSubByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using SubByte: D = saturation0(S - C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2193 of file SDL_imageFilter.c.

int SDL_imageFilterSubByteMMX ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  SrcLength,
unsigned char  C 
)

Internal MMX Filter using SubByte: D = saturation0(S - C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
SrcLengthThe number of bytes in the source array.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2127 of file SDL_imageFilter.c.

int SDL_imageFilterSubUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2322 of file SDL_imageFilter.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__image_filter_8c_source.html000066400000000000000000032264031225506657100236730ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.c Source File
I:/Sources/sdlgfx/SDL_imageFilter.c
Go to the documentation of this file.
00001 /*
00002 
00003 SDL_imageFilter.c: byte-image "filter" routines
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 Copyright (C) 2013  Sylvain Beucler
00007 
00008 This software is provided 'as-is', without any express or implied
00009 warranty. In no event will the authors be held liable for any damages
00010 arising from the use of this software.
00011 
00012 Permission is granted to anyone to use this software for any purpose,
00013 including commercial applications, and to alter it and redistribute it
00014 freely, subject to the following restrictions:
00015 
00016    1. The origin of this software must not be misrepresented; you must not
00017    claim that you wrote the original software. If you use this software
00018    in a product, an acknowledgment in the product documentation would be
00019    appreciated but is not required.
00020 
00021    2. Altered source versions must be plainly marked as such, and must not be
00022    misrepresented as being the original software.
00023 
00024    3. This notice may not be removed or altered from any source
00025    distribution.
00026 
00027 Andreas Schiffler -- aschiffler at ferzkopp dot net
00028 
00029 */
00030 
00031 /*
00032 
00033 Note: Uses inline x86 MMX or ASM optimizations if available and enabled.
00034 
00035 Note: Most of the MMX code is based on published routines 
00036 by Vladimir Kravtchenko at vk@cs.ubc.ca - credits go to 
00037 him for his work.
00038 
00039 */
00040 
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 #include <string.h>
00044 
00045 /* Use GCC intrinsics if available: they support both i386 and x86_64,
00046    provide ASM-grade performances, and lift the PUSHA/POPA issues. */
00047 #ifdef __GNUC__
00048 #  ifdef USE_MMX
00049 #    include <mmintrin.h>
00050 #  endif
00051 #endif
00052 #include <SDL_cpuinfo.h>
00053 #include "SDL_imageFilter.h"
00054 
00058 #define SWAP_32(x) (((x) >> 24) | (((x) & 0x00ff0000) >> 8)  | (((x) & 0x0000ff00) << 8)  | ((x) << 24))
00059 
00060 /* ------ Static variables ----- */
00061 
00065 static int SDL_imageFilterUseMMX = 1;
00066 
00067 /* Detect GCC */
00068 #if defined(__GNUC__)
00069 #define GCC__
00070 #endif
00071 
00077 int SDL_imageFilterMMXdetect(void)
00078 {
00079         /* Check override flag */
00080         if (SDL_imageFilterUseMMX == 0) {
00081                 return (0);
00082         }
00083 
00084         return SDL_HasMMX();
00085 }
00086 
00090 void SDL_imageFilterMMXoff()
00091 {
00092         SDL_imageFilterUseMMX = 0;
00093 }
00094 
00098 void SDL_imageFilterMMXon()
00099 {
00100         SDL_imageFilterUseMMX = 1;
00101 }
00102 
00103 /* ------------------------------------------------------------------------------------ */
00104 
00115 static int SDL_imageFilterAddMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00116 {
00117 #ifdef USE_MMX
00118 #if !defined(GCC__)
00119         __asm
00120         {
00121                 pusha
00122                         mov eax, Src1   /* load Src1 address into eax */
00123                         mov ebx, Src2   /* load Src2 address into ebx */
00124                         mov edi, Dest   /* load Dest address into edi */
00125                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
00126                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
00127                         align 16        /* 16 byte alignment of the loop entry */
00128 L1010:
00129                 movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
00130                 paddusb mm1, [ebx]      /* mm1=Src1+Src2 (add 8 bytes with saturation) */
00131                 movq [edi], mm1 /* store result in Dest */
00132                         add eax, 8      /* increase Src1, Src2 and Dest  */
00133                         add ebx, 8      /* register pointers by 8 */
00134                         add edi, 8
00135                         dec ecx /* decrease loop counter */
00136                         jnz L1010       /* check loop termination, proceed if required */
00137                         emms /* exit MMX state */
00138                         popa
00139         }
00140 #else
00141         /* i386 and x86_64 */
00142         __m64 *mSrc1 = (__m64*)Src1;
00143         __m64 *mSrc2 = (__m64*)Src2;
00144         __m64 *mDest = (__m64*)Dest;
00145         int i;
00146         for (i = 0; i < SrcLength/8; i++) {
00147                 *mDest = _m_paddusb(*mSrc1, *mSrc2);    /* Src1+Src2 (add 8 bytes with saturation) */
00148                 mSrc1++;
00149                 mSrc2++;
00150                 mDest++;
00151         }
00152         _m_empty();                                     /* clean MMX state */
00153 #endif
00154         return (0);
00155 #else
00156         return (-1);
00157 #endif
00158 }
00159 
00170 int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00171 {
00172         unsigned int i, istart;
00173         unsigned char *cursrc1, *cursrc2, *curdst;
00174         int result;
00175 
00176         /* Validate input parameters */
00177         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00178                 return(-1);
00179         if (length == 0)
00180                 return(0);
00181 
00182         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00183 
00184                 /* Use MMX assembly routine */
00185                 SDL_imageFilterAddMMX(Src1, Src2, Dest, length);
00186 
00187                 /* Check for unaligned bytes */
00188                 if ((length & 7) > 0) {
00189                         /* Setup to process unaligned bytes */
00190                         istart = length & 0xfffffff8;
00191                         cursrc1 = &Src1[istart];
00192                         cursrc2 = &Src2[istart];
00193                         curdst = &Dest[istart];
00194                 } else {
00195                         /* No unaligned bytes - we are done */
00196                         return (0);
00197                 }
00198         } else {
00199                 /* Setup to process whole image */
00200                 istart = 0;
00201                 cursrc1 = Src1;
00202                 cursrc2 = Src2;
00203                 curdst = Dest;
00204         }
00205 
00206         /* C routine to process image */
00207         for (i = istart; i < length; i++) {
00208                 result = (int) *cursrc1 + (int) *cursrc2;
00209                 if (result > 255)
00210                         result = 255;
00211                 *curdst = (unsigned char) result;
00212                 /* Advance pointers */
00213                 cursrc1++;
00214                 cursrc2++;
00215                 curdst++;
00216         }
00217 
00218         return (0);
00219 }
00220 
00232 static int SDL_imageFilterMeanMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength,
00233                                                    unsigned char *Mask)
00234 {
00235 #ifdef USE_MMX
00236 #if !defined(GCC__)
00237         __asm
00238         { 
00239                 pusha
00240                         mov edx, Mask /* load Mask address into edx */
00241                         movq mm0, [edx] /* load Mask into mm0 */
00242                 mov eax, Src1 /* load Src1 address into eax */
00243                         mov ebx, Src2 /* load Src2 address into ebx */
00244                         mov edi, Dest /* load Dest address into edi */
00245                         mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
00246                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
00247                         align 16        /* 16 byte alignment of the loop entry */
00248 L21011:
00249                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00250                 movq mm2,  [ebx]        /* load 8 bytes from Src2 into mm2 */
00251                 /* --- Byte shift via Word shift --- */
00252                 psrlw mm1, 1    /* shift 4 WORDS of mm1 1 bit to the right */
00253                         psrlw mm2, 1    /* shift 4 WORDS of mm2 1 bit to the right */
00254                         pand mm1, mm0   // apply Mask to 8 BYTES of mm1 */
00255                         /* byte     0x0f, 0xdb, 0xc8 */
00256                         pand mm2, mm0   // apply Mask to 8 BYTES of mm2 */
00257                         /* byte     0x0f, 0xdb, 0xd0 */
00258                         paddusb mm1,  mm2       /* mm1=mm1+mm2 (add 8 bytes with saturation) */
00259                         movq [edi],  mm1        /* store result in Dest */
00260                         add eax,  8     /* increase Src1, Src2 and Dest  */
00261                         add ebx,  8     /* register pointers by 8 */
00262                         add edi,  8
00263                         dec ecx         /* decrease loop counter */
00264                         jnz L21011      /* check loop termination, proceed if required */
00265                         emms    /* exit MMX state */
00266                         popa
00267         }
00268 #else
00269         /* i386 and x86_64 */
00270         __m64 *mSrc1 = (__m64*)Src1;
00271         __m64 *mSrc2 = (__m64*)Src2;
00272         __m64 *mDest = (__m64*)Dest;
00273         __m64 *mMask = (__m64*)Mask;
00274         int i;
00275         for (i = 0; i < SrcLength/8; i++) {
00276                 __m64 mm1 = *mSrc1,
00277                       mm2 = *mSrc2;
00278                 mm1 = _m_psrlwi(mm1, 1);        /* shift 4 WORDS of mm1 1 bit to the right */
00279                 mm2 = _m_psrlwi(mm2, 1);        /* shift 4 WORDS of mm2 1 bit to the right */
00280                 mm1 = _m_pand(mm1, *mMask);     /* apply Mask to 8 BYTES of mm1 */
00281                 mm2 = _m_pand(mm2, *mMask);     /* apply Mask to 8 BYTES of mm2 */
00282                 *mDest = _m_paddusb(mm1, mm2);  /* mm1+mm2 (add 8 bytes with saturation) */
00283                 mSrc1++;
00284                 mSrc2++;
00285                 mDest++;
00286         }
00287         _m_empty();                             /* clean MMX state */
00288 #endif
00289         return (0);
00290 #else
00291         return (-1);
00292 #endif
00293 }
00294 
00305 int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00306 {
00307         static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
00308         unsigned int i, istart;
00309         unsigned char *cursrc1, *cursrc2, *curdst;
00310         int result;
00311 
00312         /* Validate input parameters */
00313         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00314                 return(-1);
00315         if (length == 0)
00316                 return(0);
00317 
00318         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00319                 /* MMX routine */
00320                 SDL_imageFilterMeanMMX(Src1, Src2, Dest, length, Mask);
00321 
00322                 /* Check for unaligned bytes */
00323                 if ((length & 7) > 0) {
00324                         /* Setup to process unaligned bytes */
00325                         istart = length & 0xfffffff8;
00326                         cursrc1 = &Src1[istart];
00327                         cursrc2 = &Src2[istart];
00328                         curdst = &Dest[istart];
00329                 } else {
00330                         /* No unaligned bytes - we are done */
00331                         return (0);
00332                 }
00333         } else {
00334                 /* Setup to process whole image */
00335                 istart = 0;
00336                 cursrc1 = Src1;
00337                 cursrc2 = Src2;
00338                 curdst = Dest;
00339         }
00340 
00341         /* C routine to process image */
00342         for (i = istart; i < length; i++) {
00343                 result = (int) *cursrc1 / 2 + (int) *cursrc2 / 2;
00344                 *curdst = (unsigned char) result;
00345                 /* Advance pointers */
00346                 cursrc1++;
00347                 cursrc2++;
00348                 curdst++;
00349         }
00350 
00351         return (0);
00352 }
00353 
00364 static int SDL_imageFilterSubMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00365 {
00366 #ifdef USE_MMX
00367 #if !defined(GCC__)
00368         __asm
00369         {
00370                 pusha
00371                         mov eax,  Src1  /* load Src1 address into eax */
00372                         mov ebx,  Src2  /* load Src2 address into ebx */
00373                         mov edi,  Dest  /* load Dest address into edi */
00374                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
00375                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
00376                         align 16 /* 16 byte alignment of the loop entry */
00377 L1012:
00378                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00379                 psubusb mm1,  [ebx]     /* mm1=Src1-Src2 (sub 8 bytes with saturation) */
00380                 movq [edi],  mm1        /* store result in Dest */
00381                         add eax, 8      /* increase Src1, Src2 and Dest  */
00382                         add ebx, 8      /* register pointers by 8 */
00383                         add edi, 8
00384                         dec ecx /* decrease loop counter */
00385                         jnz L1012       /* check loop termination, proceed if required */
00386                         emms /* exit MMX state */
00387                         popa
00388         }
00389 #else
00390         /* i386 and x86_64 */
00391         __m64 *mSrc1 = (__m64*)Src1;
00392         __m64 *mSrc2 = (__m64*)Src2;
00393         __m64 *mDest = (__m64*)Dest;
00394         int i;
00395         for (i = 0; i < SrcLength/8; i++) {
00396                 *mDest = _m_psubusb(*mSrc1, *mSrc2);    /* Src1-Src2 (sub 8 bytes with saturation) */
00397                 mSrc1++;
00398                 mSrc2++;
00399                 mDest++;
00400         }
00401         _m_empty();                                     /* clean MMX state */
00402 #endif
00403         return (0);
00404 #else
00405         return (-1);
00406 #endif
00407 }
00408 
00419 int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00420 {
00421         unsigned int i, istart;
00422         unsigned char *cursrc1, *cursrc2, *curdst;
00423         int result;
00424 
00425         /* Validate input parameters */
00426         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00427                 return(-1);
00428         if (length == 0)
00429                 return(0);
00430 
00431         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00432                 /* MMX routine */
00433                 SDL_imageFilterSubMMX(Src1, Src2, Dest, length);
00434 
00435                 /* Check for unaligned bytes */
00436                 if ((length & 7) > 0) {
00437                         /* Setup to process unaligned bytes */
00438                         istart = length & 0xfffffff8;
00439                         cursrc1 = &Src1[istart];
00440                         cursrc2 = &Src2[istart];
00441                         curdst = &Dest[istart];
00442                 } else {
00443                         /* No unaligned bytes - we are done */
00444                         return (0);
00445                 }
00446         } else {
00447                 /* Setup to process whole image */
00448                 istart = 0;
00449                 cursrc1 = Src1;
00450                 cursrc2 = Src2;
00451                 curdst = Dest;
00452         }
00453 
00454         /* C routine to process image */
00455         for (i = istart; i < length; i++) {
00456                 result = (int) *cursrc1 - (int) *cursrc2;
00457                 if (result < 0)
00458                         result = 0;
00459                 *curdst = (unsigned char) result;
00460                 /* Advance pointers */
00461                 cursrc1++;
00462                 cursrc2++;
00463                 curdst++;
00464         }
00465 
00466         return (0);
00467 }
00468 
00479 static int SDL_imageFilterAbsDiffMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00480 {
00481 #ifdef USE_MMX
00482 #if !defined(GCC__)
00483         __asm
00484         {
00485                 pusha
00486                         mov eax, Src1   /* load Src1 address into eax */
00487                         mov ebx, Src2   /* load Src2 address into ebx */
00488                         mov edi, Dest   /* load Dest address into edi */
00489                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
00490                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
00491                         align 16        /* 16 byte alignment of the loop entry */
00492 L1013:
00493                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00494                 movq mm2,  [ebx]        /* load 8 bytes from Src2 into mm2 */
00495                 psubusb mm1,  [ebx]     /* mm1=Src1-Src2 (sub 8 bytes with saturation) */
00496                 psubusb mm2,  [eax]     /* mm2=Src2-Src1 (sub 8 bytes with saturation) */
00497                 por mm1,  mm2   /* combine both mm2 and mm1 results */
00498                         movq [edi],  mm1        /* store result in Dest */
00499                         add eax, 8      /* increase Src1, Src2 and Dest  */
00500                         add ebx, 8      /* register pointers by 8 */
00501                         add edi, 8
00502                         dec ecx         /* decrease loop counter */
00503                         jnz L1013       /* check loop termination, proceed if required */
00504                         emms         /* exit MMX state */
00505                         popa
00506         }
00507 #else
00508         /* i386 and x86_64 */
00509         __m64 *mSrc1 = (__m64*)Src1;
00510         __m64 *mSrc2 = (__m64*)Src2;
00511         __m64 *mDest = (__m64*)Dest;
00512         int i;
00513         for (i = 0; i < SrcLength/8; i++) {
00514                 __m64 mm1 = _m_psubusb(*mSrc2, *mSrc1); /* Src1-Src2 (sub 8 bytes with saturation) */
00515                 __m64 mm2 = _m_psubusb(*mSrc1, *mSrc2); /* Src2-Src1 (sub 8 bytes with saturation) */
00516                 *mDest = _m_por(mm1, mm2);              /* combine both mm2 and mm1 results */
00517                 mSrc1++;
00518                 mSrc2++;
00519                 mDest++;
00520         }
00521         _m_empty();                                     /* clean MMX state */
00522 #endif
00523         return (0);
00524 #else
00525         return (-1);
00526 #endif
00527 }
00528 
00539 int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00540 {
00541         unsigned int i, istart;
00542         unsigned char *cursrc1, *cursrc2, *curdst;
00543         int result;
00544 
00545         /* Validate input parameters */
00546         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00547                 return(-1);
00548         if (length == 0)
00549                 return(0);
00550 
00551         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00552                 /* MMX routine */
00553                 SDL_imageFilterAbsDiffMMX(Src1, Src2, Dest, length);
00554 
00555                 /* Check for unaligned bytes */
00556                 if ((length & 7) > 0) {
00557                         /* Setup to process unaligned bytes */
00558                         istart = length & 0xfffffff8;
00559                         cursrc1 = &Src1[istart];
00560                         cursrc2 = &Src2[istart];
00561                         curdst = &Dest[istart];
00562                 } else {
00563                         /* No unaligned bytes - we are done */
00564                         return (0);
00565                 }
00566         } else {
00567                 /* Setup to process whole image */
00568                 istart = 0;
00569                 cursrc1 = Src1;
00570                 cursrc2 = Src2;
00571                 curdst = Dest;
00572         }
00573 
00574         /* C routine to process image */
00575         for (i = istart; i < length; i++) {
00576                 result = abs((int) *cursrc1 - (int) *cursrc2);
00577                 *curdst = (unsigned char) result;
00578                 /* Advance pointers */
00579                 cursrc1++;
00580                 cursrc2++;
00581                 curdst++;
00582         }
00583 
00584         return (0);
00585 }
00586 
00597 static int SDL_imageFilterMultMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00598 {
00599 #ifdef USE_MMX
00600 #if !defined(GCC__)
00601         __asm
00602         {
00603                 pusha
00604                         mov eax, Src1   /* load Src1 address into eax */
00605                         mov ebx, Src2   /* load Src2 address into ebx */
00606                         mov edi, Dest   /* load Dest address into edi */
00607                         mov ecx, SrcLength   /* load loop counter (SIZE) into ecx */
00608                         shr ecx, 3   /* counter/8 (MMX loads 8 bytes at a time) */
00609                         pxor mm0, mm0   /* zero mm0 register */
00610                         align 16        /* 16 byte alignment of the loop entry */
00611 L1014:
00612                 movq mm1, [eax]   /* load 8 bytes from Src1 into mm1 */
00613                 movq mm3, [ebx]   /* load 8 bytes from Src2 into mm3 */
00614                 movq mm2, mm1   /* copy mm1 into mm2 */
00615                         movq mm4, mm3   /* copy mm3 into mm4  */
00616                         punpcklbw mm1, mm0   /* unpack low  bytes of Src1 into words */
00617                         punpckhbw mm2, mm0   /* unpack high bytes of Src1 into words */
00618                         punpcklbw mm3, mm0   /* unpack low  bytes of Src2 into words */
00619                         punpckhbw mm4, mm0   /* unpack high bytes of Src2 into words */
00620                         pmullw mm1, mm3   /* mul low  bytes of Src1 and Src2  */
00621                         pmullw mm2, mm4   /* mul high bytes of Src1 and Src2 */
00622                         /* Take abs value of the results (signed words) */
00623                         movq mm5, mm1   /* copy mm1 into mm5 */
00624                         movq mm6, mm2   /* copy mm2 into mm6 */
00625                         psraw mm5, 15   /* fill mm5 words with word sign bit */
00626                         psraw mm6, 15   /* fill mm6 words with word sign bit */
00627                         pxor mm1, mm5   /* take 1's compliment of only neg. words */
00628                         pxor mm2, mm6   /* take 1's compliment of only neg. words */
00629                         psubsw mm1, mm5   /* add 1 to only neg. words, W-(-1) or W-0 */
00630                         psubsw mm2, mm6   /* add 1 to only neg. words, W-(-1) or W-0 */
00631                         packuswb mm1, mm2   /* pack words back into bytes with saturation */
00632                         movq [edi], mm1   /* store result in Dest */
00633                         add eax, 8   /* increase Src1, Src2 and Dest  */
00634                         add ebx, 8   /* register pointers by 8 */
00635                         add edi, 8
00636                         dec ecx         /* decrease loop counter */
00637                         jnz L1014       /* check loop termination, proceed if required */
00638                         emms /* exit MMX state */
00639                         popa
00640         }
00641 #else
00642         /* i386 ASM with constraints: */
00643         /* asm volatile ( */
00644         /*      "shr $3, %%ecx \n\t"    /\* counter/8 (MMX loads 8 bytes at a time) *\/ */
00645         /*      "pxor      %%mm0, %%mm0 \n\t"   /\* zero mm0 register *\/ */
00646         /*      ".align 16       \n\t"  /\* 16 byte alignment of the loop entry *\/ */
00647         /*      "1: movq (%%eax), %%mm1 \n\t"     /\* load 8 bytes from Src1 into mm1 *\/ */
00648         /*      "movq    (%%ebx), %%mm3 \n\t"   /\* load 8 bytes from Src2 into mm3 *\/ */
00649         /*      "movq      %%mm1, %%mm2 \n\t"   /\* copy mm1 into mm2 *\/ */
00650         /*      "movq      %%mm3, %%mm4 \n\t"   /\* copy mm3 into mm4  *\/ */
00651         /*      "punpcklbw %%mm0, %%mm1 \n\t"   /\* unpack low  bytes of Src1 into words *\/ */
00652         /*      "punpckhbw %%mm0, %%mm2 \n\t"   /\* unpack high bytes of Src1 into words *\/ */
00653         /*      "punpcklbw %%mm0, %%mm3 \n\t"   /\* unpack low  bytes of Src2 into words *\/ */
00654         /*      "punpckhbw %%mm0, %%mm4 \n\t"   /\* unpack high bytes of Src2 into words *\/ */
00655         /*      "pmullw    %%mm3, %%mm1 \n\t"   /\* mul low  bytes of Src1 and Src2  *\/ */
00656         /*      "pmullw    %%mm4, %%mm2 \n\t"   /\* mul high bytes of Src1 and Src2 *\/ */
00657         /*      /\* Take abs value of the results (signed words) *\/ */
00658         /*      "movq      %%mm1, %%mm5 \n\t"   /\* copy mm1 into mm5 *\/ */
00659         /*      "movq      %%mm2, %%mm6 \n\t"   /\* copy mm2 into mm6 *\/ */
00660         /*      "psraw       $15, %%mm5 \n\t"   /\* fill mm5 words with word sign bit *\/ */
00661         /*      "psraw       $15, %%mm6 \n\t"   /\* fill mm6 words with word sign bit *\/ */
00662         /*      "pxor      %%mm5, %%mm1 \n\t"   /\* take 1's compliment of only neg. words *\/ */
00663         /*      "pxor      %%mm6, %%mm2 \n\t"   /\* take 1's compliment of only neg. words *\/ */
00664         /*      "psubsw    %%mm5, %%mm1 \n\t"   /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */
00665         /*      "psubsw    %%mm6, %%mm2 \n\t"   /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */
00666         /*      "packuswb  %%mm2, %%mm1 \n\t"   /\* pack words back into bytes with saturation *\/ */
00667         /*      "movq    %%mm1, (%%edi) \n\t"   /\* store result in Dest *\/ */
00668         /*      "add $8, %%eax \n\t"    /\* increase Src1, Src2 and Dest  *\/ */
00669         /*      "add $8, %%ebx \n\t"    /\* register pointers by 8 *\/ */
00670         /*      "add $8, %%edi \n\t" */
00671         /*      "dec %%ecx     \n\t"    /\* decrease loop counter *\/ */
00672         /*      "jnz 1b        \n\t"    /\* check loop termination, proceed if required *\/ */
00673         /*      "emms          \n\t"    /\* exit MMX state *\/ */
00674         /*      : "+a" (Src1),          /\* load Src1 address into rax, modified by the loop *\/ */
00675         /*        "+b" (Src2),          /\* load Src2 address into rbx, modified by the loop *\/ */
00676         /*        "+c" (SrcLength),     /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */
00677         /*        "+D" (Dest)           /\* load Dest address into rdi, modified by the loop *\/ */
00678         /*      : */
00679         /*      : "memory",             /\* *Dest is modified *\/ */
00680         /*           "mm0","mm1","mm2","mm3","mm4","mm5","mm6"  /\* registers modified *\/ */
00681         /* ); */
00682 
00683         /* i386 and x86_64 */
00684         __m64 *mSrc1 = (__m64*)Src1;
00685         __m64 *mSrc2 = (__m64*)Src2;
00686         __m64 *mDest = (__m64*)Dest;
00687         __m64 mm0 = _m_from_int(0); /* zero mm0 register */
00688         int i;
00689         for (i = 0; i < SrcLength/8; i++) {
00690                 __m64 mm1, mm2, mm3, mm4, mm5, mm6;
00691                 mm1 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
00692                 mm2 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
00693                 mm3 = _m_punpcklbw(*mSrc2, mm0);        /* unpack low  bytes of Src2 into words */
00694                 mm4 = _m_punpckhbw(*mSrc2, mm0);        /* unpack high bytes of Src2 into words */
00695                 mm1 = _m_pmullw(mm1, mm3);              /* mul low  bytes of Src1 and Src2  */
00696                 mm2 = _m_pmullw(mm2, mm4);              /* mul high bytes of Src1 and Src2 */
00697                 mm5 = _m_psrawi(mm1, 15);               /* fill mm5 words with word sign bit */
00698                 mm6 = _m_psrawi(mm2, 15);               /* fill mm6 words with word sign bit */
00699                 mm1 = _m_pxor(mm1, mm5);                /* take 1's compliment of only neg. words */
00700                 mm2 = _m_pxor(mm2, mm6);                /* take 1's compliment of only neg. words */
00701                 mm1 = _m_psubsw(mm1, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
00702                 mm2 = _m_psubsw(mm2, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
00703                 *mDest = _m_packuswb(mm1, mm2);         /* pack words back into bytes with saturation */
00704                 mSrc1++;
00705                 mSrc2++;
00706                 mDest++;
00707         }
00708         _m_empty();                                     /* clean MMX state */
00709 #endif
00710         return (0);
00711 #else
00712         return (-1);
00713 #endif
00714 }
00715 
00726 int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00727 {
00728         unsigned int i, istart;
00729         unsigned char *cursrc1, *cursrc2, *curdst;
00730         int result;
00731 
00732         /* Validate input parameters */
00733         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00734                 return(-1);
00735         if (length == 0)
00736                 return(0);
00737 
00738         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
00739                 /* MMX routine */
00740                 SDL_imageFilterMultMMX(Src1, Src2, Dest, length);
00741 
00742                 /* Check for unaligned bytes */
00743                 if ((length & 7) > 0) {
00744                         /* Setup to process unaligned bytes */
00745                         istart = length & 0xfffffff8;
00746                         cursrc1 = &Src1[istart];
00747                         cursrc2 = &Src2[istart];
00748                         curdst = &Dest[istart];
00749                 } else {
00750                         /* No unaligned bytes - we are done */
00751                         return (0);
00752                 }
00753         } else {
00754                 /* Setup to process whole image */
00755                 istart = 0;
00756                 cursrc1 = Src1;
00757                 cursrc2 = Src2;
00758                 curdst = Dest;
00759         }
00760 
00761         /* C routine to process image */
00762         for (i = istart; i < length; i++) {
00763 
00764                 /* NOTE: this is probably wrong - dunno what the MMX code does */
00765 
00766                 result = (int) *cursrc1 * (int) *cursrc2;
00767                 if (result > 255)
00768                         result = 255;
00769                 *curdst = (unsigned char) result;
00770                 /* Advance pointers */
00771                 cursrc1++;
00772                 cursrc2++;
00773                 curdst++;
00774         }
00775 
00776         return (0);
00777 }
00778 
00789 int SDL_imageFilterMultNorASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00790 {
00791 #ifdef USE_MMX
00792 #if !defined(GCC__)
00793         __asm
00794         {
00795                 pusha
00796                         mov edx, Src1   /* load Src1 address into edx */
00797                         mov esi, Src2   /* load Src2 address into esi */
00798                         mov edi, Dest   /* load Dest address into edi */
00799                         mov ecx, SrcLength   /* load loop counter (SIZE) into ecx */
00800                         align 16        /* 16 byte alignment of the loop entry */
00801 L10141:
00802                 mov al, [edx]   /* load a byte from Src1 */
00803                 mul [esi]       /* mul with a byte from Src2 */
00804                 mov [edi], al   /* move a byte result to Dest */
00805                         inc edx         /* increment Src1, Src2, Dest */
00806                         inc esi                 /* pointer registers by one */
00807                         inc edi
00808                         dec ecx /* decrease loop counter */
00809                         jnz L10141      /* check loop termination, proceed if required */
00810                         popa
00811         }
00812 #else
00813         /* Note: ~5% gain on i386, less efficient than C on x86_64 */
00814         /* Also depends on whether this function is static (?!) */
00815         asm volatile (
00816                 ".align 16       \n\t"  /* 16 byte alignment of the loop entry */
00817 #  if defined(i386)
00818                 "1:mov  (%%edx), %%al \n\t"      /* load a byte from Src1 */
00819                 "mulb (%%esi)       \n\t"       /* mul with a byte from Src2 */
00820                 "mov %%al, (%%edi)  \n\t"       /* move a byte result to Dest */
00821                 "inc %%edx \n\t"                /* increment Src1, Src2, Dest */
00822                 "inc %%esi \n\t"                /* pointer registers by one */
00823                 "inc %%edi \n\t"
00824                 "dec %%ecx      \n\t"   /* decrease loop counter */
00825 #  elif defined(__x86_64__)
00826                 "1:mov  (%%rdx), %%al \n\t"      /* load a byte from Src1 */
00827                 "mulb (%%rsi)       \n\t"       /* mul with a byte from Src2 */
00828                 "mov %%al, (%%rdi)  \n\t"       /* move a byte result to Dest */
00829                 "inc %%rdx \n\t"                /* increment Src1, Src2, Dest */
00830                 "inc %%rsi \n\t"                /* pointer registers by one */
00831                 "inc %%rdi \n\t"
00832                 "dec %%rcx      \n\t"   /* decrease loop counter */
00833 #  endif
00834                 "jnz 1b         \n\t"   /* check loop termination, proceed if required */
00835                 : "+d" (Src1),          /* load Src1 address into edx */
00836                   "+S" (Src2),          /* load Src2 address into esi */
00837                   "+c" (SrcLength),     /* load loop counter (SIZE) into ecx */
00838                   "+D" (Dest)           /* load Dest address into edi */
00839                 :
00840                 : "memory", "rax"
00841                 );
00842 #endif
00843         return (0);
00844 #else
00845         return (-1);
00846 #endif
00847 }
00848 
00859 int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00860 {
00861         unsigned int i, istart;
00862         unsigned char *cursrc1, *cursrc2, *curdst;
00863 
00864         /* Validate input parameters */
00865         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
00866                 return(-1);
00867         if (length == 0)
00868                 return(0);
00869 
00870         if (SDL_imageFilterMMXdetect()) {
00871                 if (length > 0) {
00872                         /* ASM routine */
00873                         SDL_imageFilterMultNorASM(Src1, Src2, Dest, length);
00874 
00875                         /* Check for unaligned bytes */
00876                         if ((length & 7) > 0) {
00877                                 /* Setup to process unaligned bytes */
00878                                 istart = length & 0xfffffff8;
00879                                 cursrc1 = &Src1[istart];
00880                                 cursrc2 = &Src2[istart];
00881                                 curdst = &Dest[istart];
00882                         } else {
00883                                 /* No unaligned bytes - we are done */
00884                                 return (0);
00885                         }
00886                 } else {
00887                         /* No bytes - we are done */
00888                         return (0);
00889                 }
00890         } else {
00891                 /* Setup to process whole image */
00892                 istart = 0;
00893                 cursrc1 = Src1;
00894                 cursrc2 = Src2;
00895                 curdst = Dest;
00896         }
00897 
00898         /* C routine to process image */
00899         for (i = istart; i < length; i++) {
00900                 *curdst = (int)*cursrc1 * (int)*cursrc2;  // (int) for efficiency
00901                 /* Advance pointers */
00902                 cursrc1++;
00903                 cursrc2++;
00904                 curdst++;
00905         }
00906 
00907         return (0);
00908 }
00909 
00920 static int SDL_imageFilterMultDivby2MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
00921 {
00922 #ifdef USE_MMX
00923 #if !defined(GCC__)
00924         __asm
00925         { 
00926                 pusha
00927                         mov eax, Src1           /* load Src1 address into eax */
00928                         mov ebx, Src2           /* load Src2 address into ebx */
00929                         mov edi, Dest           /* load Dest address into edi */
00930                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
00931                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
00932                         pxor mm0,  mm0  /* zero mm0 register */
00933                         align 16                /* 16 byte alignment of the loop entry */
00934 L1015:
00935                 movq mm1,  [eax]        /* load 8 bytes from Src1 into mm1 */
00936                 movq mm3,  [ebx]        /* load 8 bytes from Src2 into mm3 */
00937                 movq mm2,  mm1  /* copy mm1 into mm2 */
00938                         movq mm4,  mm3  /* copy mm3 into mm4  */
00939                         punpcklbw mm1,  mm0     /* unpack low  bytes of Src1 into words */
00940                         punpckhbw mm2,  mm0     /* unpack high bytes of Src1 into words */
00941                         punpcklbw mm3,  mm0     /* unpack low  bytes of Src2 into words */
00942                         punpckhbw mm4,  mm0     /* unpack high bytes of Src2 into words */
00943                         psrlw mm1,  1   /* divide mm1 words by 2, Src1 low bytes */
00944                         psrlw mm2,  1   /* divide mm2 words by 2, Src1 high bytes */
00945                         pmullw mm1,  mm3        /* mul low  bytes of Src1 and Src2  */
00946                         pmullw mm2,  mm4        /* mul high bytes of Src1 and Src2 */
00947                         packuswb mm1,  mm2      /* pack words back into bytes with saturation */
00948                         movq [edi],  mm1        /* store result in Dest */
00949                         add eax,  8     /* increase Src1, Src2 and Dest  */
00950                         add ebx,  8     /* register pointers by 8 */
00951                         add edi,  8
00952                         dec ecx         /* decrease loop counter */
00953                         jnz L1015               /* check loop termination, proceed if required */
00954                         emms                    /* exit MMX state */
00955                         popa
00956         }
00957 #else
00958         /* i386 and x86_64 */
00959         __m64 *mSrc1 = (__m64*)Src1;
00960         __m64 *mSrc2 = (__m64*)Src2;
00961         __m64 *mDest = (__m64*)Dest;
00962         __m64 mm0 = _m_from_int(0); /* zero mm0 register */
00963         int i;
00964         for (i = 0; i < SrcLength/8; i++) {
00965                 __m64 mm1, mm2, mm3, mm4, mm5, mm6;
00966                 mm1 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
00967                 mm2 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
00968                 mm3 = _m_punpcklbw(*mSrc2, mm0);        /* unpack low  bytes of Src2 into words */
00969                 mm4 = _m_punpckhbw(*mSrc2, mm0);        /* unpack high bytes of Src2 into words */
00970                 mm1 = _m_psrlwi(mm1, 1);                /* divide mm1 words by 2, Src1 low bytes */
00971                 mm2 = _m_psrlwi(mm2, 1);                /* divide mm2 words by 2, Src1 high bytes */
00972                 mm1 = _m_pmullw(mm1, mm3);              /* mul low  bytes of Src1 and Src2  */
00973                 mm2 = _m_pmullw(mm2, mm4);              /* mul high bytes of Src1 and Src2 */
00974                 *mDest = _m_packuswb(mm1, mm2);         /* pack words back into bytes with saturation */
00975                 mSrc1++;
00976                 mSrc2++;
00977                 mDest++;
00978         }
00979         _m_empty();                                     /* clean MMX state */
00980 #endif
00981         return (0);
00982 #else
00983         return (-1);
00984 #endif
00985 }
00986 
00997 int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
00998 {
00999         unsigned int i, istart;
01000         unsigned char *cursrc1, *cursrc2, *curdst;
01001         int result;
01002 
01003         /* Validate input parameters */
01004         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01005                 return(-1);
01006         if (length == 0)
01007                 return(0);
01008 
01009         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01010                 /* MMX routine */
01011                 SDL_imageFilterMultDivby2MMX(Src1, Src2, Dest, length);
01012 
01013                 /* Check for unaligned bytes */
01014                 if ((length & 7) > 0) {
01015                         /* Setup to process unaligned bytes */
01016                         istart = length & 0xfffffff8;
01017                         cursrc1 = &Src1[istart];
01018                         cursrc2 = &Src2[istart];
01019                         curdst = &Dest[istart];
01020                 } else {
01021                         /* No unaligned bytes - we are done */
01022                         return (0);
01023                 }
01024         } else {
01025                 /* Setup to process whole image */
01026                 istart = 0;
01027                 cursrc1 = Src1;
01028                 cursrc2 = Src2;
01029                 curdst = Dest;
01030         }
01031 
01032         /* C routine to process image */
01033         for (i = istart; i < length; i++) {
01034                 result = ((int) *cursrc1 / 2) * (int) *cursrc2;
01035                 if (result > 255)
01036                         result = 255;
01037                 *curdst = (unsigned char) result;
01038                 /* Advance pointers */
01039                 cursrc1++;
01040                 cursrc2++;
01041                 curdst++;
01042         }
01043 
01044         return (0);
01045 }
01046 
01057 static int SDL_imageFilterMultDivby4MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01058 {
01059 #ifdef USE_MMX
01060 #if !defined(GCC__)
01061         __asm
01062         {
01063                 pusha
01064                         mov eax, Src1           /* load Src1 address into eax */
01065                         mov ebx, Src2           /* load Src2 address into ebx */
01066                         mov edi, Dest           /* load Dest address into edi */
01067                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01068                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01069                         pxor mm0, mm0           /* zero mm0 register */
01070                         align 16                /* 16 byte alignment of the loop entry */
01071 L1016:
01072                 movq mm1, [eax]         /* load 8 bytes from Src1 into mm1 */
01073                 movq mm3, [ebx]         /* load 8 bytes from Src2 into mm3 */
01074                 movq mm2, mm1           /* copy mm1 into mm2 */
01075                         movq mm4, mm3           /* copy mm3 into mm4  */
01076                         punpcklbw mm1, mm0      /* unpack low  bytes of Src1 into words */
01077                         punpckhbw mm2, mm0      /* unpack high bytes of Src1 into words */
01078                         punpcklbw mm3, mm0      /* unpack low  bytes of Src2 into words */
01079                         punpckhbw mm4, mm0      /* unpack high bytes of Src2 into words */
01080                         psrlw mm1, 1    /* divide mm1 words by 2, Src1 low bytes */
01081                         psrlw mm2, 1    /* divide mm2 words by 2, Src1 high bytes */
01082                         psrlw mm3, 1    /* divide mm3 words by 2, Src2 low bytes */
01083                         psrlw mm4, 1    /* divide mm4 words by 2, Src2 high bytes */
01084                         pmullw mm1, mm3         /* mul low  bytes of Src1 and Src2  */
01085                         pmullw mm2, mm4         /* mul high bytes of Src1 and Src2 */
01086                         packuswb mm1, mm2       /* pack words back into bytes with saturation */
01087                         movq [edi], mm1         /* store result in Dest */
01088                         add eax, 8      /* increase Src1, Src2 and Dest  */
01089                         add ebx, 8      /* register pointers by 8 */
01090                         add edi,  8
01091                         dec ecx         /* decrease loop counter */
01092                         jnz L1016               /* check loop termination, proceed if required */
01093                         emms                    /* exit MMX state */
01094                         popa
01095         }
01096 #else
01097         /* i386 and x86_64 */
01098         __m64 *mSrc1 = (__m64*)Src1;
01099         __m64 *mSrc2 = (__m64*)Src2;
01100         __m64 *mDest = (__m64*)Dest;
01101         __m64 mm0 = _m_from_int(0); /* zero mm0 register */
01102         int i;
01103         for (i = 0; i < SrcLength/8; i++) {
01104                 __m64 mm1, mm2, mm3, mm4, mm5, mm6;
01105                 mm1 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
01106                 mm2 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
01107                 mm3 = _m_punpcklbw(*mSrc2, mm0);        /* unpack low  bytes of Src2 into words */
01108                 mm4 = _m_punpckhbw(*mSrc2, mm0);        /* unpack high bytes of Src2 into words */
01109                 mm1 = _m_psrlwi(mm1, 1);                /* divide mm1 words by 2, Src1 low bytes */
01110                 mm2 = _m_psrlwi(mm2, 1);                /* divide mm2 words by 2, Src1 high bytes */
01111                 mm3 = _m_psrlwi(mm3, 1);                /* divide mm3 words by 2, Src2 low bytes */
01112                 mm4 = _m_psrlwi(mm4, 1);                /* divide mm4 words by 2, Src2 high bytes */
01113                 mm1 = _m_pmullw(mm1, mm3);              /* mul low  bytes of Src1 and Src2  */
01114                 mm2 = _m_pmullw(mm2, mm4);              /* mul high bytes of Src1 and Src2 */
01115                 *mDest = _m_packuswb(mm1, mm2);         /* pack words back into bytes with saturation */
01116                 mSrc1++;
01117                 mSrc2++;
01118                 mDest++;
01119         }
01120         _m_empty();                                     /* clean MMX state */
01121 #endif
01122         return (0);
01123 #else
01124         return (-1);
01125 #endif
01126 }
01127 
01138 int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01139 {
01140         unsigned int i, istart;
01141         unsigned char *cursrc1, *cursrc2, *curdst;
01142         int result;
01143 
01144         /* Validate input parameters */
01145         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01146                 return(-1);
01147         if (length == 0)
01148                 return(0);
01149 
01150         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01151                 /* MMX routine */
01152                 SDL_imageFilterMultDivby4MMX(Src1, Src2, Dest, length);
01153 
01154                 /* Check for unaligned bytes */
01155                 if ((length & 7) > 0) {
01156                         /* Setup to process unaligned bytes */
01157                         istart = length & 0xfffffff8;
01158                         cursrc1 = &Src1[istart];
01159                         cursrc2 = &Src2[istart];
01160                         curdst = &Dest[istart];
01161                 } else {
01162                         /* No unaligned bytes - we are done */
01163                         return (0);
01164                 }
01165         } else {
01166                 /* Setup to process whole image */
01167                 istart = 0;
01168                 cursrc1 = Src1;
01169                 cursrc2 = Src2;
01170                 curdst = Dest;
01171         }
01172 
01173         /* C routine to process image */
01174         for (i = istart; i < length; i++) {
01175                 result = ((int) *cursrc1 / 2) * ((int) *cursrc2 / 2);
01176                 if (result > 255)
01177                         result = 255;
01178                 *curdst = (unsigned char) result;
01179                 /* Advance pointers */
01180                 cursrc1++;
01181                 cursrc2++;
01182                 curdst++;
01183         }
01184 
01185         return (0);
01186 }
01187 
01198 static int SDL_imageFilterBitAndMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01199 {
01200 #ifdef USE_MMX
01201 #if !defined(GCC__)
01202         __asm
01203         {
01204                 pusha
01205                         mov eax, Src1           /* load Src1 address into eax */
01206                         mov ebx, Src2           /* load Src2 address into ebx */
01207                         mov edi, Dest           /* load Dest address into edi */
01208                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01209                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
01210                         align 16                /* 16 byte alignment of the loop entry */
01211 L1017:
01212                 movq mm1, [eax]         /* load 8 bytes from Src1 into mm1 */
01213                 pand mm1, [ebx]         /* mm1=Src1&Src2 */
01214                 movq [edi], mm1         /* store result in Dest */
01215                         add eax, 8      /* increase Src1, Src2 and Dest  */
01216                         add ebx, 8      /* register pointers by 8 */
01217                         add edi, 8
01218                         dec ecx         /* decrease loop counter */
01219                         jnz L1017               /* check loop termination, proceed if required */
01220                         emms                    /* exit MMX state */
01221                         popa
01222         }
01223 #else
01224         /* x86_64 ASM with constraints: */
01225         /* asm volatile ( */
01226         /*      "shr $3, %%rcx \n\t"    /\* counter/8 (MMX loads 8 bytes at a time) *\/ */
01227         /*      ".align 16       \n\t"  /\* 16 byte alignment of the loop entry *\/ */
01228         /*      "1: movq (%%rax), %%mm1 \n\t"   /\* load 8 bytes from Src1 into mm1 *\/ */
01229         /*      "pand    (%%rbx), %%mm1 \n\t"   /\* mm1=Src1&Src2 *\/ */
01230         /*      "movq    %%mm1, (%%rdi) \n\t"   /\* store result in Dest *\/ */
01231         /*      "add $8, %%rax \n\t"    /\* increase Src1, Src2 and Dest  *\/ */
01232         /*      "add $8, %%rbx \n\t"    /\* register pointers by 8 *\/ */
01233         /*      "add $8, %%rdi \n\t" */
01234         /*      "dec %%rcx     \n\t"    /\* decrease loop counter *\/ */
01235         /*      "jnz 1b        \n\t"    /\* check loop termination, proceed if required *\/ */
01236         /*      "emms          \n\t"    /\* exit MMX state *\/ */
01237         /*      : "+a" (Src1),          /\* load Src1 address into rax, modified by the loop *\/ */
01238         /*        "+b" (Src2),          /\* load Src2 address into rbx, modified by the loop *\/ */
01239         /*        "+c" (SrcLength),     /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */
01240         /*        "+D" (Dest)           /\* load Dest address into rdi, modified by the loop *\/ */
01241         /*      : */
01242         /*      : "memory",             /\* *Dest is modified *\/ */
01243         /*           "mm1"                      /\* register mm1 modified *\/ */
01244         /* ); */
01245 
01246         /* i386 and x86_64 */
01247         __m64 *mSrc1 = (__m64*)Src1;
01248         __m64 *mSrc2 = (__m64*)Src2;
01249         __m64 *mDest = (__m64*)Dest;
01250         int i;
01251         for (i = 0; i < SrcLength/8; i++) {
01252                 *mDest = _m_pand(*mSrc1, *mSrc2);       /* Src1&Src2 */
01253                 mSrc1++;
01254                 mSrc2++;
01255                 mDest++;
01256         }
01257         _m_empty();                                     /* clean MMX state */
01258 #endif
01259         return (0);
01260 #else
01261         return (-1);
01262 #endif
01263 }
01264 
01275 int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01276 {
01277         unsigned int i, istart;
01278         unsigned char *cursrc1, *cursrc2, *curdst;
01279 
01280         /* Validate input parameters */
01281         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01282                 return(-1);
01283         if (length == 0)
01284                 return(0);
01285 
01286         if ((SDL_imageFilterMMXdetect()>0) && (length>7)) {
01287                 /*  if (length > 7) { */
01288                 /* Call MMX routine */
01289 
01290                 SDL_imageFilterBitAndMMX(Src1, Src2, Dest, length);
01291 
01292                 /* Check for unaligned bytes */
01293                 if ((length & 7) > 0) {
01294 
01295                         /* Setup to process unaligned bytes */
01296                         istart = length & 0xfffffff8;
01297                         cursrc1 = &Src1[istart];
01298                         cursrc2 = &Src2[istart];
01299                         curdst = &Dest[istart];
01300                 } else {
01301                         /* No unaligned bytes - we are done */
01302                         return (0);
01303                 }
01304         } else {
01305                 /* Setup to process whole image */
01306                 istart = 0;
01307                 cursrc1 = Src1;
01308                 cursrc2 = Src2;
01309                 curdst = Dest;
01310         }
01311 
01312         /* C routine to process image */
01313         for (i = istart; i < length; i++) {
01314                 *curdst = (*cursrc1) & (*cursrc2);
01315                 /* Advance pointers */
01316                 cursrc1++;
01317                 cursrc2++;
01318                 curdst++;
01319         }
01320 
01321         return (0);
01322 }
01323 
01334 static int SDL_imageFilterBitOrMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01335 {
01336 #ifdef USE_MMX
01337 #if !defined(GCC__)
01338         __asm
01339         {
01340                 pusha
01341                         mov eax, Src1           /* load Src1 address into eax */
01342                         mov ebx, Src2           /* load Src2 address into ebx */
01343                         mov edi, Dest           /* load Dest address into edi */
01344                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01345                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01346                         align 16                /* 16 byte alignment of the loop entry */
01347 L91017:
01348                 movq mm1, [eax]         /* load 8 bytes from Src1 into mm1 */
01349                 por mm1, [ebx]          /* mm1=Src1|Src2 */
01350                 movq [edi], mm1         /* store result in Dest */
01351                         add eax, 8      /* increase Src1, Src2 and Dest  */
01352                         add ebx, 8      /* register pointers by 8 */
01353                         add edi,  8
01354                         dec ecx         /* decrease loop counter */
01355                         jnz L91017              /* check loop termination, proceed if required */
01356                         emms                    /* exit MMX state */
01357                         popa
01358         }
01359 #else
01360         /* i386 and x86_64 */
01361         __m64 *mSrc1 = (__m64*)Src1;
01362         __m64 *mSrc2 = (__m64*)Src2;
01363         __m64 *mDest = (__m64*)Dest;
01364         int i;
01365         for (i = 0; i < SrcLength/8; i++) {
01366                 *mDest = _m_por(*mSrc1, *mSrc2);        /* Src1|Src2 */
01367                 mSrc1++;
01368                 mSrc2++;
01369                 mDest++;
01370         }
01371         _m_empty();                                     /* clean MMX state */
01372 #endif
01373         return (0);
01374 #else
01375         return (-1);
01376 #endif
01377 }
01378 
01389 int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01390 {
01391         unsigned int i, istart;
01392         unsigned char *cursrc1, *cursrc2, *curdst;
01393 
01394         /* Validate input parameters */
01395         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01396                 return(-1);
01397         if (length == 0)
01398                 return(0);
01399 
01400         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01401 
01402                 /* MMX routine */
01403                 SDL_imageFilterBitOrMMX(Src1, Src2, Dest, length);
01404 
01405                 /* Check for unaligned bytes */
01406                 if ((length & 7) > 0) {
01407                         /* Setup to process unaligned bytes */
01408                         istart = length & 0xfffffff8;
01409                         cursrc1 = &Src1[istart];
01410                         cursrc2 = &Src2[istart];
01411                         curdst = &Dest[istart];
01412                 } else {
01413                         /* No unaligned bytes - we are done */
01414                         return (0);
01415                 }
01416         } else {
01417                 /* Setup to process whole image */
01418                 istart = 0;
01419                 cursrc1 = Src1;
01420                 cursrc2 = Src2;
01421                 curdst = Dest;
01422         }
01423 
01424         /* C routine to process image */
01425         for (i = istart; i < length; i++) {
01426                 *curdst = *cursrc1 | *cursrc2;
01427                 /* Advance pointers */
01428                 cursrc1++;
01429                 cursrc2++;
01430                 curdst++;
01431         }
01432         return (0);
01433 }
01434 
01445 static int SDL_imageFilterDivASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
01446 {
01447 #ifdef USE_MMX
01448 #if !defined(GCC__)
01449         __asm
01450         {
01451                 pusha
01452                         mov edx, Src1           /* load Src1 address into edx */
01453                         mov esi, Src2           /* load Src2 address into esi */
01454                         mov edi, Dest           /* load Dest address into edi */
01455                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01456                         align 16                /* 16 byte alignment of the loop entry */
01457 L10191:
01458                 mov bl, [esi]           /* load a byte from Src2 */
01459                 cmp bl, 0       /* check if it zero */
01460                         jnz L10192
01461                         mov [edi], 255          /* division by zero = 255 !!! */
01462                         jmp  L10193
01463 L10192:
01464                 xor ah, ah      /* prepare AX, zero AH register */
01465                         mov al, [edx]           /* load a byte from Src1 into AL */
01466                 div   bl                /* divide AL by BL */
01467                         mov [edi], al           /* move a byte result to Dest */
01468 L10193:
01469                 inc edx         /* increment Src1, Src2, Dest */
01470                         inc esi                 /* pointer registers by one */
01471                         inc edi
01472                         dec ecx         /* decrease loop counter */
01473                         jnz L10191      /* check loop termination, proceed if required */
01474                         popa
01475         }
01476 #else
01477         /* Note: ~15% gain on i386, less efficient than C on x86_64 */
01478         /* Also depends on whether the function is static (?!) */
01479         /* Also depends on whether we work on malloc() or static char[] */
01480         asm volatile (
01481 #  if defined(i386)
01482                 "pushl %%ebx \n\t"              /* %ebx may be the PIC register.  */
01483                 ".align 16     \n\t"            /* 16 byte alignment of the loop entry */
01484                 "1: mov (%%esi), %%bl  \n\t"    /* load a byte from Src2 */
01485                 "cmp       $0, %%bl    \n\t"    /* check if it zero */
01486                 "jnz 2f                \n\t"
01487                 "movb  $255, (%%edi)   \n\t"    /* division by zero = 255 !!! */
01488                 "jmp 3f                \n\t"
01489                 "2: xor %%ah, %%ah     \n\t"    /* prepare AX, zero AH register */
01490                 "mov   (%%edx), %%al   \n\t"    /* load a byte from Src1 into AL */
01491                 "div   %%bl            \n\t"    /* divide AL by BL */
01492                 "mov   %%al, (%%edi)   \n\t"    /* move a byte result to Dest */
01493                 "3: inc %%edx          \n\t"    /* increment Src1, Src2, Dest */
01494                 "inc %%esi \n\t"                /* pointer registers by one */
01495                 "inc %%edi \n\t"
01496                 "dec %%ecx \n\t"                /* decrease loop counter */
01497                 "jnz 1b    \n\t"                /* check loop termination, proceed if required */
01498                 "popl %%ebx \n\t"               /* restore %ebx */
01499                 : "+d" (Src1),          /* load Src1 address into edx */
01500                   "+S" (Src2),          /* load Src2 address into esi */
01501                   "+c" (SrcLength),     /* load loop counter (SIZE) into ecx */
01502                   "+D" (Dest)           /* load Dest address into edi */
01503                 :
01504                 : "memory", "rax"
01505 #  elif defined(__x86_64__)
01506                 ".align 16     \n\t"            /* 16 byte alignment of the loop entry */
01507                 "1: mov (%%rsi), %%bl  \n\t"    /* load a byte from Src2 */
01508                 "cmp       $0, %%bl    \n\t"    /* check if it zero */
01509                 "jnz 2f                \n\t"
01510                 "movb  $255, (%%rdi)   \n\t"    /* division by zero = 255 !!! */
01511                 "jmp 3f                \n\t"
01512                 "2: xor %%ah, %%ah     \n\t"    /* prepare AX, zero AH register */
01513                 "mov   (%%rdx), %%al   \n\t"    /* load a byte from Src1 into AL */
01514                 "div   %%bl            \n\t"    /* divide AL by BL */
01515                 "mov   %%al, (%%rdi)   \n\t"    /* move a byte result to Dest */
01516                 "3: inc %%rdx          \n\t"    /* increment Src1, Src2, Dest */
01517                 "inc %%rsi \n\t"                /* pointer registers by one */
01518                 "inc %%rdi \n\t"
01519                 "dec %%rcx \n\t"                /* decrease loop counter */
01520                 "jnz 1b    \n\t"                /* check loop termination, proceed if required */
01521                 : "+d" (Src1),          /* load Src1 address into edx */
01522                   "+S" (Src2),          /* load Src2 address into esi */
01523                   "+c" (SrcLength),     /* load loop counter (SIZE) into ecx */
01524                   "+D" (Dest)           /* load Dest address into edi */
01525                 :
01526                 : "memory", "rax", "rbx"
01527 #  endif
01528                 );
01529 #endif
01530         return (0);
01531 #else
01532         return (-1);
01533 #endif
01534 }
01535 
01546 int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
01547 {
01548         unsigned int i, istart;
01549         unsigned char *cursrc1, *cursrc2, *curdst;
01550 
01551         /* Validate input parameters */
01552         if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
01553                 return(-1);
01554         if (length == 0)
01555                 return(0);
01556 
01557         if (SDL_imageFilterMMXdetect()) {
01558                 if (length > 0) {
01559                         /* Call ASM routine */
01560                         SDL_imageFilterDivASM(Src1, Src2, Dest, length);
01561 
01562                         /* Never unaligned bytes - we are done */
01563                         return (0);
01564                 } else {
01565                         return (-1);
01566                 }
01567         } 
01568         
01569         /* Setup to process whole image */
01570         istart = 0;
01571         cursrc1 = Src1;
01572         cursrc2 = Src2;
01573         curdst = Dest;
01574 
01575         /* C routine to process image */
01576         /* for (i = istart; i < length; i++) { */
01577         /*      if (*cursrc2 == 0) { */
01578         /*              *curdst = 255; */
01579         /*      } else { */
01580         /*              result = (int) *cursrc1 / (int) *cursrc2; */
01581         /*              *curdst = (unsigned char) result; */
01582         /*      } */
01583         /*      /\* Advance pointers *\/ */
01584         /*      cursrc1++; */
01585         /*      cursrc2++; */
01586         /*      curdst++; */
01587         /* } */
01588         for (i = istart; i < length; i++) {
01589                 if (*cursrc2 == 0) {
01590                         *curdst = 255;
01591                 } else {
01592                         *curdst = (int)*cursrc1 / (int)*cursrc2;  // (int) for efficiency
01593                 }
01594                 /* Advance pointers */
01595                 cursrc1++;
01596                 cursrc2++;
01597                 curdst++;
01598         }
01599 
01600         return (0);
01601 }
01602 
01603 /* ------------------------------------------------------------------------------------ */
01604 
01614 static int SDL_imageFilterBitNegationMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength)
01615 {
01616 #ifdef USE_MMX
01617 #if !defined(GCC__)
01618         __asm
01619         {
01620                 pusha
01621                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
01622                         mov eax, Src1           /* load Src1 address into eax */
01623                         mov edi, Dest           /* load Dest address into edi */
01624                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01625                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01626                         align 16                /* 16 byte alignment of the loop entry */
01627 L91117:
01628                 movq mm0, [eax]         /* load 8 bytes from Src1 into mm1 */
01629                 pxor mm0, mm1           /* negate mm0 by xoring with mm1 */
01630                         movq [edi], mm0         /* store result in Dest */
01631                         add eax, 8      /* increase Src1, Src2 and Dest  */
01632                         add edi,  8
01633                         dec ecx         /* decrease loop counter */
01634                         jnz L91117              /* check loop termination, proceed if required */
01635                         emms                    /* exit MMX state */
01636                         popa
01637         }
01638 #else
01639         /* i386 and x86_64 */
01640         __m64 *mSrc1 = (__m64*)Src1;
01641         __m64 *mDest = (__m64*)Dest;
01642         __m64 mm1;
01643         mm1 = _m_pcmpeqb(mm1, mm1);             /* generate all 1's in mm1 */
01644         int i;
01645         for (i = 0; i < SrcLength/8; i++) {
01646                 *mDest = _m_pxor(*mSrc1, mm1);  /* negate mm0 by xoring with mm1 */
01647                 mSrc1++;
01648                 mDest++;
01649         }
01650         _m_empty();                             /* clean MMX state */
01651 
01652 #endif
01653         return (0);
01654 #else
01655         return (-1);
01656 #endif
01657 }
01658 
01668 int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length)
01669 {
01670         unsigned int i, istart;
01671         unsigned char *cursrc1, *curdst;
01672 
01673         /* Validate input parameters */
01674         if ((Src1 == NULL) || (Dest == NULL))
01675                 return(-1);
01676         if (length == 0)
01677                 return(0);
01678 
01679         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01680                 /* MMX routine */
01681                 SDL_imageFilterBitNegationMMX(Src1, Dest, length);
01682 
01683                 /* Check for unaligned bytes */
01684                 if ((length & 7) > 0) {
01685                         /* Setup to process unaligned bytes */
01686                         istart = length & 0xfffffff8;
01687                         cursrc1 = &Src1[istart];
01688                         curdst = &Dest[istart];
01689                 } else {
01690                         /* No unaligned bytes - we are done */
01691                         return (0);
01692                 }
01693         } else {
01694                 /* Setup to process whole image */
01695                 istart = 0;
01696                 cursrc1 = Src1;
01697                 curdst = Dest;
01698         }
01699 
01700         /* C routine to process image */
01701         for (i = istart; i < length; i++) {
01702                 *curdst = ~(*cursrc1);
01703                 /* Advance pointers */
01704                 cursrc1++;
01705                 curdst++;
01706         }
01707 
01708         return (0);
01709 }
01710 
01721 static int SDL_imageFilterAddByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
01722 {
01723 #ifdef USE_MMX
01724 #if !defined(GCC__)
01725         __asm
01726         {
01727                 pusha
01728                         /* ** Duplicate C in 8 bytes of MM1 ** */
01729                         mov al, C       /* load C into AL */
01730                         mov ah, al      /* copy AL into AH */
01731                         mov bx, ax      /* copy AX into BX */
01732                         shl eax, 16     /* shift 2 bytes of EAX left */
01733                         mov ax, bx      /* copy BX into AX */
01734                         movd mm1, eax           /* copy EAX into MM1 */
01735                         movd mm2, eax           /* copy EAX into MM2 */
01736                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
01737                         mov eax, Src1           /* load Src1 address into eax */
01738                         mov edi, Dest           /* load Dest address into edi */
01739                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01740                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01741                         align 16                        /* 16 byte alignment of the loop entry */
01742 L1021:
01743                 movq mm0, [eax]         /* load 8 bytes from Src1 into MM0 */
01744                 paddusb mm0,  mm1       /* MM0=SrcDest+C (add 8 bytes with saturation) */
01745                         movq [edi], mm0         /* store result in Dest */
01746                         add eax, 8      /* increase Dest register pointer by 8 */
01747                         add edi, 8      /* increase Dest register pointer by 8 */
01748                         dec              ecx            /* decrease loop counter */
01749                         jnz             L1021           /* check loop termination, proceed if required */
01750                         emms                            /* exit MMX state */
01751                         popa
01752         }
01753 #else
01754         /* i386 and x86_64 */
01755         __m64 *mSrc1 = (__m64*)Src1;
01756         __m64 *mDest = (__m64*)Dest;
01757         /* Duplicate C in 8 bytes of MM1 */
01758         int i;
01759         memset(&i, C, 4);
01760         __m64 mm1 = _m_from_int(i);
01761         __m64 mm2 = _m_from_int(i);
01762         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
01763         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
01764         for (i = 0; i < SrcLength/8; i++) {
01765                 *mDest = _m_paddusb(*mSrc1, mm1);       /* Src1+C (add 8 bytes with saturation) */
01766                 mSrc1++;
01767                 mDest++;
01768         }
01769         _m_empty();                                     /* clean MMX state */
01770 #endif
01771         return (0);
01772 #else
01773         return (-1);
01774 #endif
01775 }
01776 
01788 int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
01789 {
01790         unsigned int i, istart;
01791         int iC;
01792         unsigned char *cursrc1, *curdest;
01793         int result;
01794 
01795         /* Validate input parameters */
01796         if ((Src1 == NULL) || (Dest == NULL))
01797                 return(-1);
01798         if (length == 0)
01799                 return(0);
01800 
01801         /* Special case: C==0 */
01802         if (C == 0) {
01803                 memcpy(Src1, Dest, length);
01804                 return (0); 
01805         }
01806 
01807         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01808 
01809                 /* MMX routine */
01810                 SDL_imageFilterAddByteMMX(Src1, Dest, length, C);
01811 
01812                 /* Check for unaligned bytes */
01813                 if ((length & 7) > 0) {
01814                         /* Setup to process unaligned bytes */
01815                         istart = length & 0xfffffff8;
01816                         cursrc1 = &Src1[istart];
01817                         curdest = &Dest[istart];
01818                 } else {
01819                         /* No unaligned bytes - we are done */
01820                         return (0);
01821                 }
01822         } else {
01823                 /* Setup to process whole image */
01824                 istart = 0;
01825                 cursrc1 = Src1;
01826                 curdest = Dest;
01827         }
01828 
01829         /* C routine to process image */
01830         iC = (int) C;
01831         for (i = istart; i < length; i++) {
01832                 result = (int) *cursrc1 + iC;
01833                 if (result > 255)
01834                         result = 255;
01835                 *curdest = (unsigned char) result;
01836                 /* Advance pointers */
01837                 cursrc1++;
01838                 curdest++;
01839         }
01840         return (0);
01841 }
01842 
01854 static int SDL_imageFilterAddUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D)
01855 {
01856 #ifdef USE_MMX
01857 #if !defined(GCC__)
01858         __asm
01859         {
01860                 pusha
01861                         /* ** Duplicate (int)C in 8 bytes of MM1 ** */
01862                         mov eax, C      /* load C into EAX */
01863                         movd mm1, eax           /* copy EAX into MM1 */
01864                         mov eax, D      /* load D into EAX */
01865                         movd mm2, eax           /* copy EAX into MM2 */
01866                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
01867                         mov eax, Src1           /* load Src1 address into eax */
01868                         mov edi, Dest           /* load Dest address into edi */
01869                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
01870                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
01871                         align 16                        /* 16 byte alignment of the loop entry */
01872 L11023:
01873                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
01874                 paddusb mm0,  mm1       /* MM0=SrcDest+C (add 8 bytes with saturation) */
01875                         movq [edi],  mm0        /* store result in SrcDest */
01876                         add eax, 8      /* increase Src1 register pointer by 8 */
01877                         add edi, 8      /* increase Dest register pointer by 8 */
01878                         dec              ecx            /* decrease loop counter */
01879                         jnz             L11023          /* check loop termination, proceed if required */
01880                         emms                            /* exit MMX state */
01881                         popa
01882         }
01883 #else
01884         /* i386 and x86_64 */
01885         __m64 *mSrc1 = (__m64*)Src1;
01886         __m64 *mDest = (__m64*)Dest;
01887         /* Duplicate (int)C in 8 bytes of MM1 */
01888         __m64 mm1 = _m_from_int(C);
01889         __m64 mm2 = _m_from_int(C);
01890         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
01891         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
01892         int i;
01893         for (i = 0; i < SrcLength/8; i++) {
01894                 *mDest = _m_paddusb(*mSrc1, mm1);       /* Src1+C (add 8 bytes with saturation) */
01895                 mSrc1++;
01896                 mDest++;
01897         }
01898         _m_empty();                                     /* clean MMX state */
01899 #endif
01900         return (0);
01901 #else
01902         return (-1);
01903 #endif
01904 }
01905 
01916 int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
01917 {
01918         unsigned int i, j, istart, D;
01919         int iC[4];
01920         unsigned char *cursrc1;
01921         unsigned char *curdest;
01922         int result;
01923 
01924         /* Validate input parameters */
01925         if ((Src1 == NULL) || (Dest == NULL))
01926                 return(-1);
01927         if (length == 0)
01928                 return(0);
01929 
01930         /* Special case: C==0 */
01931         if (C == 0) {
01932                 memcpy(Src1, Dest, length);
01933                 return (0); 
01934         }
01935 
01936         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
01937 
01938                 /* MMX routine */
01939                 D=SWAP_32(C);
01940                 SDL_imageFilterAddUintMMX(Src1, Dest, length, C, D);
01941 
01942                 /* Check for unaligned bytes */
01943                 if ((length & 7) > 0) {
01944                         /* Setup to process unaligned bytes */
01945                         istart = length & 0xfffffff8;
01946                         cursrc1 = &Src1[istart];
01947                         curdest = &Dest[istart];
01948                 } else {
01949                         /* No unaligned bytes - we are done */
01950                         return (0);
01951                 }
01952         } else {
01953                 /* Setup to process whole image */
01954                 istart = 0;
01955                 cursrc1 = Src1;
01956                 curdest = Dest;
01957         }
01958 
01959         /* C routine to process bytes */
01960         iC[3] = (int) ((C >> 24) & 0xff);
01961         iC[2] = (int) ((C >> 16) & 0xff);
01962         iC[1] = (int) ((C >>  8) & 0xff);
01963         iC[0] = (int) ((C >>  0) & 0xff);
01964         for (i = istart; i < length; i += 4) {
01965                 for (j = 0; j < 4; j++) {
01966                         if ((i+j)<length) {
01967                                 result = (int) *cursrc1 + iC[j];
01968                                 if (result > 255) result = 255;
01969                                 *curdest = (unsigned char) result;
01970                                 /* Advance pointers */
01971                                 cursrc1++;
01972                                 curdest++;
01973                         }
01974                 }
01975         }
01976         return (0);
01977 }
01978 
01990 static int SDL_imageFilterAddByteToHalfMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C,
01991                                                                         unsigned char *Mask)
01992 {
01993 #ifdef USE_MMX
01994 #if !defined(GCC__)
01995         __asm
01996         {
01997                 pusha
01998                         /* ** Duplicate C in 8 bytes of MM1 ** */
01999                         mov al, C       /* load C into AL */
02000                         mov ah, al      /* copy AL into AH */
02001                         mov bx, ax      /* copy AX into BX */
02002                         shl eax, 16     /* shift 2 bytes of EAX left */
02003                         mov ax, bx      /* copy BX into AX */
02004                         movd mm1, eax           /* copy EAX into MM1 */
02005                         movd mm2, eax           /* copy EAX into MM2 */
02006                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
02007                         mov edx, Mask           /* load Mask address into edx */
02008                         movq mm0, [edx]         /* load Mask into mm0 */
02009                 mov eax, Src1           /* load Src1 address into eax */
02010                         mov edi, Dest           /* load Dest address into edi */
02011                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02012                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02013                         align 16                        /* 16 byte alignment of the loop entry */
02014 L1022:
02015                 movq mm2, [eax]         /* load 8 bytes from Src1 into MM2 */
02016                 psrlw mm2, 1    /* shift 4 WORDS of MM2 1 bit to the right */
02017                         pand mm2, mm0        // apply Mask to 8 BYTES of MM2 */
02018                         paddusb mm2,  mm1       /* MM2=SrcDest+C (add 8 bytes with saturation) */
02019                         movq [edi], mm2         /* store result in Dest */
02020                         add eax, 8      /* increase Src1 register pointer by 8 */
02021                         add edi, 8      /* increase Dest register pointer by 8 */
02022                         dec              ecx            /* decrease loop counter */
02023                         jnz             L1022           /* check loop termination, proceed if required */
02024                         emms                            /* exit MMX state */
02025                         popa
02026         }
02027 #else
02028         /* i386 and x86_64 */
02029         __m64 *mSrc1 = (__m64*)Src1;
02030         __m64 *mDest = (__m64*)Dest;
02031         __m64 *mMask = (__m64*)Mask;
02032         /* Duplicate C in 8 bytes of MM1 */
02033         int i;
02034         memset(&i, C, 4);
02035         __m64 mm1 = _m_from_int(i);
02036         __m64 mm2 = _m_from_int(i);
02037         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
02038         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02039         for (i = 0; i < SrcLength/8; i++) {
02040                 __m64 mm2 = _m_psrlwi(*mSrc1, 1);       /* shift 4 WORDS of MM2 1 bit to the right */
02041                 mm2 = _m_pand(mm2, *mMask);             /* apply Mask to 8 BYTES of MM2 */
02042                                                         /* byte     0x0f, 0xdb, 0xd0 */
02043                 *mDest = _m_paddusb(mm1, mm2);          /* Src1+C (add 8 bytes with saturation) */
02044                 mSrc1++;
02045                 mDest++;
02046         }
02047         _m_empty();                                     /* clean MMX state */
02048 #endif
02049         return (0);
02050 #else
02051         return (-1);
02052 #endif
02053 }
02054 
02065 int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
02066 {
02067         static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
02068         unsigned int i, istart;
02069         int iC;
02070         unsigned char *cursrc1;
02071         unsigned char *curdest;
02072         int result;
02073 
02074         /* Validate input parameters */
02075         if ((Src1 == NULL) || (Dest == NULL))
02076                 return(-1);
02077         if (length == 0)
02078                 return(0);
02079 
02080         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02081 
02082                 /* MMX routine */
02083                 SDL_imageFilterAddByteToHalfMMX(Src1, Dest, length, C, Mask);
02084 
02085                 /* Check for unaligned bytes */
02086                 if ((length & 7) > 0) {
02087                         /* Setup to process unaligned bytes */
02088                         istart = length & 0xfffffff8;
02089                         cursrc1 = &Src1[istart];
02090                         curdest = &Dest[istart];
02091                 } else {
02092                         /* No unaligned bytes - we are done */
02093                         return (0);
02094                 }
02095         } else {
02096                 /* Setup to process whole image */
02097                 istart = 0;
02098                 cursrc1 = Src1;
02099                 curdest = Dest;
02100         }
02101 
02102         /* C routine to process image */
02103         iC = (int) C;
02104         for (i = istart; i < length; i++) {
02105                 result = (int) (*cursrc1 / 2) + iC;
02106                 if (result > 255)
02107                         result = 255;
02108                 *curdest = (unsigned char) result;
02109                 /* Advance pointers */
02110                 cursrc1++;
02111                 curdest++;
02112         }
02113 
02114         return (0);
02115 }
02116 
02127 int SDL_imageFilterSubByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
02128 {
02129 #ifdef USE_MMX
02130 #if !defined(GCC__)
02131         __asm
02132         {
02133                 pusha
02134                         /* ** Duplicate C in 8 bytes of MM1 ** */
02135                         mov al, C       /* load C into AL */
02136                         mov ah, al      /* copy AL into AH */
02137                         mov bx, ax      /* copy AX into BX */
02138                         shl eax, 16     /* shift 2 bytes of EAX left */
02139                         mov ax, bx      /* copy BX into AX */
02140                         movd mm1, eax           /* copy EAX into MM1 */
02141                         movd mm2, eax           /* copy EAX into MM2 */
02142                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
02143                         mov eax, Src1           /* load Src1 address into eax */
02144                         mov edi, Dest           /* load Dest address into edi */
02145                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02146                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02147                         align 16                        /* 16 byte alignment of the loop entry */
02148 L1023:
02149                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02150                 psubusb mm0,  mm1       /* MM0=SrcDest-C (sub 8 bytes with saturation) */
02151                         movq [edi], mm0         /* store result in SrcDest */
02152                         add eax, 8      /* increase Src1 register pointer by 8 */
02153                         add edi, 8      /* increase Dest register pointer by 8 */
02154                         dec              ecx            /* decrease loop counter */
02155                         jnz             L1023           /* check loop termination, proceed if required */
02156                         emms                            /* exit MMX state */
02157                         popa
02158         }
02159 #else
02160         /* i386 and x86_64 */
02161         __m64 *mSrc1 = (__m64*)Src1;
02162         __m64 *mDest = (__m64*)Dest;
02163         /* Duplicate C in 8 bytes of MM1 */
02164         int i;
02165         memset(&i, C, 4);
02166         __m64 mm1 = _m_from_int(i);
02167         __m64 mm2 = _m_from_int(i);
02168         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
02169         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02170         for (i = 0; i < SrcLength/8; i++) {
02171                 *mDest = _m_psubusb(*mSrc1, mm1);       /* Src1-C (sub 8 bytes with saturation) */
02172                 mSrc1++;
02173                 mDest++;
02174         }
02175         _m_empty();                                     /* clean MMX state */
02176 #endif
02177         return (0);
02178 #else
02179         return (-1);
02180 #endif
02181 }
02182 
02193 int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
02194 {
02195         unsigned int i, istart;
02196         int iC;
02197         unsigned char *cursrc1;
02198         unsigned char *curdest;
02199         int result;
02200 
02201         /* Validate input parameters */
02202         if ((Src1 == NULL) || (Dest == NULL))
02203                 return(-1);
02204         if (length == 0)
02205                 return(0);
02206 
02207         /* Special case: C==0 */
02208         if (C == 0) {
02209                 memcpy(Src1, Dest, length);
02210                 return (0); 
02211         }
02212 
02213         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02214 
02215                 /* MMX routine */
02216                 SDL_imageFilterSubByteMMX(Src1, Dest, length, C);
02217 
02218                 /* Check for unaligned bytes */
02219                 if ((length & 7) > 0) {
02220                         /* Setup to process unaligned bytes */
02221                         istart = length & 0xfffffff8;
02222                         cursrc1 = &Src1[istart];
02223                         curdest = &Dest[istart];
02224                 } else {
02225                         /* No unaligned bytes - we are done */
02226                         return (0);
02227                 }
02228         } else {
02229                 /* Setup to process whole image */
02230                 istart = 0;
02231                 cursrc1 = Src1;
02232                 curdest = Dest;
02233         }
02234 
02235         /* C routine to process image */
02236         iC = (int) C;
02237         for (i = istart; i < length; i++) {
02238                 result = (int) *cursrc1 - iC;
02239                 if (result < 0)
02240                         result = 0;
02241                 *curdest = (unsigned char) result;
02242                 /* Advance pointers */
02243                 cursrc1++;
02244                 curdest++;
02245         }
02246         return (0);
02247 }
02248 
02260 static int SDL_imageFilterSubUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D)
02261 {
02262 #ifdef USE_MMX
02263 #if !defined(GCC__)
02264         __asm
02265         {
02266                 pusha
02267                         /* ** Duplicate (int)C in 8 bytes of MM1 ** */
02268                         mov eax, C      /* load C into EAX */
02269                         movd mm1, eax           /* copy EAX into MM1 */
02270                         mov eax, D      /* load D into EAX */
02271                         movd mm2, eax           /* copy EAX into MM2 */
02272                         punpckldq mm1, mm2      /* fill higher bytes of MM1 with C */
02273                         mov eax, Src1           /* load Src1 address into eax */
02274                         mov edi, Dest           /* load Dest address into edi */
02275                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02276                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02277                         align 16                        /* 16 byte alignment of the loop entry */
02278 L11024:
02279                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02280                 psubusb mm0, mm1        /* MM0=SrcDest-C (sub 8 bytes with saturation) */
02281                         movq [edi], mm0         /* store result in SrcDest */
02282                         add eax, 8      /* increase Src1 register pointer by 8 */
02283                         add edi, 8      /* increase Dest register pointer by 8 */
02284                         dec              ecx            /* decrease loop counter */
02285                         jnz             L11024          /* check loop termination, proceed if required */
02286                         emms                            /* exit MMX state */
02287                         popa
02288         }
02289 #else
02290         /* i386 and x86_64 */
02291         __m64 *mSrc1 = (__m64*)Src1;
02292         __m64 *mDest = (__m64*)Dest;
02293         /* Duplicate (int)C in 8 bytes of MM1 */
02294         __m64 mm1 = _m_from_int(C);
02295         __m64 mm2 = _m_from_int(C);
02296         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher bytes of MM1 with C */
02297         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02298         int i;
02299         for (i = 0; i < SrcLength/8; i++) {
02300                 *mDest = _m_psubusb(*mSrc1, mm1);       /* Src1-C (sub 8 bytes with saturation) */
02301                 mSrc1++;
02302                 mDest++;
02303         }
02304         _m_empty();                                     /* clean MMX state */
02305 #endif
02306         return (0);
02307 #else
02308         return (-1);
02309 #endif
02310 }
02311 
02322 int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
02323 {
02324         unsigned int i, j, istart, D;
02325         int iC[4];
02326         unsigned char *cursrc1;
02327         unsigned char *curdest;
02328         int result;
02329 
02330         /* Validate input parameters */
02331         if ((Src1 == NULL) || (Dest == NULL))
02332                 return(-1);
02333         if (length == 0)
02334                 return(0);
02335 
02336     /* Special case: C==0 */
02337         if (C == 0) {
02338                 memcpy(Src1, Dest, length);
02339                 return (0); 
02340         }
02341 
02342         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02343 
02344                 /* MMX routine */
02345                 D=SWAP_32(C);
02346                 SDL_imageFilterSubUintMMX(Src1, Dest, length, C, D);
02347 
02348                 /* Check for unaligned bytes */
02349                 if ((length & 7) > 0) {
02350                         /* Setup to process unaligned bytes */
02351                         istart = length & 0xfffffff8;
02352                         cursrc1 = &Src1[istart];
02353                         curdest = &Dest[istart];
02354                 } else {
02355                         /* No unaligned bytes - we are done */
02356                         return (0);
02357                 }
02358         } else {
02359                 /* Setup to process whole image */
02360                 istart = 0;
02361                 cursrc1 = Src1;
02362                 curdest = Dest;
02363         }
02364 
02365         /* C routine to process image */
02366         iC[3] = (int) ((C >> 24) & 0xff);
02367         iC[2] = (int) ((C >> 16) & 0xff);
02368         iC[1] = (int) ((C >>  8) & 0xff);
02369         iC[0] = (int) ((C >>  0) & 0xff);
02370         for (i = istart; i < length; i += 4) {
02371                 for (j = 0; j < 4; j++) {
02372                         if ((i+j)<length) {
02373                                 result = (int) *cursrc1 - iC[j];
02374                                 if (result < 0) result = 0;
02375                                 *curdest = (unsigned char) result;
02376                                 /* Advance pointers */
02377                                 cursrc1++;
02378                                 curdest++;
02379                         }
02380                 }
02381         }
02382         return (0);
02383 }
02384 
02396 static int SDL_imageFilterShiftRightMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
02397                                                                  unsigned char *Mask)
02398 {
02399 #ifdef USE_MMX
02400 #if !defined(GCC__)
02401         __asm
02402         {
02403                 pusha
02404                         mov edx, Mask           /* load Mask address into edx */
02405                         movq mm0, [edx]         /* load Mask into mm0 */
02406                 xor ecx, ecx    /* zero ECX */
02407                         mov cl,  N      /* load loop counter (N) into CL */
02408                         movd mm3,  ecx  /* copy (N) into MM3  */
02409                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
02410 L10240:                         /* ** Prepare proper bit-Mask in MM1 ** */
02411                 psrlw mm1,  1   /* shift 4 WORDS of MM1 1 bit to the right */
02412                         pand mm1, mm0   // apply Mask to 8 BYTES of MM1 */
02413                         /*  byte     0x0f, 0xdb, 0xc8 */
02414                         dec               cl            /* decrease loop counter */
02415                         jnz            L10240           /* check loop termination, proceed if required */
02416                         /* ** Shift all bytes of the image ** */
02417                         mov eax, Src1           /* load Src1 address into eax */
02418                         mov edi, Dest           /* load Dest address into edi */
02419                         mov ecx,  SrcLength     /* load loop counter (SIZE) into ecx */
02420                         shr ecx,  3     /* counter/8 (MMX loads 8 bytes at a time) */
02421                         align 16                        /* 16 byte alignment of the loop entry */
02422 L10241:
02423                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02424                 psrlw mm0, mm3          /* shift 4 WORDS of MM0 (N) bits to the right */
02425                         pand mm0, mm1    // apply proper bit-Mask to 8 BYTES of MM0 */
02426                         /* byte     0x0f, 0xdb, 0xc1 */
02427                         movq [edi], mm0         /* store result in SrcDest */
02428                         add eax, 8      /* increase Src1 register pointer by 8 */
02429                         add edi, 8      /* increase Dest register pointer by 8 */
02430                         dec              ecx            /* decrease loop counter */
02431                         jnz            L10241           /* check loop termination, proceed if required */
02432                         emms                            /* exit MMX state */
02433                         popa
02434         }
02435 #else
02436         /* i386 and x86_64 */
02437         __m64 *mSrc1 = (__m64*)Src1;
02438         __m64 *mDest = (__m64*)Dest;
02439         __m64 *mMask = (__m64*)Mask;
02440         __m64 mm1;
02441         int i;
02442         mm1 = _m_pcmpeqb(mm1, mm1);                     /* generate all 1's in mm1 */
02443         /* Prepare proper bit-Mask in MM1 */
02444         for (i = 0; i < N; i++) {
02445                 mm1 = _m_psrlwi(mm1, 1);                /* shift 4 WORDS of MM1 1 bit to the right */
02446                 mm1 = _m_pand(mm1, *mMask);             /* apply Mask to 8 BYTES of MM1 */
02447         }
02448         /* Shift all bytes of the image */
02449         for (i = 0; i < SrcLength/8; i++) {
02450                 __m64 mm0 = _m_psrlwi(*mSrc1, N);       /* shift 4 WORDS of MM0 (N) bits to the right */
02451                 *mDest = _m_pand(mm0, mm1);             /* apply proper bit-Mask to 8 BYTES of MM0 */
02452                 mSrc1++;
02453                 mDest++;
02454         }
02455         _m_empty();                                     /* clean MMX state */
02456 #endif
02457         return (0);
02458 #else
02459         return (-1);
02460 #endif
02461 }
02462 
02473 int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
02474 {
02475         static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
02476         unsigned int i, istart;
02477         unsigned char *cursrc1;
02478         unsigned char *curdest;
02479 
02480         /* Validate input parameters */
02481         if ((Src1 == NULL) || (Dest == NULL))
02482                 return(-1);
02483         if (length == 0)
02484                 return(0);
02485 
02486         /* Check shift */
02487         if (N > 8) {
02488                 return (-1);
02489         }
02490 
02491         /* Special case: N==0 */
02492         if (N == 0) {
02493                 memcpy(Src1, Dest, length);
02494                 return (0); 
02495         }
02496 
02497         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02498 
02499                 /* MMX routine */
02500                 SDL_imageFilterShiftRightMMX(Src1, Dest, length, N, Mask);
02501 
02502                 /* Check for unaligned bytes */
02503                 if ((length & 7) > 0) {
02504                         /* Setup to process unaligned bytes */
02505                         istart = length & 0xfffffff8;
02506                         cursrc1 = &Src1[istart];
02507                         curdest = &Dest[istart];
02508                 } else {
02509                         /* No unaligned bytes - we are done */
02510                         return (0);
02511                 }
02512         } else {
02513                 /* Setup to process whole image */
02514                 istart = 0;
02515                 cursrc1 = Src1;
02516                 curdest = Dest;
02517         }
02518 
02519         /* C routine to process image */
02520         for (i = istart; i < length; i++) {
02521                 *curdest = (unsigned char) *cursrc1 >> N;
02522                 /* Advance pointers */
02523                 cursrc1++;
02524                 curdest++;
02525         }
02526 
02527         return (0);
02528 }
02529 
02540 static int SDL_imageFilterShiftRightUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
02541 {
02542 #ifdef USE_MMX
02543 #if !defined(GCC__)
02544         __asm
02545         {
02546                 pusha
02547                         mov eax, Src1           /* load Src1 address into eax */
02548                         mov edi, Dest           /* load Dest address into edi */
02549                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
02550                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
02551                         align 16                        /* 16 byte alignment of the loop entry */
02552 L13023:
02553                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
02554                 psrld mm0, N
02555                         movq [edi], mm0         /* store result in SrcDest */
02556                         add eax, 8      /* increase Src1 register pointer by 8 */
02557                         add edi, 8      /* increase Dest register pointer by 8 */
02558                         dec              ecx            /* decrease loop counter */
02559                         jnz             L13023          /* check loop termination, proceed if required */
02560                         emms                            /* exit MMX state */
02561                         popa
02562         }
02563 #else
02564         /* i386 and x86_64 */
02565         __m64 *mSrc1 = (__m64*)Src1;
02566         __m64 *mDest = (__m64*)Dest;
02567         int i;
02568         for (i = 0; i < SrcLength/8; i++) {
02569                 *mDest = _m_psrldi(*mSrc1, N);
02570                 mSrc1++;
02571                 mDest++;
02572         }
02573         _m_empty();                                     /* clean MMX state */
02574 #endif
02575         return (0);
02576 #else
02577         return (-1);
02578 #endif
02579 }
02580 
02591 int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
02592 {
02593         unsigned int i, istart;
02594         unsigned char *cursrc1, *curdest;
02595         unsigned int *icursrc1, *icurdest;
02596         unsigned int result;
02597 
02598         /* Validate input parameters */
02599         if ((Src1 == NULL) || (Dest == NULL))
02600                 return(-1);
02601         if (length == 0)
02602                 return(0);
02603 
02604         if (N > 32) {
02605                 return (-1);
02606         }
02607 
02608         /* Special case: N==0 */
02609         if (N == 0) {
02610                 memcpy(Src1, Dest, length);
02611                 return (0); 
02612         }
02613 
02614         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02615 
02616                 SDL_imageFilterShiftRightUintMMX(Src1, Dest, length, N);
02617 
02618                 /* Check for unaligned bytes */
02619                 if ((length & 7) > 0) {
02620                         /* Setup to process unaligned bytes */
02621                         istart = length & 0xfffffff8;
02622                         cursrc1 = &Src1[istart];
02623                         curdest = &Dest[istart];
02624                 } else {
02625                         /* No unaligned bytes - we are done */
02626                         return (0);
02627                 }
02628         } else {
02629                 /* Setup to process whole image */
02630                 istart = 0;
02631                 cursrc1 = Src1;
02632                 curdest = Dest;
02633         }
02634 
02635         /* C routine to process image */
02636         icursrc1=(unsigned int *)cursrc1;
02637         icurdest=(unsigned int *)curdest;
02638         for (i = istart; i < length; i += 4) {
02639                 if ((i+4)<length) {
02640                         result = ((unsigned int)*icursrc1 >> N);
02641                         *icurdest = result;
02642                 }
02643                 /* Advance pointers */
02644                 icursrc1++;
02645                 icurdest++;
02646         }
02647 
02648         return (0);
02649 }
02650 
02661 static int SDL_imageFilterMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
02662 {
02663 #ifdef USE_MMX
02664 #if !defined(GCC__)
02665         __asm
02666         {
02667                 pusha
02668                         /* ** Duplicate C in 4 words of MM1 ** */
02669                         mov al, C       /* load C into AL */
02670                         xor ah, ah      /* zero AH */
02671                         mov bx, ax      /* copy AX into BX */
02672                         shl eax, 16     /* shift 2 bytes of EAX left */
02673                         mov ax, bx      /* copy BX into AX */
02674                         movd mm1, eax           /* copy EAX into MM1 */
02675                         movd mm2, eax           /* copy EAX into MM2 */
02676                         punpckldq mm1, mm2      /* fill higher words of MM1 with C */
02677                         pxor mm0, mm0           /* zero MM0 register */
02678                         mov eax, Src1           /* load Src1 address into eax */
02679                         mov edi, Dest           /* load Dest address into edi */
02680                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
02681                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
02682                         cmp al, 128     /* if (C <= 128) execute more efficient code */
02683                         jg             L10251
02684                         align 16                        /* 16 byte alignment of the loop entry */
02685 L10250:
02686                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
02687                 movq mm4, mm3           /* copy MM3 into MM4  */
02688                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
02689                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
02690                         pmullw mm3, mm1         /* mul low  bytes of SrcDest and MM1 */
02691                         pmullw mm4, mm1         /* mul high bytes of SrcDest and MM1 */
02692                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
02693                         movq [edi], mm3         /* store result in Dest */
02694                         add eax, 8      /* increase Src1 register pointer by 8 */
02695                         add edi, 8      /* increase Dest register pointer by 8 */
02696                         dec              ecx            /* decrease loop counter */
02697                         jnz            L10250           /* check loop termination, proceed if required */
02698                         jmp            L10252
02699                         align 16                        /* 16 byte alignment of the loop entry */
02700 L10251:
02701                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
02702                 movq mm4, mm3           /* copy MM3 into MM4  */
02703                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
02704                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
02705                         pmullw mm3, mm1         /* mul low  bytes of SrcDest and MM1 */
02706                         pmullw mm4, mm1         /* mul high bytes of SrcDest and MM1 */
02707                         /* ** Take abs value of the results (signed words) ** */
02708                         movq mm5, mm3           /* copy mm3 into mm5 */
02709                         movq mm6, mm4           /* copy mm4 into mm6 */
02710                         psraw mm5, 15           /* fill mm5 words with word sign bit */
02711                         psraw mm6, 15           /* fill mm6 words with word sign bit */
02712                         pxor mm3, mm5           /* take 1's compliment of only neg words */
02713                         pxor mm4, mm6           /* take 1's compliment of only neg words */
02714                         psubsw mm3, mm5         /* add 1 to only neg words, W-(-1) or W-0 */
02715                         psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
02716                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
02717                         movq [edi], mm3         /* store result in Dest */
02718                         add eax, 8      /* increase Src1 register pointer by 8 */
02719                         add edi, 8      /* increase Dest register pointer by 8 */
02720                         dec              ecx            /* decrease loop counter */
02721                         jnz            L10251           /* check loop termination, proceed if required */
02722 L10252:
02723                 emms                            /* exit MMX state */
02724                         popa
02725         }
02726 #else
02727         /* i386 and x86_64 */
02728         __m64 *mSrc1 = (__m64*)Src1;
02729         __m64 *mDest = (__m64*)Dest;
02730         __m64 mm0 = _m_from_int(0);                             /* zero mm0 register */
02731         /* Duplicate C in 4 words of MM1 */
02732         int i;
02733         i = C | C<<16;
02734         __m64 mm1 = _m_from_int(i);
02735         __m64 mm2 = _m_from_int(i);
02736         mm1 = _m_punpckldq(mm1, mm2);                           /* fill higher words of MM1 with C */
02737         // long long lli = C | C<<16 | (long long)C<<32 | (long long)C<<48;
02738         //__m64 mm1 = _m_from_int64(lli); // x86_64 only
02739         if (C <= 128) {                                         /* if (C <= 128) execute more efficient code */
02740                 for (i = 0; i < SrcLength/8; i++) {
02741                         __m64 mm3, mm4;
02742                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
02743                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
02744                         mm3 = _m_pmullw(mm3, mm1);              /* mul low  bytes of Src1 and MM1 */
02745                         mm4 = _m_pmullw(mm4, mm1);              /* mul high bytes of Src1 and MM1 */
02746                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
02747                         mSrc1++;
02748                         mDest++;
02749                 }
02750         } else {
02751                 for (i = 0; i < SrcLength/8; i++) {
02752                         __m64 mm3, mm4, mm5, mm6;
02753                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
02754                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
02755                         mm3 = _m_pmullw(mm3, mm1);              /* mul low  bytes of Src1 and MM1 */
02756                         mm4 = _m_pmullw(mm4, mm1);              /* mul high bytes of Src1 and MM1 */
02757                         /* Take abs value of the results (signed words) */
02758                         mm5 = _m_psrawi(mm3, 15);               /* fill mm5 words with word sign bit */
02759                         mm6 = _m_psrawi(mm4, 15);               /* fill mm6 words with word sign bit */
02760                         mm3 = _m_pxor(mm3, mm5);                /* take 1's compliment of only neg. words */
02761                         mm4 = _m_pxor(mm4, mm6);                /* take 1's compliment of only neg. words */
02762                         mm3 = _m_psubsw(mm3, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
02763                         mm4 = _m_psubsw(mm4, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
02764                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
02765                         mSrc1++;
02766                         mDest++;
02767                 }
02768         }
02769         _m_empty();                                             /* clean MMX state */
02770 #endif
02771         return (0);
02772 #else
02773         return (-1);
02774 #endif
02775 }
02776 
02787 int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
02788 {
02789         unsigned int i, istart;
02790         int iC;
02791         unsigned char *cursrc1;
02792         unsigned char *curdest;
02793         int result;
02794 
02795         /* Validate input parameters */
02796         if ((Src1 == NULL) || (Dest == NULL))
02797                 return(-1);
02798         if (length == 0)
02799                 return(0);
02800 
02801         /* Special case: C==1 */
02802         if (C == 1) {
02803                 memcpy(Src1, Dest, length);
02804                 return (0); 
02805         }
02806 
02807         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02808 
02809                 SDL_imageFilterMultByByteMMX(Src1, Dest, length, C);
02810 
02811                 /* Check for unaligned bytes */
02812                 if ((length & 7) > 0) {
02813                         /* Setup to process unaligned bytes */
02814                         istart = length & 0xfffffff8;
02815                         cursrc1 = &Src1[istart];
02816                         curdest = &Dest[istart];
02817                 } else {
02818                         /* No unaligned bytes - we are done */
02819                         return (0);
02820                 }
02821         } else {
02822                 /* Setup to process whole image */
02823                 istart = 0;
02824                 cursrc1 = Src1;
02825                 curdest = Dest;
02826         }
02827 
02828         /* C routine to process image */
02829         iC = (int) C;
02830         for (i = istart; i < length; i++) {
02831                 result = (int) *cursrc1 * iC;
02832                 if (result > 255)
02833                         result = 255;
02834                 *curdest = (unsigned char) result;
02835                 /* Advance pointers */
02836                 cursrc1++;
02837                 curdest++;
02838         }
02839 
02840         return (0);
02841 }
02842 
02854 static int SDL_imageFilterShiftRightAndMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
02855                                                                                           unsigned char C)
02856 {
02857 #ifdef USE_MMX
02858 #if !defined(GCC__)
02859         __asm
02860         {
02861                 pusha
02862                         /* ** Duplicate C in 4 words of MM1 ** */
02863                         mov al, C       /* load C into AL */
02864                         xor ah, ah      /* zero AH */
02865                         mov bx, ax      /* copy AX into BX */
02866                         shl eax, 16     /* shift 2 bytes of EAX left */
02867                         mov ax, bx      /* copy BX into AX */
02868                         movd mm1, eax           /* copy EAX into MM1 */
02869                         movd mm2, eax           /* copy EAX into MM2 */
02870                         punpckldq mm1, mm2      /* fill higher words of MM1 with C */
02871                         xor ecx, ecx    /* zero ECX */
02872                         mov cl, N       /* load N into CL */
02873                         movd mm7, ecx           /* copy N into MM7 */
02874                         pxor mm0, mm0           /* zero MM0 register */
02875                         mov eax, Src1           /* load Src1 address into eax */
02876                         mov edi, Dest           /* load Dest address into edi */
02877                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
02878                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
02879                         align 16                        /* 16 byte alignment of the loop entry */
02880 L1026:
02881                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
02882                 movq mm4, mm3           /* copy MM3 into MM4  */
02883                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
02884                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
02885                         psrlw mm3, mm7          /* shift 4 WORDS of MM3 (N) bits to the right */
02886                         psrlw mm4, mm7          /* shift 4 WORDS of MM4 (N) bits to the right */
02887                         pmullw mm3, mm1         /* mul low  bytes of SrcDest by MM1 */
02888                         pmullw mm4, mm1         /* mul high bytes of SrcDest by MM1 */
02889                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
02890                         movq [edi], mm3         /* store result in Dest */
02891                         add eax, 8      /* increase Src1 register pointer by 8 */
02892                         add edi, 8      /* increase Dest register pointer by 8 */
02893                         dec              ecx            /* decrease loop counter */
02894                         jnz             L1026           /* check loop termination, proceed if required */
02895                         emms                            /* exit MMX state */
02896                         popa
02897         }
02898 #else
02899         /* i386 and x86_64 */
02900         __m64 *mSrc1 = (__m64*)Src1;
02901         __m64 *mDest = (__m64*)Dest;
02902         __m64 mm0 = _m_from_int(0);                     /* zero mm0 register */
02903         /* Duplicate C in 4 words of MM1 */
02904         int i;
02905         i = (C<<16)|C;
02906         __m64 mm1 = _m_from_int(i);
02907         __m64 mm2 = _m_from_int(i);
02908         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher words of MM1 with C */
02909         for (i = 0; i < SrcLength/8; i++) {
02910                 __m64 mm3, mm4, mm5, mm6;
02911                 mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
02912                 mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
02913                 mm3 = _m_psrlwi(mm3, N);                /* shift 4 WORDS of MM3 (N) bits to the right */
02914                 mm4 = _m_psrlwi(mm4, N);                /* shift 4 WORDS of MM4 (N) bits to the right */
02915                 mm3 = _m_pmullw(mm3, mm1);              /* mul low  bytes of Src1 and MM1 */
02916                 mm4 = _m_pmullw(mm4, mm1);              /* mul high bytes of Src1 and MM1 */
02917                 *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
02918                 mSrc1++;
02919                 mDest++;
02920         }
02921         _m_empty();                                     /* clean MMX state */
02922 #endif
02923         return (0);
02924 #else
02925         return (-1);
02926 #endif
02927 }
02928 
02940 int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N,
02941                                                                                    unsigned char C)
02942 {
02943         unsigned int i, istart;
02944         int iC;
02945         unsigned char *cursrc1;
02946         unsigned char *curdest;
02947         int result;
02948 
02949         /* Validate input parameters */
02950         if ((Src1 == NULL) || (Dest == NULL))
02951                 return(-1);
02952         if (length == 0)
02953                 return(0);
02954 
02955         /* Check shift */
02956         if (N > 8) {
02957                 return (-1);
02958         }
02959 
02960         /* Special case: N==0 && C==1 */
02961         if ((N == 0) && (C == 1)) {
02962                 memcpy(Src1, Dest, length);
02963                 return (0); 
02964         }
02965 
02966         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
02967 
02968                 SDL_imageFilterShiftRightAndMultByByteMMX(Src1, Dest, length, N, C);
02969 
02970                 /* Check for unaligned bytes */
02971                 if ((length & 7) > 0) {
02972                         /* Setup to process unaligned bytes */
02973                         istart = length & 0xfffffff8;
02974                         cursrc1 = &Src1[istart];
02975                         curdest = &Dest[istart];
02976                 } else {
02977                         /* No unaligned bytes - we are done */
02978                         return (0);
02979                 }
02980         } else {
02981                 /* Setup to process whole image */
02982                 istart = 0;
02983                 cursrc1 = Src1;
02984                 curdest = Dest;
02985         }
02986 
02987         /* C routine to process image */
02988         iC = (int) C;
02989         for (i = istart; i < length; i++) {
02990                 result = (int) (*cursrc1 >> N) * iC;
02991                 if (result > 255)
02992                         result = 255;
02993                 *curdest = (unsigned char) result;
02994                 /* Advance pointers */
02995                 cursrc1++;
02996                 curdest++;
02997         }
02998 
02999         return (0);
03000 }
03001 
03013 static int SDL_imageFilterShiftLeftByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
03014                                                                         unsigned char *Mask)
03015 {
03016 #ifdef USE_MMX
03017 #if !defined(GCC__)
03018         __asm
03019         {
03020                 pusha
03021                         mov edx, Mask           /* load Mask address into edx */
03022                         movq mm0, [edx]         /* load Mask into mm0 */
03023                 xor ecx, ecx    /* zero ECX */
03024                         mov cl, N       /* load loop counter (N) into CL */
03025                         movd mm3, ecx           /* copy (N) into MM3  */
03026                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
03027 L10270:                         /* ** Prepare proper bit-Mask in MM1 ** */
03028                 psllw mm1, 1    /* shift 4 WORDS of MM1 1 bit to the left */
03029                         pand mm1, mm0        // apply Mask to 8 BYTES of MM1 */
03030                         /*  byte     0x0f, 0xdb, 0xc8 */
03031                         dec cl                          /* decrease loop counter */
03032                         jnz            L10270           /* check loop termination, proceed if required */
03033                         /* ** Shift all bytes of the image ** */
03034                         mov eax, Src1           /* load Src1 address into eax */
03035                         mov edi, Dest           /* load SrcDest address into edi */
03036                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03037                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03038                         align 16                        /* 16 byte alignment of the loop entry */
03039 L10271:
03040                 movq mm0, [eax]         /* load 8 bytes from Src1 into MM0 */
03041                 psllw mm0, mm3          /* shift 4 WORDS of MM0 (N) bits to the left */
03042                         pand mm0, mm1    // apply proper bit-Mask to 8 BYTES of MM0 */
03043                         /* byte     0x0f, 0xdb, 0xc1 */
03044                         movq [edi], mm0         /* store result in Dest */
03045                         add eax, 8      /* increase Src1 register pointer by 8 */
03046                         add edi, 8      /* increase Dest register pointer by 8 */
03047                         dec              ecx            /* decrease loop counter */
03048                         jnz            L10271           /* check loop termination, proceed if required */
03049                         emms                            /* exit MMX state */
03050                         popa
03051         }
03052 #else
03053         /* i386 and x86_64 */
03054         __m64 *mSrc1 = (__m64*)Src1;
03055         __m64 *mDest = (__m64*)Dest;
03056         __m64 *mMask = (__m64*)Mask;
03057         __m64 mm1;
03058         int i;
03059         mm1 = _m_pcmpeqb(mm1, mm1);                     /* generate all 1's in mm1 */
03060         /* Prepare proper bit-Mask in MM1 */
03061         for (i = 0; i < N; i++) {
03062                 mm1 = _m_psllwi(mm1, 1);                /* shift 4 WORDS of MM1 1 bit to the left */
03063                 mm1 = _m_pand(mm1, *mMask);             /* apply Mask to 8 BYTES of MM1 */
03064         }
03065         /* ** Shift all bytes of the image ** */
03066         for (i = 0; i < SrcLength/8; i++) {
03067                 __m64 mm0 = _m_psllwi(*mSrc1, N);       /* shift 4 WORDS of MM0 (N) bits to the left */
03068                 *mDest = _m_pand(mm0, mm1);             /* apply proper bit-Mask to 8 BYTES of MM0 */
03069                 mSrc1++;
03070                 mDest++;
03071         }
03072         _m_empty();                                     /* clean MMX state */
03073 #endif
03074         return (0);
03075 #else
03076         return (-1);
03077 #endif
03078 }
03079 
03090 int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
03091 {
03092         static unsigned char Mask[8] = { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE };
03093         unsigned int i, istart;
03094         unsigned char *cursrc1, *curdest;
03095         int result;
03096 
03097         /* Validate input parameters */
03098         if ((Src1 == NULL) || (Dest == NULL))
03099                 return(-1);
03100         if (length == 0)
03101                 return(0);
03102 
03103         if (N > 8) {
03104                 return (-1);
03105         }
03106 
03107         /* Special case: N==0 */
03108         if (N == 0) {
03109                 memcpy(Src1, Dest, length);
03110                 return (0); 
03111         }
03112 
03113         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03114 
03115                 SDL_imageFilterShiftLeftByteMMX(Src1, Dest, length, N, Mask);
03116 
03117                 /* Check for unaligned bytes */
03118                 if ((length & 7) > 0) {
03119                         /* Setup to process unaligned bytes */
03120                         istart = length & 0xfffffff8;
03121                         cursrc1 = &Src1[istart];
03122                         curdest = &Dest[istart];
03123                 } else {
03124                         /* No unaligned bytes - we are done */
03125                         return (0);
03126                 }
03127         } else {
03128                 /* Setup to process whole image */
03129                 istart = 0;
03130                 cursrc1 = Src1;
03131                 curdest = Dest;
03132         }
03133 
03134         /* C routine to process image */
03135         for (i = istart; i < length; i++) {
03136                 result = ((int) *cursrc1 << N) & 0xff;
03137                 *curdest = (unsigned char) result;
03138                 /* Advance pointers */
03139                 cursrc1++;
03140                 curdest++;
03141         }
03142 
03143         return (0);
03144 }
03145 
03156 static int SDL_imageFilterShiftLeftUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
03157 {
03158 #ifdef USE_MMX
03159 #if !defined(GCC__)
03160         __asm
03161         {
03162                 pusha
03163                         mov eax, Src1           /* load Src1 address into eax */
03164                         mov edi, Dest           /* load Dest address into edi */
03165                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03166                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03167                         align 16                        /* 16 byte alignment of the loop entry */
03168 L12023:
03169                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
03170                 pslld mm0, N    /* MM0=SrcDest+C (add 8 bytes with saturation) */
03171                         movq [edi], mm0         /* store result in SrcDest */
03172                         add eax, 8      /* increase Src1 register pointer by 8 */
03173                         add edi, 8      /* increase Dest register pointer by 8 */
03174                         dec              ecx            /* decrease loop counter */
03175                         jnz             L12023          /* check loop termination, proceed if required */
03176                         emms                            /* exit MMX state */
03177                         popa
03178         }
03179 #else
03180         /* i386 and x86_64 */
03181         __m64 *mSrc1 = (__m64*)Src1;
03182         __m64 *mDest = (__m64*)Dest;
03183         int i;
03184         for (i = 0; i < SrcLength/8; i++) {
03185                 *mDest = _m_pslldi(*mSrc1, N);  /* Src1+C (add 8 bytes with saturation) */
03186                 mSrc1++;
03187                 mDest++;
03188         }
03189         _m_empty();                             /* clean MMX state */
03190 #endif
03191         return (0);
03192 #else
03193         return (-1);
03194 #endif
03195 }
03196 
03207 int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
03208 {
03209         unsigned int i, istart;
03210         unsigned char *cursrc1, *curdest;
03211         unsigned int *icursrc1, *icurdest;
03212         unsigned int result;
03213 
03214         /* Validate input parameters */
03215         if ((Src1 == NULL) || (Dest == NULL))
03216                 return(-1);
03217         if (length == 0)
03218                 return(0);
03219 
03220         if (N > 32) {
03221                 return (-1);
03222         }
03223 
03224         /* Special case: N==0 */
03225         if (N == 0) {
03226                 memcpy(Src1, Dest, length);
03227                 return (0); 
03228         }
03229 
03230         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03231 
03232                 SDL_imageFilterShiftLeftUintMMX(Src1, Dest, length, N);
03233 
03234                 /* Check for unaligned bytes */
03235                 if ((length & 7) > 0) {
03236                         /* Setup to process unaligned bytes */
03237                         istart = length & 0xfffffff8;
03238                         cursrc1 = &Src1[istart];
03239                         curdest = &Dest[istart];
03240                 } else {
03241                         /* No unaligned bytes - we are done */
03242                         return (0);
03243                 }
03244         } else {
03245                 /* Setup to process whole image */
03246                 istart = 0;
03247                 cursrc1 = Src1;
03248                 curdest = Dest;
03249         }
03250 
03251         /* C routine to process image */
03252         icursrc1=(unsigned int *)cursrc1;
03253         icurdest=(unsigned int *)curdest;
03254         for (i = istart; i < length; i += 4) {
03255                 if ((i+4)<length) {
03256                         result = ((unsigned int)*icursrc1 << N);
03257                         *icurdest = result;
03258                 }
03259                 /* Advance pointers */
03260                 icursrc1++;
03261                 icurdest++;
03262         }
03263 
03264         return (0);
03265 }
03266 
03277 static int SDL_imageFilterShiftLeftMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
03278 {
03279 #ifdef USE_MMX
03280 #if !defined(GCC__)
03281         __asm
03282         {
03283                 pusha
03284                         xor eax, eax    /* zero EAX */
03285                         mov al, N       /* load N into AL */
03286                         movd mm7, eax           /* copy N into MM7 */
03287                         pxor mm0, mm0           /* zero MM0 register */
03288                         mov eax, Src1           /* load Src1 address into eax */
03289                         mov edi, Dest           /* load Dest address into edi */
03290                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03291                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03292                         cmp al, 7       /* if (N <= 7) execute more efficient code */
03293                         jg             L10281
03294                         align 16                        /* 16 byte alignment of the loop entry */
03295 L10280:
03296                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
03297                 movq mm4, mm3           /* copy MM3 into MM4  */
03298                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
03299                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
03300                         psllw mm3, mm7          /* shift 4 WORDS of MM3 (N) bits to the left */
03301                         psllw mm4, mm7          /* shift 4 WORDS of MM4 (N) bits to the left */
03302                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
03303                         movq [edi], mm3         /* store result in Dest */
03304                         add eax, 8      /* increase Src1 register pointer by 8 */
03305                         add edi, 8      /* increase Dest register pointer by 8 */
03306                         dec              ecx            /* decrease loop counter */
03307                         jnz            L10280           /* check loop termination, proceed if required */
03308                         jmp            L10282
03309                         align 16                        /* 16 byte alignment of the loop entry */
03310 L10281:
03311                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
03312                 movq mm4, mm3           /* copy MM3 into MM4  */
03313                         punpcklbw mm3, mm0      /* unpack low  bytes of SrcDest into words */
03314                         punpckhbw mm4, mm0      /* unpack high bytes of SrcDest into words */
03315                         psllw mm3, mm7          /* shift 4 WORDS of MM3 (N) bits to the left */
03316                         psllw mm4, mm7          /* shift 4 WORDS of MM4 (N) bits to the left */
03317                         /* ** Take abs value of the signed words ** */
03318                         movq mm5, mm3           /* copy mm3 into mm5 */
03319                         movq mm6, mm4           /* copy mm4 into mm6 */
03320                         psraw mm5, 15           /* fill mm5 words with word sign bit */
03321                         psraw mm6, 15           /* fill mm6 words with word sign bit */
03322                         pxor mm3, mm5           /* take 1's compliment of only neg words */
03323                         pxor mm4, mm6           /* take 1's compliment of only neg words */
03324                         psubsw mm3, mm5         /* add 1 to only neg words, W-(-1) or W-0 */
03325                         psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
03326                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
03327                         movq [edi], mm3         /* store result in Dest */
03328                         add eax, 8      /* increase Src1 register pointer by 8 */
03329                         add edi, 8      /* increase Dest register pointer by 8 */
03330                         dec              ecx            /* decrease loop counter */
03331                         jnz            L10281           /* check loop termination, proceed if required */
03332 L10282:
03333                 emms                            /* exit MMX state */
03334                         popa
03335         }
03336 #else
03337         /* i386 and x86_64 */
03338         __m64 *mSrc1 = (__m64*)Src1;
03339         __m64 *mDest = (__m64*)Dest;
03340         __m64 mm0 = _m_from_int(0);                             /* zero mm0 register */
03341         int i;
03342         if (N <= 7) {                                           /* if (N <= 7) execute more efficient code */
03343                 for (i = 0; i < SrcLength/8; i++) {
03344                         __m64 mm3, mm4;
03345                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
03346                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
03347                         mm3 = _m_psllwi(mm3, N);                /* shift 4 WORDS of MM3 (N) bits to the left */
03348                         mm4 = _m_psllwi(mm4, N);                /* shift 4 WORDS of MM4 (N) bits to the left */
03349                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
03350                         mSrc1++;
03351                         mDest++;
03352                 }
03353         } else {
03354                 for (i = 0; i < SrcLength/8; i++) {
03355                         __m64 mm3, mm4, mm5, mm6;
03356                         mm3 = _m_punpcklbw(*mSrc1, mm0);        /* unpack low  bytes of Src1 into words */
03357                         mm4 = _m_punpckhbw(*mSrc1, mm0);        /* unpack high bytes of Src1 into words */
03358                         mm3 = _m_psllwi(mm3, N);                /* shift 4 WORDS of MM3 (N) bits to the left */
03359                         mm4 = _m_psllwi(mm4, N);                /* shift 4 WORDS of MM4 (N) bits to the left */
03360                         /* Take abs value of the signed words */
03361                         mm5 = _m_psrawi(mm3, 15);               /* fill mm5 words with word sign bit */
03362                         mm6 = _m_psrawi(mm4, 15);               /* fill mm6 words with word sign bit */
03363                         mm3 = _m_pxor(mm3, mm5);                /* take 1's compliment of only neg. words */
03364                         mm4 = _m_pxor(mm4, mm6);                /* take 1's compliment of only neg. words */
03365                         mm3 = _m_psubsw(mm3, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
03366                         mm4 = _m_psubsw(mm4, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
03367                         *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
03368                         mSrc1++;
03369                         mDest++;
03370                 }
03371         }
03372         _m_empty();                                             /* clean MMX state */
03373 #endif
03374         return (0);
03375 #else
03376         return (-1);
03377 #endif
03378 }
03379 
03390 int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
03391 {
03392         unsigned int i, istart;
03393         unsigned char *cursrc1, *curdest;
03394         int result;
03395 
03396         /* Validate input parameters */
03397         if ((Src1 == NULL) || (Dest == NULL))
03398                 return(-1);
03399         if (length == 0)
03400                 return(0);
03401 
03402         if (N > 8) {
03403                 return (-1);
03404         }
03405 
03406         /* Special case: N==0 */
03407         if (N == 0) {
03408                 memcpy(Src1, Dest, length);
03409                 return (0); 
03410         }
03411 
03412         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03413 
03414                 SDL_imageFilterShiftLeftMMX(Src1, Dest, length, N);
03415 
03416                 /* Check for unaligned bytes */
03417                 if ((length & 7) > 0) {
03418                         /* Setup to process unaligned bytes */
03419                         istart = length & 0xfffffff8;
03420                         cursrc1 = &Src1[istart];
03421                         curdest = &Dest[istart];
03422                 } else {
03423                         /* No unaligned bytes - we are done */
03424                         return (0);
03425                 }
03426         } else {
03427                 /* Setup to process whole image */
03428                 istart = 0;
03429                 cursrc1 = Src1;
03430                 curdest = Dest;
03431         }
03432 
03433         /* C routine to process image */
03434         for (i = istart; i < length; i++) {
03435                 result = (int) *cursrc1 << N;
03436                 if (result > 255)
03437                         result = 255;
03438                 *curdest = (unsigned char) result;
03439                 /* Advance pointers */
03440                 cursrc1++;
03441                 curdest++;
03442         }
03443 
03444         return (0);
03445 }
03446 
03457 static int SDL_imageFilterBinarizeUsingThresholdMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char T)
03458 {
03459 #ifdef USE_MMX
03460 #if !defined(GCC__)
03461         __asm
03462         {
03463                 pusha
03464                         /* ** Duplicate T in 8 bytes of MM3 ** */
03465                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
03466                         pcmpeqb mm2, mm2        /* generate all 1's in mm2 */
03467                         mov al, T       /* load T into AL */
03468                         mov ah, al      /* copy AL into AH */
03469                         mov bx, ax      /* copy AX into BX */
03470                         shl eax, 16     /* shift 2 bytes of EAX left */
03471                         mov ax, bx      /* copy BX into AX */
03472                         movd mm3, eax           /* copy EAX into MM3 */
03473                         movd mm4, eax           /* copy EAX into MM4 */
03474                         punpckldq mm3, mm4      /* fill higher bytes of MM3 with T */
03475                         psubusb mm2, mm3        /* store 0xFF - T in MM2 */
03476                         mov eax, Src1           /* load Src1 address into eax */
03477                         mov edi, Dest           /* load Dest address into edi */
03478                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03479                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03480                         align 16                        /* 16 byte alignment of the loop entry */
03481 L1029:
03482                 movq mm0, [eax]         /* load 8 bytes from SrcDest into MM0 */
03483                 paddusb mm0, mm2        /* MM0=SrcDest+(0xFF-T) (add 8 bytes with saturation) */
03484                         pcmpeqb mm0, mm1        /* binarize 255:0, comparing to 255 */
03485                         movq [edi], mm0         /* store result in SrcDest */
03486                         add eax, 8      /* increase Src1 register pointer by 8 */
03487                         add edi, 8      /* increase Dest register pointer by 8 */
03488                         dec              ecx            /* decrease loop counter */
03489                         jnz             L1029           /* check loop termination, proceed if required */
03490                         emms                            /* exit MMX state */
03491                         popa
03492         }
03493 #else
03494         /* i386 and x86_64 */
03495         __m64 *mSrc1 = (__m64*)Src1;
03496         __m64 *mDest = (__m64*)Dest;
03497         /* Duplicate T in 8 bytes of MM3 */
03498         __m64 mm1 = _m_pcmpeqb(mm1, mm1);                       /* generate all 1's in mm1 */
03499         __m64 mm2 = _m_pcmpeqb(mm2, mm2);                       /* generate all 1's in mm1 */
03500         int i;
03501         memset(&i, T, 4);
03502         __m64 mm3 = _m_from_int(i);
03503         __m64 mm4 = _m_from_int(i);
03504         mm3 = _m_punpckldq(mm3, mm4);                   /* fill higher bytes of MM3 with T */
03505         mm2 = _m_psubusb(mm2, mm3);                     /* store 0xFF - T in MM2 */
03506         //__m64 mm3 = _m_from_int64(lli); // x86_64 only
03507         for (i = 0; i < SrcLength/8; i++) {
03508                 __m64 mm0 = _m_paddusb(*mSrc1, mm2);    /* Src1+(0xFF-T) (add 8 bytes with saturation) */
03509                 *mDest = _m_pcmpeqb(mm0, mm1);          /* binarize 255:0, comparing to 255 */
03510                 mSrc1++;
03511                 mDest++;
03512         }
03513         _m_empty();                                     /* clean MMX state */
03514 #endif
03515         return (0);
03516 #else
03517         return (-1);
03518 #endif
03519 }
03520 
03531 int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
03532 {
03533         unsigned int i, istart;
03534         unsigned char *cursrc1;
03535         unsigned char *curdest;
03536 
03537         /* Validate input parameters */
03538         if ((Src1 == NULL) || (Dest == NULL))
03539                 return(-1);
03540         if (length == 0)
03541                 return(0);
03542 
03543         /* Special case: T==0 */
03544         if (T == 0) {
03545                 memset(Dest, 255, length);
03546                 return (0); 
03547         }
03548 
03549         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03550 
03551                 SDL_imageFilterBinarizeUsingThresholdMMX(Src1, Dest, length, T);
03552 
03553                 /* Check for unaligned bytes */
03554                 if ((length & 7) > 0) {
03555                         /* Setup to process unaligned bytes */
03556                         istart = length & 0xfffffff8;
03557                         cursrc1 = &Src1[istart];
03558                         curdest = &Dest[istart];
03559                 } else {
03560                         /* No unaligned bytes - we are done */
03561                         return (0);
03562                 }
03563         } else {
03564                 /* Setup to process whole image */
03565                 istart = 0;
03566                 cursrc1 = Src1;
03567                 curdest = Dest;
03568         }
03569 
03570         /* C routine to process image */
03571         for (i = istart; i < length; i++) {
03572                 *curdest = (unsigned char)(((unsigned char)*cursrc1 >= T) ? 255 : 0);
03573                 /* Advance pointers */
03574                 cursrc1++;
03575                 curdest++;
03576         }
03577 
03578         return (0);
03579 }
03580 
03592 static int SDL_imageFilterClipToRangeMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char Tmin,
03593                                                                   unsigned char Tmax)
03594 {
03595 #ifdef USE_MMX
03596 #if !defined(GCC__)
03597         __asm
03598         {
03599                 pusha
03600                         pcmpeqb mm1, mm1        /* generate all 1's in mm1 */
03601                         /* ** Duplicate Tmax in 8 bytes of MM3 ** */
03602                         mov al, Tmax    /* load Tmax into AL */
03603                         mov ah, al      /* copy AL into AH */
03604                         mov bx, ax      /* copy AX into BX */
03605                         shl eax, 16     /* shift 2 bytes of EAX left */
03606                         mov ax, bx      /* copy BX into AX */
03607                         movd mm3, eax           /* copy EAX into MM3 */
03608                         movd mm4, eax           /* copy EAX into MM4 */
03609                         punpckldq mm3, mm4      /* fill higher bytes of MM3 with Tmax */
03610                         psubusb mm1, mm3        /* store 0xFF - Tmax in MM1 */
03611                         /* ** Duplicate Tmin in 8 bytes of MM5 ** */
03612                         mov al, Tmin    /* load Tmin into AL */
03613                         mov ah, al      /* copy AL into AH */
03614                         mov bx, ax      /* copy AX into BX */
03615                         shl eax, 16     /* shift 2 bytes of EAX left */
03616                         mov ax, bx      /* copy BX into AX */
03617                         movd mm5, eax           /* copy EAX into MM5 */
03618                         movd mm4, eax           /* copy EAX into MM4 */
03619                         punpckldq mm5, mm4      /* fill higher bytes of MM5 with Tmin */
03620                         movq mm7, mm5           /* copy MM5 into MM7 */
03621                         paddusb mm7, mm1        /* store 0xFF - Tmax + Tmin in MM7 */
03622                         mov eax, Src1           /* load Src1 address into eax */
03623                         mov edi, Dest           /* load Dest address into edi */
03624                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03625                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03626                         align 16                        /* 16 byte alignment of the loop entry */
03627 L1030:
03628                 movq mm0, [eax]         /* load 8 bytes from Src1 into MM0 */
03629                 paddusb mm0, mm1        /* MM0=SrcDest+(0xFF-Tmax) */
03630                         psubusb mm0, mm7        /* MM0=MM0-(0xFF-Tmax+Tmin) */
03631                         paddusb mm0, mm5        /* MM0=MM0+Tmin */
03632                         movq [edi], mm0         /* store result in Dest */
03633                         add eax, 8      /* increase Src1 register pointer by 8 */
03634                         add edi, 8      /* increase Dest register pointer by 8 */
03635                         dec              ecx            /* decrease loop counter */
03636                         jnz             L1030           /* check loop termination, proceed if required */
03637                         emms                            /* exit MMX state */
03638                         popa
03639         }
03640 #else
03641         /* i386 and x86_64 */
03642         __m64 *mSrc1 = (__m64*)Src1;
03643         __m64 *mDest = (__m64*)Dest;
03644         __m64 mm1 = _m_pcmpeqb(mm1, mm1);       /* generate all 1's in mm1 */
03645         int i;
03646         /* Duplicate Tmax in 8 bytes of MM3 */
03647         __m64 mm3, mm4;
03648         memset(&i, Tmax, 4);
03649         mm3 = _m_from_int(i);
03650         mm4 = _m_from_int(i);
03651         mm3 = _m_punpckldq(mm3, mm4);           /* fill higher bytes of MM3 with Tmax */
03652         mm1 = _m_psubusb(mm1, mm3);             /* store 0xFF - Tmax in MM1 */
03653         //__m64 mm3 = _m_from_int64(lli); // x86_64 only
03654         /* Duplicate Tmax in 8 bytes of MM3 */
03655         __m64 mm5, mm7;
03656         memset(&i, Tmin, 4);
03657         mm5 = _m_from_int(i);
03658         mm4 = _m_from_int(i);
03659         mm5 = _m_punpckldq(mm5, mm4);           /* fill higher bytes of MM5 with Tmin */
03660         mm7 = _m_paddusb(mm5, mm1);     /* store 0xFF - Tmax + Tmin in MM7 */
03661         for (i = 0; i < SrcLength/8; i++) {
03662                 __m64 mm0;
03663                 mm0 = _m_paddusb(*mSrc1, mm1);  /* MM0=Src1+(0xFF-Tmax) */
03664                 mm0 = _m_psubusb(mm0, mm7);     /* MM0=MM0-(0xFF-Tmax+Tmin) */
03665                 *mDest = _m_paddusb(mm0, mm5);  /* MM0+Tmin */
03666                 mSrc1++;
03667                 mDest++;
03668         }
03669         _m_empty();                             /* clean MMX state */
03670 #endif
03671         return (0);
03672 #else
03673         return (-1);
03674 #endif
03675 }
03676 
03688 int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin,
03689                                                            unsigned char Tmax)
03690 {
03691         unsigned int i, istart;
03692         unsigned char *cursrc1;
03693         unsigned char *curdest;
03694 
03695         /* Validate input parameters */
03696         if ((Src1 == NULL) || (Dest == NULL))
03697                 return(-1);
03698         if (length == 0)
03699                 return(0);
03700 
03701         /* Special case: Tmin==0 && Tmax = 255 */
03702         if ((Tmin == 0) && (Tmax == 25)) {
03703                 memcpy(Src1, Dest, length);
03704                 return (0); 
03705         }
03706 
03707         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03708 
03709                 SDL_imageFilterClipToRangeMMX(Src1, Dest, length, Tmin, Tmax);
03710 
03711                 /* Check for unaligned bytes */
03712                 if ((length & 7) > 0) {
03713                         /* Setup to process unaligned bytes */
03714                         istart = length & 0xfffffff8;
03715                         cursrc1 = &Src1[istart];
03716                         curdest = &Dest[istart];
03717                 } else {
03718                         /* No unaligned bytes - we are done */
03719                         return (0);
03720                 }
03721         } else {
03722                 /* Setup to process whole image */
03723                 istart = 0;
03724                 cursrc1 = Src1;
03725                 curdest = Dest;
03726         }
03727 
03728         /* C routine to process image */
03729         for (i = istart; i < length; i++) {
03730                 if (*cursrc1 < Tmin) {
03731                         *curdest = Tmin;
03732                 } else if (*cursrc1 > Tmax) {
03733                         *curdest = Tmax;
03734                 } else {
03735                         *curdest = *cursrc1;
03736                 }
03737                 /* Advance pointers */
03738                 cursrc1++;
03739                 curdest++;
03740         }
03741 
03742         return (0);
03743 }
03744 
03758 static int SDL_imageFilterNormalizeLinearMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, int Cmin, int Cmax,
03759                                                                           int Nmin, int Nmax)
03760 {
03761 #ifdef USE_MMX
03762 #if !defined(GCC__)
03763         __asm
03764         {
03765                 pusha
03766                         mov ax, WORD PTR Nmax           /* load Nmax in AX */
03767                         mov bx, WORD PTR Cmax           /* load Cmax in BX */
03768                         sub ax, WORD PTR Nmin           /* AX = Nmax - Nmin */
03769                         sub bx, WORD PTR Cmin           /* BX = Cmax - Cmin */
03770                         jz             L10311           /* check division by zero */
03771                         xor dx, dx      /* prepare for division, zero DX */
03772                         div               bx            /* AX = AX/BX */
03773                         jmp            L10312
03774 L10311:
03775                 mov ax, 255     /* if div by zero, assume result max byte value */
03776 L10312:                         /* ** Duplicate AX in 4 words of MM0 ** */
03777                 mov bx, ax      /* copy AX into BX */
03778                         shl eax, 16     /* shift 2 bytes of EAX left */
03779                         mov ax, bx      /* copy BX into AX */
03780                         movd mm0, eax           /* copy EAX into MM0 */
03781                         movd mm1, eax           /* copy EAX into MM1 */
03782                         punpckldq mm0, mm1      /* fill higher words of MM0 with AX */
03783                         /* ** Duplicate Cmin in 4 words of MM1 ** */
03784                         mov ax, WORD PTR Cmin           /* load Cmin into AX */
03785                         mov bx, ax      /* copy AX into BX */
03786                         shl eax, 16     /* shift 2 bytes of EAX left */
03787                         mov ax, bx      /* copy BX into AX */
03788                         movd mm1, eax           /* copy EAX into MM1 */
03789                         movd mm2, eax           /* copy EAX into MM2 */
03790                         punpckldq mm1, mm2      /* fill higher words of MM1 with Cmin */
03791                         /* ** Duplicate Nmin in 4 words of MM2 ** */
03792                         mov ax, WORD PTR Nmin           /* load Nmin into AX */
03793                         mov bx, ax      /* copy AX into BX */
03794                         shl eax, 16     /* shift 2 bytes of EAX left */
03795                         mov ax, bx      /* copy BX into AX */
03796                         movd mm2, eax           /* copy EAX into MM2 */
03797                         movd mm3, eax           /* copy EAX into MM3 */
03798                         punpckldq mm2, mm3      /* fill higher words of MM2 with Nmin */
03799                         pxor mm7, mm7           /* zero MM7 register */
03800                         mov eax, Src1           /* load Src1 address into eax */
03801                         mov edi, Dest           /* load Dest address into edi */
03802                         mov ecx, SrcLength      /* load loop counter (SIZE) into ecx */
03803                         shr ecx, 3      /* counter/8 (MMX loads 8 bytes at a time) */
03804                         align 16                        /* 16 byte alignment of the loop entry */
03805 L1031:
03806                 movq mm3, [eax]         /* load 8 bytes from Src1 into MM3 */
03807                 movq mm4, mm3           /* copy MM3 into MM4  */
03808                         punpcklbw mm3, mm7      /* unpack low  bytes of SrcDest into words */
03809                         punpckhbw mm4, mm7      /* unpack high bytes of SrcDest into words */
03810                         psubusb mm3, mm1        /* S-Cmin, low  bytes */
03811                         psubusb mm4, mm1        /* S-Cmin, high bytes */
03812                         pmullw mm3, mm0         /* MM0*(S-Cmin), low  bytes */
03813                         pmullw mm4, mm0         /* MM0*(S-Cmin), high bytes */
03814                         paddusb mm3, mm2        /* MM0*(S-Cmin)+Nmin, low  bytes */
03815                         paddusb mm4, mm2        /* MM0*(S-Cmin)+Nmin, high bytes */
03816                         /* ** Take abs value of the signed words ** */
03817                         movq mm5, mm3           /* copy mm3 into mm5 */
03818                         movq mm6, mm4           /* copy mm4 into mm6 */
03819                         psraw mm5, 15           /* fill mm5 words with word sign bit */
03820                         psraw mm6, 15           /* fill mm6 words with word sign bit */
03821                         pxor mm3, mm5           /* take 1's compliment of only neg words */
03822                         pxor mm4, mm6           /* take 1's compliment of only neg words */
03823                         psubsw mm3, mm5         /* add 1 to only neg words, W-(-1) or W-0 */
03824                         psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
03825                         packuswb mm3, mm4       /* pack words back into bytes with saturation */
03826                         movq [edi], mm3         /* store result in Dest */
03827                         add eax, 8      /* increase Src1 register pointer by 8 */
03828                         add edi, 8      /* increase Dest register pointer by 8 */
03829                         dec              ecx            /* decrease loop counter */
03830                         jnz             L1031           /* check loop termination, proceed if required */
03831                         emms                            /* exit MMX state */
03832                         popa
03833         }
03834 #else
03835         /* i386 and x86_64 */
03836         __m64 *mSrc1 = (__m64*)Src1;
03837         __m64 *mDest = (__m64*)Dest;
03838         __m64 mm0, mm1, mm2, mm3;
03839 
03840         int i;
03841         /* Duplicate (Nmax-Nmin)/(Cmax-Cmin) in 4 words of MM0 */
03842         unsigned short a = Nmax - Nmin;
03843         unsigned short b = Cmax - Cmin;
03844         if (b == 0) {
03845             a = 255;
03846         } else {
03847             a /= b;
03848         }
03849         i = (a<<16)|a;
03850         mm0 = _m_from_int(i);
03851         mm1 = _m_from_int(i);
03852         mm0 = _m_punpckldq(mm0, mm1);                   /* fill higher words of MM0 with AX */
03853         /* Duplicate Cmin in 4 words of MM1 */
03854         i = (Cmin<<16)|(short)Cmin;
03855         mm1 = _m_from_int(i);
03856         mm2 = _m_from_int(i);
03857         mm1 = _m_punpckldq(mm1, mm2);                   /* fill higher words of MM1 with Cmin */
03858         /* Duplicate Nmin in 4 words of MM2 */
03859         i = (Nmin<<16)|(short)Nmin;
03860         mm2 = _m_from_int(i);
03861         mm3 = _m_from_int(i);
03862         mm2 = _m_punpckldq(mm2, mm3);                   /* fill higher words of MM2 with Nmin */
03863         __m64 mm7 = _m_from_int(0);                     /* zero mm0 register */
03864         for (i = 0; i < SrcLength/8; i++) {
03865                 __m64 mm3, mm4, mm5, mm6;
03866                 mm3 = _m_punpcklbw(*mSrc1, mm7);        /* unpack low  bytes of Src1 into words */
03867                 mm4 = _m_punpckhbw(*mSrc1, mm7);        /* unpack high bytes of Src1 into words */
03868                 mm3 = _m_psubusb(mm3, mm1);             /* S-Cmin, low  bytes */
03869                 mm4 = _m_psubusb(mm4, mm1);             /* S-Cmin, high bytes */
03870                 mm3 = _m_pmullw(mm3, mm0);              /* MM0*(S-Cmin), low  bytes */
03871                 mm4 = _m_pmullw(mm4, mm0);              /* MM0*(S-Cmin), high bytes */
03872                 mm3 = _m_paddusb(mm3, mm2);             /* MM0*(S-Cmin)+Nmin, low  bytes */
03873                 mm4 = _m_paddusb(mm4, mm2);             /* MM0*(S-Cmin)+Nmin, high bytes */
03874                 /* Take abs value of the signed words */
03875                 mm5 = _m_psrawi(mm3, 15);               /* fill mm5 words with word sign bit */
03876                 mm6 = _m_psrawi(mm4, 15);               /* fill mm6 words with word sign bit */
03877                 mm3 = _m_pxor(mm3, mm5);                /* take 1's compliment of only neg. words */
03878                 mm4 = _m_pxor(mm4, mm6);                /* take 1's compliment of only neg. words */
03879                 mm3 = _m_psubsw(mm3, mm5);              /* add 1 to only neg. words, W-(-1) or W-0 */
03880                 mm4 = _m_psubsw(mm4, mm6);              /* add 1 to only neg. words, W-(-1) or W-0 */
03881                 *mDest = _m_packuswb(mm3, mm4);         /* pack words back into bytes with saturation */
03882                 mSrc1++;
03883                 mDest++;
03884         }
03885         _m_empty();                                     /* clean MMX state */
03886 #endif
03887         return (0);
03888 #else
03889         return (-1);
03890 #endif
03891 }
03892 
03906 int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin,
03907                                                                    int Nmax)
03908 {
03909         unsigned int i, istart;
03910         unsigned char *cursrc;
03911         unsigned char *curdest;
03912         int dN, dC, factor;
03913         int result;
03914 
03915         /* Validate input parameters */
03916         if ((Src == NULL) || (Dest == NULL))
03917                 return(-1);
03918         if (length == 0)
03919                 return(0);
03920 
03921         if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
03922 
03923                 SDL_imageFilterNormalizeLinearMMX(Src, Dest, length, Cmin, Cmax, Nmin, Nmax);
03924 
03925                 /* Check for unaligned bytes */
03926                 if ((length & 7) > 0) {
03927                         /* Setup to process unaligned bytes */
03928                         istart = length & 0xfffffff8;
03929                         cursrc = &Src[istart];
03930                         curdest = &Dest[istart];
03931                 } else {
03932                         /* No unaligned bytes - we are done */
03933                         return (0);
03934                 }
03935         } else {
03936                 /* Setup to process whole image */
03937                 istart = 0;
03938                 cursrc = Src;
03939                 curdest = Dest;
03940         }
03941 
03942         /* C routine to process image */
03943         dC = Cmax - Cmin;
03944         if (dC == 0)
03945                 return (0);
03946         dN = Nmax - Nmin;
03947         factor = dN / dC;
03948         for (i = istart; i < length; i++) {
03949                 result = factor * ((int) (*cursrc) - Cmin) + Nmin;
03950                 if (result > 255)
03951                         result = 255;
03952                 *curdest = (unsigned char) result;
03953                 /* Advance pointers */
03954                 cursrc++;
03955                 curdest++;
03956         }
03957 
03958         return (0);
03959 }
03960 
03961 /* ------------------------------------------------------------------------------------ */
03962 
03977 int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
03978                                                                                    signed short *Kernel, unsigned char Divisor)
03979 {
03980         /* Validate input parameters */
03981         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
03982                 return(-1);
03983 
03984         if ((columns < 3) || (rows < 3) || (Divisor == 0))
03985                 return (-1);
03986 
03987         if ((SDL_imageFilterMMXdetect())) {
03988 //#ifdef USE_MMX
03989 #if defined(USE_MMX) && defined(i386)
03990 #if !defined(GCC__)
03991                 __asm
03992                 {
03993                         pusha
03994                                 pxor mm0, mm0           /* zero MM0 */
03995                                 xor ebx, ebx    /* zero EBX */
03996                                 mov bl, Divisor         /* load Divisor into BL */
03997                                 mov edx, Kernel         /* load Kernel address into EDX */
03998                                 movq mm5, [edx]         /* MM5 = {0,K2,K1,K0} */
03999                         add edx, 8      /* second row              |K0 K1 K2 0| */
04000                                 movq mm6, [edx]         /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
04001                         add edx, 8      /* third row               |K6 K7 K8 0| */
04002                                 movq mm7, [edx]         /* MM7 = {0,K8,K7,K6} */
04003                         /* ---, */
04004                         mov eax, columns        /* load columns into EAX */
04005                                 mov esi, Src    /* ESI = Src row 0 address */
04006                                 mov edi, Dest           /* load Dest address to EDI */
04007                                 add edi, eax    /* EDI = EDI + columns */
04008                                 inc              edi            /* 1 byte offset from the left edge */
04009                                 mov edx, rows           /* initialize ROWS counter */
04010                                 sub edx, 2      /* do not use first and last row */
04011                                 /* ---, */
04012 L10320:
04013                         mov ecx, eax    /* initialize COLUMS counter */
04014                                 sub ecx, 2      /* do not use first and last column */
04015                                 align 16                        /* 16 byte alignment of the loop entry */
04016 L10322:
04017                         /* ---, */
04018                         movq mm1, [esi]         /* load 8 bytes of the image first row */
04019                         add esi, eax    /* move one row below */
04020                                 movq mm2, [esi]         /* load 8 bytes of the image second row */
04021                         add esi, eax    /* move one row below */
04022                                 movq mm3, [esi]         /* load 8 bytes of the image third row */
04023                         punpcklbw mm1, mm0      /* unpack first 4 bytes into words */
04024                                 punpcklbw mm2, mm0      /* unpack first 4 bytes into words */
04025                                 punpcklbw mm3, mm0      /* unpack first 4 bytes into words */
04026                                 pmullw mm1, mm5         /* multiply words first row  image*Kernel */
04027                                 pmullw mm2, mm6         /* multiply words second row image*Kernel */
04028                                 pmullw mm3, mm7         /* multiply words third row  image*Kernel */
04029                                 paddsw mm1, mm2         /* add 4 words of the first and second rows */
04030                                 paddsw mm1, mm3         /* add 4 words of the third row and result */
04031                                 movq mm2, mm1           /* copy MM1 into MM2 */
04032                                 psrlq mm1, 32           /* shift 2 left words to the right */
04033                                 paddsw mm1, mm2         /* add 2 left and 2 right result words */
04034                                 movq mm3, mm1           /* copy MM1 into MM3 */
04035                                 psrlq mm1, 16           /* shift 1 left word to the right */
04036                                 paddsw mm1, mm3         /* add 1 left and 1 right result words */
04037                                 /* --, */
04038                                 movd mm2, eax           /* save EAX in MM2 */
04039                                 movd mm3, edx           /* save EDX in MM3 */
04040                                 movd eax, mm1           /* copy MM1 into EAX */
04041                                 psraw mm1, 15           /* spread sign bit of the result */
04042                                 movd edx, mm1           /* fill EDX with a sign bit */
04043                                 idiv bx         /* IDIV - VERY EXPENSIVE */
04044                                 movd mm1, eax           /* move result of division into MM1 */
04045                                 packuswb mm1, mm0       /* pack division result with saturation */
04046                                 movd eax, mm1           /* copy saturated result into EAX */
04047                                 mov [edi], al           /* copy a byte result into Dest */
04048                                 movd edx, mm3           /* restore saved EDX */
04049                                 movd eax, mm2           /* restore saved EAX */
04050                                 /* --, */
04051                                 sub esi, eax    /* move two rows up */
04052                                 sub esi, eax    /* */
04053                                 inc              esi            /* move Src  pointer to the next pixel */
04054                                 inc              edi            /* move Dest pointer to the next pixel */
04055                                 /* ---, */
04056                                 dec              ecx            /* decrease loop counter COLUMNS */
04057                                 jnz            L10322           /* check loop termination, proceed if required */
04058                                 add esi, 2      /* move to the next row in Src */
04059                                 add edi, 2      /* move to the next row in Dest */
04060                                 dec              edx            /* decrease loop counter ROWS */
04061                                 jnz            L10320           /* check loop termination, proceed if required */
04062                                 /* ---, */
04063                                 emms                            /* exit MMX state */
04064                                 popa
04065                 }
04066 #else
04067                 asm volatile
04068                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
04069                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
04070                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
04071                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
04072                         "movq    (%%edx), %%mm5 \n\t"   /* MM5 = {0,K2,K1,K0} */
04073                         "add          $8, %%edx \n\t"   /* second row              |K0 K1 K2 0| */
04074                         "movq    (%%edx), %%mm6 \n\t"   /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
04075                         "add          $8, %%edx \n\t"   /* third row               |K6 K7 K8 0| */
04076                         "movq    (%%edx), %%mm7 \n\t"   /* MM7 = {0,K8,K7,K6} */
04077                         /* --- */
04078                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
04079                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
04080                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
04081                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
04082                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
04083                         "mov          %2, %%edx \n\t"   /* initialize ROWS counter */
04084                         "sub          $2, %%edx \n\t"   /* do not use first and last row */
04085                         /* --- */
04086                         ".L10320:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMS counter */
04087                         "sub          $2, %%ecx \n\t"   /* do not use first and last column */
04088                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
04089                         ".L10322:               \n\t"
04090                         /* --- */
04091                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the image first row */
04092                         "add       %%eax, %%esi \n\t"   /* move one row below */
04093                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes of the image second row */
04094                         "add       %%eax, %%esi \n\t"   /* move one row below */
04095                         "movq    (%%esi), %%mm3 \n\t"   /* load 8 bytes of the image third row */
04096                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first 4 bytes into words */
04097                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack first 4 bytes into words */
04098                         "punpcklbw %%mm0, %%mm3 \n\t"   /* unpack first 4 bytes into words */
04099                         "pmullw    %%mm5, %%mm1 \n\t"   /* multiply words first row  image*Kernel */
04100                         "pmullw    %%mm6, %%mm2 \n\t"   /* multiply words second row image*Kernel */
04101                         "pmullw    %%mm7, %%mm3 \n\t"   /* multiply words third row  image*Kernel */
04102                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the first and second rows */
04103                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 4 words of the third row and result */
04104                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04105                         "psrlq       $32, %%mm1 \n\t"   /* shift 2 left words to the right */
04106                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 2 left and 2 right result words */
04107                         "movq      %%mm1, %%mm3 \n\t"   /* copy MM1 into MM3 */
04108                         "psrlq       $16, %%mm1 \n\t"   /* shift 1 left word to the right */
04109                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 1 left and 1 right result words */
04110                         /* -- */
04111                         "movd      %%eax, %%mm2 \n\t"   /* save EAX in MM2 */
04112                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
04113                         "movd      %%mm1, %%eax \n\t"   /* copy MM1 into EAX */
04114                         "psraw       $15, %%mm1 \n\t"   /* spread sign bit of the result */
04115                         "movd      %%mm1, %%edx \n\t"   /* fill EDX with a sign bit */
04116                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
04117                         "movd      %%eax, %%mm1 \n\t"   /* move result of division into MM1 */
04118                         "packuswb  %%mm0, %%mm1 \n\t"   /* pack division result with saturation */
04119                         "movd      %%mm1, %%eax \n\t"   /* copy saturated result into EAX */
04120                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
04121                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
04122                         "movd      %%mm2, %%eax \n\t"   /* restore saved EAX */
04123                         /* -- */
04124                         "sub       %%eax, %%esi \n\t"   /* move two rows up */
04125                         "sub       %%eax, %%esi \n\t"   /* */
04126                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
04127                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
04128                         /* --- */
04129                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
04130                         "jnz            .L10322 \n\t"   /* check loop termination, proceed if required */
04131                         "add          $2, %%esi \n\t"   /* move to the next row in Src */
04132                         "add          $2, %%edi \n\t"   /* move to the next row in Dest */
04133                         "dec              %%edx \n\t"   /* decrease loop counter ROWS */
04134                         "jnz            .L10320 \n\t"   /* check loop termination, proceed if required */
04135                         /* --- */
04136                         "emms                   \n\t"   /* exit MMX state */
04137                         "popa                   \n\t":"=m" (Dest)       /* %0 */
04138                         :"m"(Src),              /* %1 */
04139                         "m"(rows),              /* %2 */
04140                         "m"(columns),           /* %3 */
04141                         "m"(Kernel),            /* %4 */
04142                         "m"(Divisor)            /* %5 */
04143                         );
04144 #endif
04145 #endif
04146                 return (0);
04147         } else {
04148                 /* No non-MMX implementation yet */
04149                 return (-1);
04150         }
04151 }
04152 
04167 int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
04168                                                                                    signed short *Kernel, unsigned char Divisor)
04169 {
04170         /* Validate input parameters */
04171         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
04172                 return(-1);
04173 
04174         if ((columns < 5) || (rows < 5) || (Divisor == 0))
04175                 return (-1);
04176 
04177         if ((SDL_imageFilterMMXdetect())) {
04178 //#ifdef USE_MMX
04179 #if defined(USE_MMX) && defined(i386)
04180 #if !defined(GCC__)
04181                 __asm
04182                 {
04183                         pusha
04184                                 pxor mm0, mm0           /* zero MM0 */
04185                                 xor ebx, ebx    /* zero EBX */
04186                                 mov bl, Divisor         /* load Divisor into BL */
04187                                 movd mm5, ebx           /* copy Divisor into MM5 */
04188                                 mov edx, Kernel         /* load Kernel address into EDX */
04189                                 mov esi, Src    /* load Src  address to ESI */
04190                                 mov edi, Dest           /* load Dest address to EDI */
04191                                 add edi, 2      /* 2 column offset from the left edge */
04192                                 mov eax, columns        /* load columns into EAX */
04193                                 shl eax, 1      /* EAX = columns * 2 */
04194                                 add edi, eax    /* 2 row offset from the top edge */
04195                                 shr eax, 1      /* EAX = columns */
04196                                 mov ebx, rows           /* initialize ROWS counter */
04197                                 sub ebx, 4      /* do not use first 2 and last 2 rows */
04198                                 /* ---, */
04199 L10330:
04200                         mov ecx, eax    /* initialize COLUMNS counter */
04201                                 sub ecx, 4      /* do not use first 2 and last 2 columns */
04202                                 align 16                        /* 16 byte alignment of the loop entry */
04203 L10332:
04204                         pxor mm7, mm7           /* zero MM7 (accumulator) */
04205                                 movd mm6, esi           /* save ESI in MM6 */
04206                                 /* --- 1 */
04207                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04208                         movq mm2, mm1           /* copy MM1 into MM2 */
04209                                 add esi, eax    /* move Src pointer 1 row below */
04210                                 movq mm3, [edx]         /* load 4 words of Kernel */
04211                         add edx, 8      /* move pointer to other 4 words */
04212                                 movq mm4, [edx]         /* load 4 words of Kernel */
04213                         add edx, 8      /* move pointer to other 4 words */
04214                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04215                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04216                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04217                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04218                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04219                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04220                                 /* --- 2 */
04221                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04222                         movq mm2, mm1           /* copy MM1 into MM2 */
04223                                 add esi, eax    /* move Src pointer 1 row below */
04224                                 movq mm3, [edx]         /* load 4 words of Kernel */
04225                         add edx, 8      /* move pointer to other 4 words */
04226                                 movq mm4, [edx]         /* load 4 words of Kernel */
04227                         add edx, 8      /* move pointer to other 4 words */
04228                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04229                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04230                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04231                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04232                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04233                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04234                                 /* --- 3 */
04235                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04236                         movq mm2, mm1           /* copy MM1 into MM2 */
04237                                 add esi, eax    /* move Src pointer 1 row below */
04238                                 movq mm3, [edx]         /* load 4 words of Kernel */
04239                         add edx, 8      /* move pointer to other 4 words */
04240                                 movq mm4, [edx]         /* load 4 words of Kernel */
04241                         add edx, 8      /* move pointer to other 4 words */
04242                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04243                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04244                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04245                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04246                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04247                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04248                                 /* --- 4 */
04249                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04250                         movq mm2, mm1           /* copy MM1 into MM2 */
04251                                 add esi, eax    /* move Src pointer 1 row below */
04252                                 movq mm3, [edx]         /* load 4 words of Kernel */
04253                         add edx, 8      /* move pointer to other 4 words */
04254                                 movq mm4, [edx]         /* load 4 words of Kernel */
04255                         add edx, 8      /* move pointer to other 4 words */
04256                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04257                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04258                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04259                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04260                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04261                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04262                                 /* --- 5 */
04263                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04264                         movq mm2, mm1           /* copy MM1 into MM2 */
04265                                 movq mm3, [edx]         /* load 4 words of Kernel */
04266                         add edx, 8      /* move pointer to other 4 words */
04267                                 movq mm4, [edx]         /* load 4 words of Kernel */
04268                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04269                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04270                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04271                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04272                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04273                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04274                                 /* ---, */
04275                                 movq mm3, mm7           /* copy MM7 into MM3 */
04276                                 psrlq mm7, 32           /* shift 2 left words to the right */
04277                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
04278                                 movq mm2, mm7           /* copy MM7 into MM2 */
04279                                 psrlq mm7, 16           /* shift 1 left word to the right */
04280                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
04281                                 /* ---, */
04282                                 movd mm1, eax           /* save EDX in MM1 */
04283                                 movd mm2, ebx           /* save EDX in MM2 */
04284                                 movd mm3, edx           /* save EDX in MM3 */
04285                                 movd eax, mm7           /* load summation result into EAX */
04286                                 psraw mm7, 15           /* spread sign bit of the result */
04287                                 movd ebx, mm5           /* load Divisor into EBX */
04288                                 movd edx, mm7           /* fill EDX with a sign bit */
04289                                 idiv bx         /* IDIV - VERY EXPENSIVE */
04290                                 movd mm7, eax           /* move result of division into MM7 */
04291                                 packuswb mm7, mm0       /* pack division result with saturation */
04292                                 movd eax, mm7           /* copy saturated result into EAX */
04293                                 mov [edi], al           /* copy a byte result into Dest */
04294                                 movd edx, mm3           /* restore saved EDX */
04295                                 movd ebx, mm2           /* restore saved EBX */
04296                                 movd eax, mm1           /* restore saved EAX */
04297                                 /* --, */
04298                                 movd esi, mm6           /* move Src pointer to the top pixel */
04299                                 sub edx, 72     /* EDX = Kernel address */
04300                                 inc              esi            /* move Src  pointer to the next pixel */
04301                                 inc              edi            /* move Dest pointer to the next pixel */
04302                                 /* ---, */
04303                                 dec              ecx            /* decrease loop counter COLUMNS */
04304                                 jnz            L10332           /* check loop termination, proceed if required */
04305                                 add esi, 4      /* move to the next row in Src */
04306                                 add edi, 4      /* move to the next row in Dest */
04307                                 dec              ebx            /* decrease loop counter ROWS */
04308                                 jnz            L10330           /* check loop termination, proceed if required */
04309                                 /* ---, */
04310                                 emms                            /* exit MMX state */
04311                                 popa
04312                 }
04313 #else
04314                 asm volatile
04315                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
04316                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
04317                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
04318                         "movd      %%ebx, %%mm5 \n\t"   /* copy Divisor into MM5 */
04319                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
04320                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
04321                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
04322                         "add          $2, %%edi \n\t"   /* 2 column offset from the left edge */
04323                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
04324                         "shl          $1, %%eax \n\t"   /* EAX = columns * 2 */
04325                         "add       %%eax, %%edi \n\t"   /* 2 row offset from the top edge */
04326                         "shr          $1, %%eax \n\t"   /* EAX = columns */
04327                         "mov          %2, %%ebx \n\t"   /* initialize ROWS counter */
04328                         "sub          $4, %%ebx \n\t"   /* do not use first 2 and last 2 rows */
04329                         /* --- */
04330                         ".L10330:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
04331                         "sub          $4, %%ecx \n\t"   /* do not use first 2 and last 2 columns */
04332                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
04333                         ".L10332:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
04334                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
04335                         /* --- 1 */
04336                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04337                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04338                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04339                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04340                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04341                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04342                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04343                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04344                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04345                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04346                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04347                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04348                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04349                         /* --- 2 */
04350                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04351                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04352                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04353                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04354                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04355                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04356                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04357                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04358                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04359                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04360                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04361                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04362                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04363                         /* --- 3 */
04364                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04365                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04366                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04367                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04368                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04369                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04370                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04371                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04372                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04373                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04374                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04375                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04376                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04377                         /* --- 4 */
04378                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04379                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04380                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04381                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04382                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04383                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04384                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04385                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04386                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04387                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04388                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04389                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04390                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04391                         /* --- 5 */
04392                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04393                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04394                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04395                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04396                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04397                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04398                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04399                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04400                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04401                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04402                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04403                         /* --- */
04404                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
04405                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
04406                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
04407                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
04408                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
04409                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
04410                         /* --- */
04411                         "movd      %%eax, %%mm1 \n\t"   /* save EDX in MM1 */
04412                         "movd      %%ebx, %%mm2 \n\t"   /* save EDX in MM2 */
04413                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
04414                         "movd      %%mm7, %%eax \n\t"   /* load summation result into EAX */
04415                         "psraw       $15, %%mm7 \n\t"   /* spread sign bit of the result */
04416                         "movd      %%mm5, %%ebx \n\t"   /* load Divisor into EBX */
04417                         "movd      %%mm7, %%edx \n\t"   /* fill EDX with a sign bit */
04418                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
04419                         "movd      %%eax, %%mm7 \n\t"   /* move result of division into MM7 */
04420                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
04421                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
04422                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
04423                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
04424                         "movd      %%mm2, %%ebx \n\t"   /* restore saved EBX */
04425                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
04426                         /* -- */
04427                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
04428                         "sub         $72, %%edx \n\t"   /* EDX = Kernel address */
04429                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
04430                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
04431                         /* --- */
04432                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
04433                         "jnz            .L10332 \n\t"   /* check loop termination, proceed if required */
04434                         "add          $4, %%esi \n\t"   /* move to the next row in Src */
04435                         "add          $4, %%edi \n\t"   /* move to the next row in Dest */
04436                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
04437                         "jnz            .L10330 \n\t"   /* check loop termination, proceed if required */
04438                         /* --- */
04439                         "emms                   \n\t"   /* exit MMX state */
04440                         "popa                   \n\t":"=m" (Dest)       /* %0 */
04441                         :"m"(Src),              /* %1 */
04442                         "m"(rows),              /* %2 */
04443                         "m"(columns),           /* %3 */
04444                         "m"(Kernel),            /* %4 */
04445                         "m"(Divisor)            /* %5 */
04446                         );
04447 #endif
04448 #endif
04449                 return (0);
04450         } else {
04451                 /* No non-MMX implementation yet */
04452                 return (-1);
04453         }
04454 }
04455 
04470 int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
04471                                                                                    signed short *Kernel, unsigned char Divisor)
04472 {
04473         /* Validate input parameters */
04474         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
04475                 return(-1);
04476 
04477         if ((columns < 7) || (rows < 7) || (Divisor == 0))
04478                 return (-1);
04479 
04480         if ((SDL_imageFilterMMXdetect())) {
04481 //#ifdef USE_MMX
04482 #if defined(USE_MMX) && defined(i386)
04483 #if !defined(GCC__)
04484                 __asm
04485                 {
04486                         pusha
04487                                 pxor mm0, mm0           /* zero MM0 */
04488                                 xor ebx, ebx    /* zero EBX */
04489                                 mov bl, Divisor         /* load Divisor into BL */
04490                                 movd mm5, ebx           /* copy Divisor into MM5 */
04491                                 mov edx, Kernel         /* load Kernel address into EDX */
04492                                 mov esi, Src    /* load Src  address to ESI */
04493                                 mov edi, Dest           /* load Dest address to EDI */
04494                                 add edi, 3      /* 3 column offset from the left edge */
04495                                 mov eax, columns        /* load columns into EAX */
04496                                 add edi, eax    /* 3 row offset from the top edge */
04497                                 add edi, eax
04498                                 add edi, eax
04499                                 mov ebx, rows           /* initialize ROWS counter */
04500                                 sub ebx, 6      /* do not use first 3 and last 3 rows */
04501                                 /* ---, */
04502 L10340:
04503                         mov ecx, eax    /* initialize COLUMNS counter */
04504                                 sub ecx, 6      /* do not use first 3 and last 3 columns */
04505                                 align 16                        /* 16 byte alignment of the loop entry */
04506 L10342:
04507                         pxor mm7, mm7           /* zero MM7 (accumulator) */
04508                                 movd mm6, esi           /* save ESI in MM6 */
04509                                 /* --- 1 */
04510                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04511                         movq mm2, mm1           /* copy MM1 into MM2 */
04512                                 add esi, eax    /* move Src pointer 1 row below */
04513                                 movq mm3, [edx]         /* load 4 words of Kernel */
04514                         add edx, 8      /* move pointer to other 4 words */
04515                                 movq mm4, [edx]         /* load 4 words of Kernel */
04516                         add edx, 8      /* move pointer to other 4 words */
04517                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04518                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04519                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04520                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04521                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04522                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04523                                 /* --- 2 */
04524                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04525                         movq mm2, mm1           /* copy MM1 into MM2 */
04526                                 add esi, eax    /* move Src pointer 1 row below */
04527                                 movq mm3, [edx]         /* load 4 words of Kernel */
04528                         add edx, 8      /* move pointer to other 4 words */
04529                                 movq mm4, [edx]         /* load 4 words of Kernel */
04530                         add edx, 8      /* move pointer to other 4 words */
04531                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04532                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04533                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04534                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04535                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04536                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04537                                 /* --- 3 */
04538                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04539                         movq mm2, mm1           /* copy MM1 into MM2 */
04540                                 add esi, eax    /* move Src pointer 1 row below */
04541                                 movq mm3, [edx]         /* load 4 words of Kernel */
04542                         add edx, 8      /* move pointer to other 4 words */
04543                                 movq mm4, [edx]         /* load 4 words of Kernel */
04544                         add edx, 8      /* move pointer to other 4 words */
04545                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04546                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04547                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04548                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04549                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04550                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04551                                 /* --- 4 */
04552                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04553                         movq mm2, mm1           /* copy MM1 into MM2 */
04554                                 add esi, eax    /* move Src pointer 1 row below */
04555                                 movq mm3, [edx]         /* load 4 words of Kernel */
04556                         add edx, 8      /* move pointer to other 4 words */
04557                                 movq mm4, [edx]         /* load 4 words of Kernel */
04558                         add edx, 8      /* move pointer to other 4 words */
04559                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04560                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04561                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04562                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04563                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04564                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04565                                 /* --- 5 */
04566                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04567                         movq mm2, mm1           /* copy MM1 into MM2 */
04568                                 add esi, eax    /* move Src pointer 1 row below */
04569                                 movq mm3, [edx]         /* load 4 words of Kernel */
04570                         add edx, 8      /* move pointer to other 4 words */
04571                                 movq mm4, [edx]         /* load 4 words of Kernel */
04572                         add edx, 8      /* move pointer to other 4 words */
04573                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04574                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04575                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04576                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04577                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04578                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04579                                 /* --- 6 */
04580                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04581                         movq mm2, mm1           /* copy MM1 into MM2 */
04582                                 add esi, eax    /* move Src pointer 1 row below */
04583                                 movq mm3, [edx]         /* load 4 words of Kernel */
04584                         add edx, 8      /* move pointer to other 4 words */
04585                                 movq mm4, [edx]         /* load 4 words of Kernel */
04586                         add edx, 8      /* move pointer to other 4 words */
04587                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04588                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04589                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04590                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04591                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04592                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04593                                 /* --- 7 */
04594                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04595                         movq mm2, mm1           /* copy MM1 into MM2 */
04596                                 movq mm3, [edx]         /* load 4 words of Kernel */
04597                         add edx, 8      /* move pointer to other 4 words */
04598                                 movq mm4, [edx]         /* load 4 words of Kernel */
04599                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04600                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04601                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
04602                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
04603                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04604                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04605                                 /* ---, */
04606                                 movq mm3, mm7           /* copy MM7 into MM3 */
04607                                 psrlq mm7, 32           /* shift 2 left words to the right */
04608                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
04609                                 movq mm2, mm7           /* copy MM7 into MM2 */
04610                                 psrlq mm7, 16           /* shift 1 left word to the right */
04611                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
04612                                 /* ---, */
04613                                 movd mm1, eax           /* save EDX in MM1 */
04614                                 movd mm2, ebx           /* save EDX in MM2 */
04615                                 movd mm3, edx           /* save EDX in MM3 */
04616                                 movd eax, mm7           /* load summation result into EAX */
04617                                 psraw mm7, 15           /* spread sign bit of the result */
04618                                 movd ebx, mm5           /* load Divisor into EBX */
04619                                 movd edx, mm7           /* fill EDX with a sign bit */
04620                                 idiv bx         /* IDIV - VERY EXPENSIVE */
04621                                 movd mm7, eax           /* move result of division into MM7 */
04622                                 packuswb mm7, mm0       /* pack division result with saturation */
04623                                 movd eax, mm7           /* copy saturated result into EAX */
04624                                 mov [edi], al           /* copy a byte result into Dest */
04625                                 movd edx, mm3           /* restore saved EDX */
04626                                 movd ebx, mm2           /* restore saved EBX */
04627                                 movd eax, mm1           /* restore saved EAX */
04628                                 /* --, */
04629                                 movd esi, mm6           /* move Src pointer to the top pixel */
04630                                 sub edx, 104    /* EDX = Kernel address */
04631                                 inc              esi            /* move Src  pointer to the next pixel */
04632                                 inc              edi            /* move Dest pointer to the next pixel */
04633                                 /* ---, */
04634                                 dec              ecx            /* decrease loop counter COLUMNS */
04635                                 jnz            L10342           /* check loop termination, proceed if required */
04636                                 add esi, 6      /* move to the next row in Src */
04637                                 add edi, 6      /* move to the next row in Dest */
04638                                 dec              ebx            /* decrease loop counter ROWS */
04639                                 jnz            L10340           /* check loop termination, proceed if required */
04640                                 /* ---, */
04641                                 emms                            /* exit MMX state */
04642                                 popa
04643                 }
04644 #else
04645                 asm volatile
04646                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
04647                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
04648                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
04649                         "movd      %%ebx, %%mm5 \n\t"   /* copy Divisor into MM5 */
04650                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
04651                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
04652                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
04653                         "add          $3, %%edi \n\t"   /* 3 column offset from the left edge */
04654                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
04655                         "add       %%eax, %%edi \n\t"   /* 3 row offset from the top edge */
04656                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t"       /* initialize ROWS counter */
04657                         "sub          $6, %%ebx \n\t"   /* do not use first 3 and last 3 rows */
04658                         /* --- */
04659                         ".L10340:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
04660                         "sub          $6, %%ecx \n\t"   /* do not use first 3 and last 3 columns */
04661                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
04662                         ".L10342:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
04663                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
04664                         /* --- 1 */
04665                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04666                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04667                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04668                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04669                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04670                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04671                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04672                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04673                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04674                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04675                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04676                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04677                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04678                         /* --- 2 */
04679                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04680                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04681                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04682                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04683                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04684                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04685                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04686                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04687                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04688                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04689                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04690                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04691                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04692                         /* --- 3 */
04693                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04694                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04695                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04696                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04697                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04698                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04699                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04700                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04701                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04702                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04703                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04704                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04705                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04706                         /* --- 4 */
04707                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04708                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04709                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04710                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04711                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04712                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04713                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04714                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04715                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04716                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04717                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04718                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04719                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04720                         /* --- 5 */
04721                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04722                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04723                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04724                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04725                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04726                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04727                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04728                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04729                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04730                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04731                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04732                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04733                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04734                         /* --- 6 */
04735                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04736                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04737                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
04738                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04739                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04740                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04741                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04742                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04743                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04744                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04745                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04746                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04747                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04748                         /* --- 7 */
04749                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
04750                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
04751                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
04752                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
04753                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
04754                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
04755                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
04756                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
04757                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
04758                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
04759                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
04760                         /* --- */
04761                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
04762                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
04763                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
04764                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
04765                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
04766                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
04767                         /* --- */
04768                         "movd      %%eax, %%mm1 \n\t"   /* save EDX in MM1 */
04769                         "movd      %%ebx, %%mm2 \n\t"   /* save EDX in MM2 */
04770                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
04771                         "movd      %%mm7, %%eax \n\t"   /* load summation result into EAX */
04772                         "psraw       $15, %%mm7 \n\t"   /* spread sign bit of the result */
04773                         "movd      %%mm5, %%ebx \n\t"   /* load Divisor into EBX */
04774                         "movd      %%mm7, %%edx \n\t"   /* fill EDX with a sign bit */
04775                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
04776                         "movd      %%eax, %%mm7 \n\t"   /* move result of division into MM7 */
04777                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
04778                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
04779                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
04780                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
04781                         "movd      %%mm2, %%ebx \n\t"   /* restore saved EBX */
04782                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
04783                         /* -- */
04784                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
04785                         "sub        $104, %%edx \n\t"   /* EDX = Kernel address */
04786                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
04787                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
04788                         /* --- */
04789                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
04790                         "jnz            .L10342 \n\t"   /* check loop termination, proceed if required */
04791                         "add          $6, %%esi \n\t"   /* move to the next row in Src */
04792                         "add          $6, %%edi \n\t"   /* move to the next row in Dest */
04793                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
04794                         "jnz            .L10340 \n\t"   /* check loop termination, proceed if required */
04795                         /* --- */
04796                         "emms                   \n\t"   /* exit MMX state */
04797                         "popa                   \n\t":"=m" (Dest)       /* %0 */
04798                         :"m"(Src),              /* %1 */
04799                         "m"(rows),              /* %2 */
04800                         "m"(columns),           /* %3 */
04801                         "m"(Kernel),            /* %4 */
04802                         "m"(Divisor)            /* %5 */
04803                         );
04804 #endif
04805 #endif
04806                 return (0);
04807         } else {
04808                 /* No non-MMX implementation yet */
04809                 return (-1);
04810         }
04811 }
04812 
04827 int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
04828                                                                                    signed short *Kernel, unsigned char Divisor)
04829 {
04830         /* Validate input parameters */
04831         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
04832                 return(-1);
04833 
04834         if ((columns < 9) || (rows < 9) || (Divisor == 0))
04835                 return (-1);
04836 
04837         if ((SDL_imageFilterMMXdetect())) {
04838 //#ifdef USE_MMX
04839 #if defined(USE_MMX) && defined(i386)
04840 #if !defined(GCC__)
04841                 __asm
04842                 {
04843                         pusha
04844                                 pxor mm0, mm0           /* zero MM0 */
04845                                 xor ebx, ebx    /* zero EBX */
04846                                 mov bl, Divisor         /* load Divisor into BL */
04847                                 movd mm5, ebx           /* copy Divisor into MM5 */
04848                                 mov edx, Kernel         /* load Kernel address into EDX */
04849                                 mov esi, Src    /* load Src  address to ESI */
04850                                 mov edi, Dest           /* load Dest address to EDI */
04851                                 add edi, 4      /* 4 column offset from the left edge */
04852                                 mov eax, columns        /* load columns into EAX */
04853                                 add edi, eax    /* 4 row offset from the top edge */
04854                                 add edi, eax
04855                                 add edi, eax
04856                                 add edi, eax
04857                                 mov ebx, rows           /* initialize ROWS counter */
04858                                 sub ebx, 8      /* do not use first 4 and last 4 rows */
04859                                 /* ---, */
04860 L10350:
04861                         mov ecx, eax    /* initialize COLUMNS counter */
04862                                 sub ecx, 8      /* do not use first 4 and last 4 columns */
04863                                 align 16                        /* 16 byte alignment of the loop entry */
04864 L10352:
04865                         pxor mm7, mm7           /* zero MM7 (accumulator) */
04866                                 movd mm6, esi           /* save ESI in MM6 */
04867                                 /* --- 1 */
04868                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04869                         movq mm2, mm1           /* copy MM1 into MM2 */
04870                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04871                                 movq mm3, [edx]         /* load 4 words of Kernel */
04872                         add edx, 8      /* move pointer to other 4 words */
04873                                 movq mm4, [edx]         /* load 4 words of Kernel */
04874                         add edx, 8      /* move pointer to other 4 words */
04875                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04876                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04877                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04878                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04879                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04880                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04881                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04882                         dec              esi
04883                                 add esi, eax    /* move Src pointer 1 row below */
04884                                 movq mm3, [edx]         /* load 4 words of Kernel */
04885                         add edx, 8      /* move pointer to other 4 words */
04886                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04887                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04888                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04889                                 /* --- 2 */
04890                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04891                         movq mm2, mm1           /* copy MM1 into MM2 */
04892                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04893                                 movq mm3, [edx]         /* load 4 words of Kernel */
04894                         add edx, 8      /* move pointer to other 4 words */
04895                                 movq mm4, [edx]         /* load 4 words of Kernel */
04896                         add edx, 8      /* move pointer to other 4 words */
04897                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04898                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04899                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04900                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04901                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04902                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04903                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04904                         dec              esi
04905                                 add esi, eax    /* move Src pointer 1 row below */
04906                                 movq mm3, [edx]         /* load 4 words of Kernel */
04907                         add edx, 8      /* move pointer to other 4 words */
04908                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04909                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04910                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04911                                 /* --- 3 */
04912                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04913                         movq mm2, mm1           /* copy MM1 into MM2 */
04914                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04915                                 movq mm3, [edx]         /* load 4 words of Kernel */
04916                         add edx, 8      /* move pointer to other 4 words */
04917                                 movq mm4, [edx]         /* load 4 words of Kernel */
04918                         add edx, 8      /* move pointer to other 4 words */
04919                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04920                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04921                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04922                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04923                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04924                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04925                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04926                         dec              esi
04927                                 add esi, eax    /* move Src pointer 1 row below */
04928                                 movq mm3, [edx]         /* load 4 words of Kernel */
04929                         add edx, 8      /* move pointer to other 4 words */
04930                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04931                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04932                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04933                                 /* --- 4 */
04934                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04935                         movq mm2, mm1           /* copy MM1 into MM2 */
04936                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04937                                 movq mm3, [edx]         /* load 4 words of Kernel */
04938                         add edx, 8      /* move pointer to other 4 words */
04939                                 movq mm4, [edx]         /* load 4 words of Kernel */
04940                         add edx, 8      /* move pointer to other 4 words */
04941                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04942                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04943                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04944                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04945                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04946                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04947                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04948                         dec              esi
04949                                 add esi, eax    /* move Src pointer 1 row below */
04950                                 movq mm3, [edx]         /* load 4 words of Kernel */
04951                         add edx, 8      /* move pointer to other 4 words */
04952                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04953                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04954                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04955                                 /* --- 5 */
04956                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04957                         movq mm2, mm1           /* copy MM1 into MM2 */
04958                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04959                                 movq mm3, [edx]         /* load 4 words of Kernel */
04960                         add edx, 8      /* move pointer to other 4 words */
04961                                 movq mm4, [edx]         /* load 4 words of Kernel */
04962                         add edx, 8      /* move pointer to other 4 words */
04963                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04964                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04965                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04966                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04967                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04968                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04969                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04970                         dec              esi
04971                                 add esi, eax    /* move Src pointer 1 row below */
04972                                 movq mm3, [edx]         /* load 4 words of Kernel */
04973                         add edx, 8      /* move pointer to other 4 words */
04974                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04975                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04976                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04977                                 /* --- 6 */
04978                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04979                         movq mm2, mm1           /* copy MM1 into MM2 */
04980                                 inc              esi            /* move pointer to the next 8 bytes of Src */
04981                                 movq mm3, [edx]         /* load 4 words of Kernel */
04982                         add edx, 8      /* move pointer to other 4 words */
04983                                 movq mm4, [edx]         /* load 4 words of Kernel */
04984                         add edx, 8      /* move pointer to other 4 words */
04985                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04986                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
04987                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04988                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
04989                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
04990                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04991                                 movq mm1, [esi]         /* load 8 bytes of the Src */
04992                         dec              esi
04993                                 add esi, eax    /* move Src pointer 1 row below */
04994                                 movq mm3, [edx]         /* load 4 words of Kernel */
04995                         add edx, 8      /* move pointer to other 4 words */
04996                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
04997                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
04998                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
04999                                 /* --- 7 */
05000                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05001                         movq mm2, mm1           /* copy MM1 into MM2 */
05002                                 inc              esi            /* move pointer to the next 8 bytes of Src */
05003                                 movq mm3, [edx]         /* load 4 words of Kernel */
05004                         add edx, 8      /* move pointer to other 4 words */
05005                                 movq mm4, [edx]         /* load 4 words of Kernel */
05006                         add edx, 8      /* move pointer to other 4 words */
05007                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05008                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05009                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05010                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
05011                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05012                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05013                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05014                         dec              esi
05015                                 add esi, eax    /* move Src pointer 1 row below */
05016                                 movq mm3, [edx]         /* load 4 words of Kernel */
05017                         add edx, 8      /* move pointer to other 4 words */
05018                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05019                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05020                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05021                                 /* --- 8 */
05022                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05023                         movq mm2, mm1           /* copy MM1 into MM2 */
05024                                 inc              esi            /* move pointer to the next 8 bytes of Src */
05025                                 movq mm3, [edx]         /* load 4 words of Kernel */
05026                         add edx, 8      /* move pointer to other 4 words */
05027                                 movq mm4, [edx]         /* load 4 words of Kernel */
05028                         add edx, 8      /* move pointer to other 4 words */
05029                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05030                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05031                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05032                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
05033                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05034                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05035                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05036                         dec              esi
05037                                 add esi, eax    /* move Src pointer 1 row below */
05038                                 movq mm3, [edx]         /* load 4 words of Kernel */
05039                         add edx, 8      /* move pointer to other 4 words */
05040                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05041                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05042                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05043                                 /* --- 9 */
05044                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05045                         movq mm2, mm1           /* copy MM1 into MM2 */
05046                                 inc              esi            /* move pointer to the next 8 bytes of Src */
05047                                 movq mm3, [edx]         /* load 4 words of Kernel */
05048                         add edx, 8      /* move pointer to other 4 words */
05049                                 movq mm4, [edx]         /* load 4 words of Kernel */
05050                         add edx, 8      /* move pointer to other 4 words */
05051                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05052                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05053                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05054                                 pmullw mm2, mm4         /* mult. 4 high words of Src and Kernel */
05055                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05056                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05057                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05058                         movq mm3, [edx]         /* load 4 words of Kernel */
05059                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05060                                 pmullw mm1, mm3         /* mult. 4 low  words of Src and Kernel */
05061                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05062                                 /* ---, */
05063                                 movq mm3, mm7           /* copy MM7 into MM3 */
05064                                 psrlq mm7, 32           /* shift 2 left words to the right */
05065                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
05066                                 movq mm2, mm7           /* copy MM7 into MM2 */
05067                                 psrlq mm7, 16           /* shift 1 left word to the right */
05068                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
05069                                 /* ---, */
05070                                 movd mm1, eax           /* save EDX in MM1 */
05071                                 movd mm2, ebx           /* save EDX in MM2 */
05072                                 movd mm3, edx           /* save EDX in MM3 */
05073                                 movd eax, mm7           /* load summation result into EAX */
05074                                 psraw mm7, 15           /* spread sign bit of the result */
05075                                 movd ebx, mm5           /* load Divisor into EBX */
05076                                 movd edx, mm7           /* fill EDX with a sign bit */
05077                                 idiv bx         /* IDIV - VERY EXPENSIVE */
05078                                 movd mm7, eax           /* move result of division into MM7 */
05079                                 packuswb mm7, mm0       /* pack division result with saturation */
05080                                 movd eax, mm7           /* copy saturated result into EAX */
05081                                 mov [edi], al           /* copy a byte result into Dest */
05082                                 movd edx, mm3           /* restore saved EDX */
05083                                 movd ebx, mm2           /* restore saved EBX */
05084                                 movd eax, mm1           /* restore saved EAX */
05085                                 /* --, */
05086                                 movd esi, mm6           /* move Src pointer to the top pixel */
05087                                 sub edx, 208    /* EDX = Kernel address */
05088                                 inc              esi            /* move Src  pointer to the next pixel */
05089                                 inc              edi            /* move Dest pointer to the next pixel */
05090                                 /* ---, */
05091                                 dec              ecx            /* decrease loop counter COLUMNS */
05092                                 jnz            L10352           /* check loop termination, proceed if required */
05093                                 add esi, 8      /* move to the next row in Src */
05094                                 add edi, 8      /* move to the next row in Dest */
05095                                 dec              ebx            /* decrease loop counter ROWS */
05096                                 jnz            L10350           /* check loop termination, proceed if required */
05097                                 /* ---, */
05098                                 emms                            /* exit MMX state */
05099                                 popa
05100                 }
05101 #else
05102                 asm volatile
05103                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
05104                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
05105                         "mov           %5, %%bl \n\t"   /* load Divisor into BL */
05106                         "movd      %%ebx, %%mm5 \n\t"   /* copy Divisor into MM5 */
05107                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
05108                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
05109                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
05110                         "add          $4, %%edi \n\t"   /* 4 column offset from the left edge */
05111                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
05112                         "add       %%eax, %%edi \n\t"   /* 4 row offset from the top edge */
05113                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t" /* initialize ROWS counter */
05114                         "sub          $8, %%ebx \n\t"   /* do not use first 4 and last 4 rows */
05115                         /* --- */
05116                         ".L10350:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
05117                         "sub          $8, %%ecx \n\t"   /* do not use first 4 and last 4 columns */
05118                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
05119                         ".L10352:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
05120                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
05121                         /* --- 1 */
05122                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05123                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05124                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05125                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05126                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05127                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05128                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05129                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05130                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05131                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05132                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05133                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05134                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05135                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05136                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05137                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05138                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05139                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05140                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05141                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05142                         /* --- 2 */
05143                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05144                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05145                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05146                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05147                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05148                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05149                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05150                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05151                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05152                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05153                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05154                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05155                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05156                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05157                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05158                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05159                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05160                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05161                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05162                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05163                         /* --- 3 */
05164                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05165                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05166                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05167                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05168                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05169                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05170                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05171                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05172                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05173                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05174                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05175                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05176                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05177                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05178                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05179                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05180                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05181                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05182                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05183                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05184                         /* --- 4 */
05185                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05186                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05187                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05188                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05189                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05190                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05191                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05192                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05193                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05194                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05195                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05196                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05197                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05198                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05199                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05200                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05201                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05202                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05203                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05204                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05205                         /* --- 5 */
05206                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05207                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05208                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05209                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05210                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05211                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05212                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05213                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05214                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05215                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05216                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05217                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05218                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05219                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05220                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05221                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05222                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05223                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05224                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05225                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05226                         /* --- 6 */
05227                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05228                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05229                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05230                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05231                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05232                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05233                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05234                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05235                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05236                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05237                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05238                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05239                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05240                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05241                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05242                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05243                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05244                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05245                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05246                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05247                         /* --- 7 */
05248                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05249                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05250                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05251                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05252                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05253                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05254                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05255                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05256                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05257                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05258                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05259                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05260                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05261                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05262                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05263                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05264                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05265                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05266                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05267                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05268                         /* --- 8 */
05269                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05270                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05271                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05272                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05273                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05274                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05275                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05276                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05277                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05278                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05279                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05280                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05281                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05282                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05283                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
05284                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05285                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05286                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05287                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05288                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05289                         /* --- 9 */
05290                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05291                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05292                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
05293                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05294                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05295                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05296                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05297                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05298                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05299                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05300                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05301                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05302                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05303                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05304                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05305                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05306                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05307                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05308                         /* --- */
05309                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
05310                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
05311                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
05312                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
05313                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
05314                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
05315                         /* --- */
05316                         "movd      %%eax, %%mm1 \n\t"   /* save EDX in MM1 */
05317                         "movd      %%ebx, %%mm2 \n\t"   /* save EDX in MM2 */
05318                         "movd      %%edx, %%mm3 \n\t"   /* save EDX in MM3 */
05319                         "movd      %%mm7, %%eax \n\t"   /* load summation result into EAX */
05320                         "psraw       $15, %%mm7 \n\t"   /* spread sign bit of the result */
05321                         "movd      %%mm5, %%ebx \n\t"   /* load Divisor into EBX */
05322                         "movd      %%mm7, %%edx \n\t"   /* fill EDX with a sign bit */
05323                         "idivw             %%bx \n\t"   /* IDIV - VERY EXPENSIVE */
05324                         "movd      %%eax, %%mm7 \n\t"   /* move result of division into MM7 */
05325                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
05326                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
05327                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
05328                         "movd      %%mm3, %%edx \n\t"   /* restore saved EDX */
05329                         "movd      %%mm2, %%ebx \n\t"   /* restore saved EBX */
05330                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
05331                         /* -- */
05332                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
05333                         "sub        $208, %%edx \n\t"   /* EDX = Kernel address */
05334                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
05335                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
05336                         /* --- */
05337                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
05338                         "jnz            .L10352 \n\t"   /* check loop termination, proceed if required */
05339                         "add          $8, %%esi \n\t"   /* move to the next row in Src */
05340                         "add          $8, %%edi \n\t"   /* move to the next row in Dest */
05341                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
05342                         "jnz            .L10350 \n\t"   /* check loop termination, proceed if required */
05343                         /* --- */
05344                         "emms                   \n\t"   /* exit MMX state */
05345                         "popa                   \n\t":"=m" (Dest)       /* %0 */
05346                         :"m"(Src),              /* %1 */
05347                         "m"(rows),              /* %2 */
05348                         "m"(columns),           /* %3 */
05349                         "m"(Kernel),            /* %4 */
05350                         "m"(Divisor)            /* %5 */
05351                         );
05352 #endif
05353 #endif
05354                 return (0);
05355         } else {
05356                 /* No non-MMX implementation yet */
05357                 return (-1);
05358         }
05359 }
05360 
05375 int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
05376                                                                                            signed short *Kernel, unsigned char NRightShift)
05377 {
05378         /* Validate input parameters */
05379         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
05380                 return(-1);
05381 
05382         if ((columns < 3) || (rows < 3) || (NRightShift > 7))
05383                 return (-1);
05384 
05385         if ((SDL_imageFilterMMXdetect())) {
05386 //#ifdef USE_MMX
05387 #if defined(USE_MMX) && defined(i386)
05388 #if !defined(GCC__)
05389                 __asm
05390                 {
05391                         pusha
05392                                 pxor mm0, mm0           /* zero MM0 */
05393                                 xor ebx, ebx    /* zero EBX */
05394                                 mov bl, NRightShift     /* load NRightShift into BL */
05395                                 movd mm4, ebx           /* copy NRightShift into MM4 */
05396                                 mov edx, Kernel         /* load Kernel address into EDX */
05397                                 movq mm5, [edx]         /* MM5 = {0,K2,K1,K0} */
05398                         add edx, 8      /* second row              |K0 K1 K2 0| */
05399                                 movq mm6, [edx]         /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
05400                         add edx, 8      /* third row               |K6 K7 K8 0| */
05401                                 movq mm7, [edx]         /* MM7 = {0,K8,K7,K6} */
05402                         /* ---, */
05403                         mov eax, columns        /* load columns into EAX */
05404                                 mov esi, Src    /* ESI = Src row 0 address */
05405                                 mov edi, Dest           /* load Dest address to EDI */
05406                                 add edi, eax    /* EDI = EDI + columns */
05407                                 inc              edi            /* 1 byte offset from the left edge */
05408                                 mov edx, rows           /* initialize ROWS counter */
05409                                 sub edx, 2      /* do not use first and last row */
05410                                 /* ---, */
05411 L10360:
05412                         mov ecx, eax    /* initialize COLUMS counter */
05413                                 sub ecx, 2      /* do not use first and last column */
05414                                 align 16                        /* 16 byte alignment of the loop entry */
05415 L10362:
05416                         /* ---, */
05417                         movq mm1, [esi]         /* load 8 bytes of the image first row */
05418                         add esi, eax    /* move one row below */
05419                                 movq mm2, [esi]         /* load 8 bytes of the image second row */
05420                         add esi, eax    /* move one row below */
05421                                 movq mm3, [esi]         /* load 8 bytes of the image third row */
05422                         punpcklbw mm1, mm0      /* unpack first 4 bytes into words */
05423                                 punpcklbw mm2, mm0      /* unpack first 4 bytes into words */
05424                                 punpcklbw mm3, mm0      /* unpack first 4 bytes into words */
05425                                 psrlw mm1, mm4          /* shift right each pixel NshiftRight times */
05426                                 psrlw mm2, mm4          /* shift right each pixel NshiftRight times */
05427                                 psrlw mm3, mm4          /* shift right each pixel NshiftRight times */
05428                                 pmullw mm1, mm5         /* multiply words first row  image*Kernel */
05429                                 pmullw mm2, mm6         /* multiply words second row image*Kernel */
05430                                 pmullw mm3, mm7         /* multiply words third row  image*Kernel */
05431                                 paddsw mm1, mm2         /* add 4 words of the first and second rows */
05432                                 paddsw mm1, mm3         /* add 4 words of the third row and result */
05433                                 movq mm2, mm1           /* copy MM1 into MM2 */
05434                                 psrlq mm1, 32           /* shift 2 left words to the right */
05435                                 paddsw mm1, mm2         /* add 2 left and 2 right result words */
05436                                 movq mm3, mm1           /* copy MM1 into MM3 */
05437                                 psrlq mm1, 16           /* shift 1 left word to the right */
05438                                 paddsw mm1, mm3         /* add 1 left and 1 right result words */
05439                                 packuswb mm1, mm0       /* pack shift result with saturation */
05440                                 movd ebx, mm1           /* copy saturated result into EBX */
05441                                 mov [edi], bl           /* copy a byte result into Dest */
05442                                 /* --, */
05443                                 sub esi, eax    /* move two rows up */
05444                                 sub esi, eax
05445                                 inc              esi            /* move Src  pointer to the next pixel */
05446                                 inc              edi            /* move Dest pointer to the next pixel */
05447                                 /* ---, */
05448                                 dec              ecx            /* decrease loop counter COLUMNS */
05449                                 jnz            L10362           /* check loop termination, proceed if required */
05450                                 add esi, 2      /* move to the next row in Src */
05451                                 add edi, 2      /* move to the next row in Dest */
05452                                 dec              edx            /* decrease loop counter ROWS */
05453                                 jnz            L10360           /* check loop termination, proceed if required */
05454                                 /* ---, */
05455                                 emms                            /* exit MMX state */
05456                                 popa
05457                 }
05458 #else
05459                 asm volatile
05460                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
05461                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
05462                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
05463                         "movd      %%ebx, %%mm4 \n\t"   /* copy NRightShift into MM4 */
05464                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
05465                         "movq    (%%edx), %%mm5 \n\t"   /* MM5 = {0,K2,K1,K0} */
05466                         "add          $8, %%edx \n\t"   /* second row              |K0 K1 K2 0| */
05467                         "movq    (%%edx), %%mm6 \n\t"   /* MM6 = {0,K5,K4,K3}  K = |K3 K4 K5 0| */
05468                         "add          $8, %%edx \n\t"   /* third row               |K6 K7 K8 0| */
05469                         "movq    (%%edx), %%mm7 \n\t"   /* MM7 = {0,K8,K7,K6} */
05470                         /* --- */
05471                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
05472                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
05473                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
05474                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
05475                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
05476                         "mov          %2, %%edx \n\t"   /* initialize ROWS counter */
05477                         "sub          $2, %%edx \n\t"   /* do not use first and last row */
05478                         /* --- */
05479                         ".L10360:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMS counter */
05480                         "sub          $2, %%ecx \n\t"   /* do not use first and last column */
05481                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
05482                         ".L10362:               \n\t"
05483                         /* --- */
05484                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the image first row */
05485                         "add       %%eax, %%esi \n\t"   /* move one row below */
05486                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes of the image second row */
05487                         "add       %%eax, %%esi \n\t"   /* move one row below */
05488                         "movq    (%%esi), %%mm3 \n\t"   /* load 8 bytes of the image third row */
05489                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first 4 bytes into words */
05490                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack first 4 bytes into words */
05491                         "punpcklbw %%mm0, %%mm3 \n\t"   /* unpack first 4 bytes into words */
05492                         "psrlw     %%mm4, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05493                         "psrlw     %%mm4, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05494                         "psrlw     %%mm4, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
05495                         "pmullw    %%mm5, %%mm1 \n\t"   /* multiply words first row  image*Kernel */
05496                         "pmullw    %%mm6, %%mm2 \n\t"   /* multiply words second row image*Kernel */
05497                         "pmullw    %%mm7, %%mm3 \n\t"   /* multiply words third row  image*Kernel */
05498                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the first and second rows */
05499                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 4 words of the third row and result */
05500                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05501                         "psrlq       $32, %%mm1 \n\t"   /* shift 2 left words to the right */
05502                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 2 left and 2 right result words */
05503                         "movq      %%mm1, %%mm3 \n\t"   /* copy MM1 into MM3 */
05504                         "psrlq       $16, %%mm1 \n\t"   /* shift 1 left word to the right */
05505                         "paddsw    %%mm3, %%mm1 \n\t"   /* add 1 left and 1 right result words */
05506                         "packuswb  %%mm0, %%mm1 \n\t"   /* pack shift result with saturation */
05507                         "movd      %%mm1, %%ebx \n\t"   /* copy saturated result into EBX */
05508                         "mov      %%bl, (%%edi) \n\t"   /* copy a byte result into Dest */
05509                         /* -- */
05510                         "sub       %%eax, %%esi \n\t"   /* move two rows up */
05511                         "sub       %%eax, %%esi \n\t" "inc              %%esi \n\t"     /* move Src  pointer to the next pixel */
05512                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
05513                         /* --- */
05514                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
05515                         "jnz            .L10362 \n\t"   /* check loop termination, proceed if required */
05516                         "add          $2, %%esi \n\t"   /* move to the next row in Src */
05517                         "add          $2, %%edi \n\t"   /* move to the next row in Dest */
05518                         "dec              %%edx \n\t"   /* decrease loop counter ROWS */
05519                         "jnz            .L10360 \n\t"   /* check loop termination, proceed if required */
05520                         /* --- */
05521                         "emms                   \n\t"   /* exit MMX state */
05522                         "popa                   \n\t":"=m" (Dest)       /* %0 */
05523                         :"m"(Src),              /* %1 */
05524                         "m"(rows),              /* %2 */
05525                         "m"(columns),           /* %3 */
05526                         "m"(Kernel),            /* %4 */
05527                         "m"(NRightShift)        /* %5 */
05528                         );
05529 #endif
05530 #endif
05531                 return (0);
05532         } else {
05533                 /* No non-MMX implementation yet */
05534                 return (-1);
05535         }
05536 }
05537 
05552 int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
05553                                                                                            signed short *Kernel, unsigned char NRightShift)
05554 {
05555         /* Validate input parameters */
05556         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
05557                 return(-1);
05558 
05559         if ((columns < 5) || (rows < 5) || (NRightShift > 7))
05560                 return (-1);
05561 
05562         if ((SDL_imageFilterMMXdetect())) {
05563 //#ifdef USE_MMX
05564 #if defined(USE_MMX) && defined(i386)
05565 #if !defined(GCC__)
05566                 __asm
05567                 {
05568                         pusha
05569                                 pxor mm0, mm0           /* zero MM0 */
05570                                 xor ebx, ebx    /* zero EBX */
05571                                 mov bl, NRightShift     /* load NRightShift into BL */
05572                                 movd mm5, ebx           /* copy NRightShift into MM5 */
05573                                 mov edx, Kernel         /* load Kernel address into EDX */
05574                                 mov esi, Src    /* load Src  address to ESI */
05575                                 mov edi, Dest           /* load Dest address to EDI */
05576                                 add edi, 2      /* 2 column offset from the left edge */
05577                                 mov eax, columns        /* load columns into EAX */
05578                                 shl eax, 1      /* EAX = columns * 2 */
05579                                 add edi, eax    /* 2 row offset from the top edge */
05580                                 shr eax, 1      /* EAX = columns */
05581                                 mov ebx, rows           /* initialize ROWS counter */
05582                                 sub ebx, 4      /* do not use first 2 and last 2 rows */
05583                                 /* ---, */
05584 L10370:
05585                         mov ecx, eax    /* initialize COLUMNS counter */
05586                                 sub ecx, 4      /* do not use first 2 and last 2 columns */
05587                                 align 16                        /* 16 byte alignment of the loop entry */
05588 L10372:
05589                         pxor mm7, mm7           /* zero MM7 (accumulator) */
05590                                 movd mm6, esi           /* save ESI in MM6 */
05591                                 /* --- 1 */
05592                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05593                         movq mm2, mm1           /* copy MM1 into MM2 */
05594                                 add esi, eax    /* move Src pointer 1 row below */
05595                                 movq mm3, [edx]         /* load 4 words of Kernel */
05596                         add edx, 8      /* move pointer to other 4 words */
05597                                 movq mm4, [edx]         /* load 4 words of Kernel */
05598                         add edx, 8      /* move pointer to other 4 words */
05599                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05600                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05601                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05602                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05603                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05604                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05605                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05606                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05607                                 /* --- 2 */
05608                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05609                         movq mm2, mm1           /* copy MM1 into MM2 */
05610                                 add esi, eax    /* move Src pointer 1 row below */
05611                                 movq mm3, [edx]         /* load 4 words of Kernel */
05612                         add edx, 8      /* move pointer to other 4 words */
05613                                 movq mm4, [edx]         /* load 4 words of Kernel */
05614                         add edx, 8      /* move pointer to other 4 words */
05615                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05616                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05617                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05618                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05619                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05620                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05621                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05622                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05623                                 /* --- 3 */
05624                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05625                         movq mm2, mm1           /* copy MM1 into MM2 */
05626                                 add esi, eax    /* move Src pointer 1 row below */
05627                                 movq mm3, [edx]         /* load 4 words of Kernel */
05628                         add edx, 8      /* move pointer to other 4 words */
05629                                 movq mm4, [edx]         /* load 4 words of Kernel */
05630                         add edx, 8      /* move pointer to other 4 words */
05631                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05632                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05633                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05634                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05635                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05636                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05637                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05638                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05639                                 /* --- 4 */
05640                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05641                         movq mm2, mm1           /* copy MM1 into MM2 */
05642                                 add esi, eax    /* move Src pointer 1 row below */
05643                                 movq mm3, [edx]         /* load 4 words of Kernel */
05644                         add edx, 8      /* move pointer to other 4 words */
05645                                 movq mm4, [edx]         /* load 4 words of Kernel */
05646                         add edx, 8      /* move pointer to other 4 words */
05647                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05648                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05649                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05650                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05651                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05652                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05653                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05654                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05655                                 /* --- 5 */
05656                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05657                         movq mm2, mm1           /* copy MM1 into MM2 */
05658                                 movq mm3, [edx]         /* load 4 words of Kernel */
05659                         add edx, 8      /* move pointer to other 4 words */
05660                                 movq mm4, [edx]         /* load 4 words of Kernel */
05661                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05662                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05663                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05664                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05665                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05666                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05667                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05668                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05669                                 /* ---, */
05670                                 movq mm3, mm7           /* copy MM7 into MM3 */
05671                                 psrlq mm7, 32           /* shift 2 left words to the right */
05672                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
05673                                 movq mm2, mm7           /* copy MM7 into MM2 */
05674                                 psrlq mm7, 16           /* shift 1 left word to the right */
05675                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
05676                                 movd mm1, eax           /* save EAX in MM1 */
05677                                 packuswb mm7, mm0       /* pack division result with saturation */
05678                                 movd eax, mm7           /* copy saturated result into EAX */
05679                                 mov [edi], al           /* copy a byte result into Dest */
05680                                 movd eax, mm1           /* restore saved EAX */
05681                                 /* --, */
05682                                 movd esi, mm6           /* move Src pointer to the top pixel */
05683                                 sub edx, 72     /* EDX = Kernel address */
05684                                 inc              esi            /* move Src  pointer to the next pixel */
05685                                 inc              edi            /* move Dest pointer to the next pixel */
05686                                 /* ---, */
05687                                 dec              ecx            /* decrease loop counter COLUMNS */
05688                                 jnz            L10372           /* check loop termination, proceed if required */
05689                                 add esi, 4      /* move to the next row in Src */
05690                                 add edi, 4      /* move to the next row in Dest */
05691                                 dec              ebx            /* decrease loop counter ROWS */
05692                                 jnz            L10370           /* check loop termination, proceed if required */
05693                                 /* ---, */
05694                                 emms                            /* exit MMX state */
05695                                 popa
05696                 }
05697 #else
05698                 asm volatile
05699                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
05700                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
05701                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
05702                         "movd      %%ebx, %%mm5 \n\t"   /* copy NRightShift into MM5 */
05703                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
05704                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
05705                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
05706                         "add          $2, %%edi \n\t"   /* 2 column offset from the left edge */
05707                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
05708                         "shl          $1, %%eax \n\t"   /* EAX = columns * 2 */
05709                         "add       %%eax, %%edi \n\t"   /* 2 row offset from the top edge */
05710                         "shr          $1, %%eax \n\t"   /* EAX = columns */
05711                         "mov          %2, %%ebx \n\t"   /* initialize ROWS counter */
05712                         "sub          $4, %%ebx \n\t"   /* do not use first 2 and last 2 rows */
05713                         /* --- */
05714                         ".L10370:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
05715                         "sub          $4, %%ecx \n\t"   /* do not use first 2 and last 2 columns */
05716                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
05717                         ".L10372:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
05718                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
05719                         /* --- 1 */
05720                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05721                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05722                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05723                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05724                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05725                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05726                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05727                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05728                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05729                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05730                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05731                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05732                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05733                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05734                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05735                         /* --- 2 */
05736                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05737                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05738                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05739                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05740                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05741                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05742                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05743                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05744                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05745                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05746                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05747                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05748                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05749                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05750                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05751                         /* --- 3 */
05752                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05753                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05754                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05755                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05756                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05757                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05758                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05759                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05760                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05761                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05762                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05763                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05764                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05765                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05766                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05767                         /* --- 4 */
05768                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05769                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05770                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
05771                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05772                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05773                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05774                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05775                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05776                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05777                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05778                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05779                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05780                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05781                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05782                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05783                         /* --- 5 */
05784                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
05785                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
05786                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
05787                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
05788                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
05789                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
05790                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
05791                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
05792                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
05793                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
05794                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
05795                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
05796                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
05797                         /* --- */
05798                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
05799                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
05800                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
05801                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
05802                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
05803                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
05804                         "movd      %%eax, %%mm1 \n\t"   /* save EAX in MM1 */
05805                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
05806                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
05807                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
05808                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
05809                         /* -- */
05810                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
05811                         "sub         $72, %%edx \n\t"   /* EDX = Kernel address */
05812                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
05813                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
05814                         /* --- */
05815                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
05816                         "jnz            .L10372 \n\t"   /* check loop termination, proceed if required */
05817                         "add          $4, %%esi \n\t"   /* move to the next row in Src */
05818                         "add          $4, %%edi \n\t"   /* move to the next row in Dest */
05819                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
05820                         "jnz            .L10370 \n\t"   /* check loop termination, proceed if required */
05821                         /* --- */
05822                         "emms                   \n\t"   /* exit MMX state */
05823                         "popa                   \n\t":"=m" (Dest)       /* %0 */
05824                         :"m"(Src),              /* %1 */
05825                         "m"(rows),              /* %2 */
05826                         "m"(columns),           /* %3 */
05827                         "m"(Kernel),            /* %4 */
05828                         "m"(NRightShift)        /* %5 */
05829                         );
05830 #endif
05831 #endif
05832                 return (0);
05833         } else {
05834                 /* No non-MMX implementation yet */
05835                 return (-1);
05836         }
05837 }
05838 
05853 int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
05854                                                                                            signed short *Kernel, unsigned char NRightShift)
05855 {
05856         /* Validate input parameters */
05857         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
05858                 return(-1);
05859 
05860         if ((columns < 7) || (rows < 7) || (NRightShift > 7))
05861                 return (-1);
05862 
05863         if ((SDL_imageFilterMMXdetect())) {
05864 //#ifdef USE_MMX
05865 #if defined(USE_MMX) && defined(i386)
05866 #if !defined(GCC__)
05867                 __asm
05868                 {
05869                         pusha
05870                                 pxor mm0, mm0           /* zero MM0 */
05871                                 xor ebx, ebx    /* zero EBX */
05872                                 mov bl, NRightShift     /* load NRightShift into BL */
05873                                 movd mm5, ebx           /* copy NRightShift into MM5 */
05874                                 mov edx, Kernel         /* load Kernel address into EDX */
05875                                 mov esi, Src    /* load Src  address to ESI */
05876                                 mov edi, Dest           /* load Dest address to EDI */
05877                                 add edi, 3      /* 3 column offset from the left edge */
05878                                 mov eax, columns        /* load columns into EAX */
05879                                 add edi, eax    /* 3 row offset from the top edge */
05880                                 add edi, eax
05881                                 add edi, eax
05882                                 mov ebx, rows           /* initialize ROWS counter */
05883                                 sub ebx, 6      /* do not use first 3 and last 3 rows */
05884                                 /* ---, */
05885 L10380:
05886                         mov ecx, eax    /* initialize COLUMNS counter */
05887                                 sub ecx, 6      /* do not use first 3 and last 3 columns */
05888                                 align 16                        /* 16 byte alignment of the loop entry */
05889 L10382:
05890                         pxor mm7, mm7           /* zero MM7 (accumulator) */
05891                                 movd mm6, esi           /* save ESI in MM6 */
05892                                 /* --- 1 */
05893                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05894                         movq mm2, mm1           /* copy MM1 into MM2 */
05895                                 add esi, eax    /* move Src pointer 1 row below */
05896                                 movq mm3, [edx]         /* load 4 words of Kernel */
05897                         add edx, 8      /* move pointer to other 4 words */
05898                                 movq mm4, [edx]         /* load 4 words of Kernel */
05899                         add edx, 8      /* move pointer to other 4 words */
05900                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05901                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05902                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05903                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05904                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05905                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05906                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05907                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05908                                 /* --- 2 */
05909                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05910                         movq mm2, mm1           /* copy MM1 into MM2 */
05911                                 add esi, eax    /* move Src pointer 1 row below */
05912                                 movq mm3, [edx]         /* load 4 words of Kernel */
05913                         add edx, 8      /* move pointer to other 4 words */
05914                                 movq mm4, [edx]         /* load 4 words of Kernel */
05915                         add edx, 8      /* move pointer to other 4 words */
05916                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05917                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05918                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05919                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05920                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05921                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05922                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05923                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05924                                 /* --- 3 */
05925                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05926                         movq mm2, mm1           /* copy MM1 into MM2 */
05927                                 add esi, eax    /* move Src pointer 1 row below */
05928                                 movq mm3, [edx]         /* load 4 words of Kernel */
05929                         add edx, 8      /* move pointer to other 4 words */
05930                                 movq mm4, [edx]         /* load 4 words of Kernel */
05931                         add edx, 8      /* move pointer to other 4 words */
05932                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05933                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05934                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05935                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05936                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05937                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05938                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05939                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05940                                 /* --- 4 */
05941                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05942                         movq mm2, mm1           /* copy MM1 into MM2 */
05943                                 add esi, eax    /* move Src pointer 1 row below */
05944                                 movq mm3, [edx]         /* load 4 words of Kernel */
05945                         add edx, 8      /* move pointer to other 4 words */
05946                                 movq mm4, [edx]         /* load 4 words of Kernel */
05947                         add edx, 8      /* move pointer to other 4 words */
05948                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05949                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05950                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05951                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05952                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05953                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05954                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05955                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05956                                 /* --- 5 */
05957                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05958                         movq mm2, mm1           /* copy MM1 into MM2 */
05959                                 add esi, eax    /* move Src pointer 1 row below */
05960                                 movq mm3, [edx]         /* load 4 words of Kernel */
05961                         add edx, 8      /* move pointer to other 4 words */
05962                                 movq mm4, [edx]         /* load 4 words of Kernel */
05963                         add edx, 8      /* move pointer to other 4 words */
05964                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05965                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05966                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05967                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05968                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05969                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05970                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05971                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05972                                 /* --- 6 */
05973                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05974                         movq mm2, mm1           /* copy MM1 into MM2 */
05975                                 add esi, eax    /* move Src pointer 1 row below */
05976                                 movq mm3, [edx]         /* load 4 words of Kernel */
05977                         add edx, 8      /* move pointer to other 4 words */
05978                                 movq mm4, [edx]         /* load 4 words of Kernel */
05979                         add edx, 8      /* move pointer to other 4 words */
05980                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05981                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05982                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05983                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05984                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05985                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
05986                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
05987                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
05988                                 /* --- 7 */
05989                                 movq mm1, [esi]         /* load 8 bytes of the Src */
05990                         movq mm2, mm1           /* copy MM1 into MM2 */
05991                                 movq mm3, [edx]         /* load 4 words of Kernel */
05992                         add edx, 8      /* move pointer to other 4 words */
05993                                 movq mm4, [edx]         /* load 4 words of Kernel */
05994                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
05995                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
05996                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
05997                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
05998                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
05999                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06000                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06001                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06002                                 /* ---, */
06003                                 movq mm3, mm7           /* copy MM7 into MM3 */
06004                                 psrlq mm7, 32           /* shift 2 left words to the right */
06005                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
06006                                 movq mm2, mm7           /* copy MM7 into MM2 */
06007                                 psrlq mm7, 16           /* shift 1 left word to the right */
06008                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
06009                                 movd mm1, eax           /* save EAX in MM1 */
06010                                 packuswb mm7, mm0       /* pack division result with saturation */
06011                                 movd eax, mm7           /* copy saturated result into EAX */
06012                                 mov [edi], al           /* copy a byte result into Dest */
06013                                 movd eax, mm1           /* restore saved EAX */
06014                                 /* --, */
06015                                 movd esi, mm6           /* move Src pointer to the top pixel */
06016                                 sub edx, 104    /* EDX = Kernel address */
06017                                 inc              esi            /* move Src  pointer to the next pixel */
06018                                 inc              edi            /* move Dest pointer to the next pixel */
06019                                 /* ---, */
06020                                 dec              ecx            /* decrease loop counter COLUMNS */
06021                                 jnz            L10382           /* check loop termination, proceed if required */
06022                                 add esi, 6      /* move to the next row in Src */
06023                                 add edi, 6      /* move to the next row in Dest */
06024                                 dec              ebx            /* decrease loop counter ROWS */
06025                                 jnz            L10380           /* check loop termination, proceed if required */
06026                                 /* ---, */
06027                                 emms                            /* exit MMX state */
06028                                 popa
06029                 }
06030 #else
06031                 asm volatile
06032                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
06033                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
06034                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
06035                         "movd      %%ebx, %%mm5 \n\t"   /* copy NRightShift into MM5 */
06036                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
06037                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
06038                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
06039                         "add          $3, %%edi \n\t"   /* 3 column offset from the left edge */
06040                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
06041                         "add       %%eax, %%edi \n\t"   /* 3 row offset from the top edge */
06042                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t"       /* initialize ROWS counter */
06043                         "sub          $6, %%ebx \n\t"   /* do not use first 3 and last 3 rows */
06044                         /* --- */
06045                         ".L10380:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
06046                         "sub          $6, %%ecx \n\t"   /* do not use first 3 and last 3 columns */
06047                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
06048                         ".L10382:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
06049                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
06050                         /* --- 1 */
06051                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06052                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06053                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06054                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06055                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06056                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06057                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06058                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06059                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06060                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06061                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06062                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06063                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06064                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06065                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06066                         /* --- 2 */
06067                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06068                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06069                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06070                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06071                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06072                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06073                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06074                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06075                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06076                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06077                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06078                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06079                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06080                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06081                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06082                         /* --- 3 */
06083                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06084                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06085                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06086                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06087                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06088                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06089                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06090                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06091                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06092                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06093                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06094                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06095                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06096                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06097                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06098                         /* --- 4 */
06099                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06100                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06101                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06102                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06103                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06104                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06105                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06106                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06107                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06108                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06109                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06110                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06111                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06112                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06113                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06114                         /* --- 5 */
06115                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06116                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06117                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06118                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06119                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06120                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06121                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06122                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06123                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06124                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06125                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06126                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06127                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06128                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06129                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06130                         /* --- 6 */
06131                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06132                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06133                         "add       %%eax, %%esi \n\t"   /* move Src pointer 1 row below */
06134                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06135                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06136                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06137                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06138                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06139                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06140                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06141                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06142                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06143                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06144                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06145                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06146                         /* --- 7 */
06147                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06148                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06149                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06150                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06151                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06152                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06153                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06154                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06155                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06156                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06157                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06158                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06159                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06160                         /* --- */
06161                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
06162                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
06163                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
06164                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
06165                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
06166                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
06167                         "movd      %%eax, %%mm1 \n\t"   /* save EAX in MM1 */
06168                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
06169                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
06170                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
06171                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
06172                         /* -- */
06173                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
06174                         "sub        $104, %%edx \n\t"   /* EDX = Kernel address */
06175                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
06176                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
06177                         /* --- */
06178                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
06179                         "jnz            .L10382 \n\t"   /* check loop termination, proceed if required */
06180                         "add          $6, %%esi \n\t"   /* move to the next row in Src */
06181                         "add          $6, %%edi \n\t"   /* move to the next row in Dest */
06182                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
06183                         "jnz            .L10380 \n\t"   /* check loop termination, proceed if required */
06184                         /* --- */
06185                         "emms                   \n\t"   /* exit MMX state */
06186                         "popa                   \n\t":"=m" (Dest)       /* %0 */
06187                         :"m"(Src),              /* %1 */
06188                         "m"(rows),              /* %2 */
06189                         "m"(columns),           /* %3 */
06190                         "m"(Kernel),            /* %4 */
06191                         "m"(NRightShift)        /* %5 */
06192                         );
06193 #endif
06194 #endif
06195                 return (0);
06196         } else {
06197                 /* No non-MMX implementation yet */
06198                 return (-1);
06199         }
06200 }
06201 
06216 int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
06217                                                                                            signed short *Kernel, unsigned char NRightShift)
06218 {
06219         /* Validate input parameters */
06220         if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
06221                 return(-1);
06222 
06223         if ((columns < 9) || (rows < 9) || (NRightShift > 7))
06224                 return (-1);
06225 
06226         if ((SDL_imageFilterMMXdetect())) {
06227 //#ifdef USE_MMX
06228 #if defined(USE_MMX) && defined(i386)
06229 #if !defined(GCC__)
06230                 __asm
06231                 {
06232                         pusha
06233                                 pxor mm0, mm0           /* zero MM0 */
06234                                 xor ebx, ebx    /* zero EBX */
06235                                 mov bl, NRightShift     /* load NRightShift into BL */
06236                                 movd mm5, ebx           /* copy NRightShift into MM5 */
06237                                 mov edx, Kernel         /* load Kernel address into EDX */
06238                                 mov esi, Src    /* load Src  address to ESI */
06239                                 mov edi, Dest           /* load Dest address to EDI */
06240                                 add edi, 4      /* 4 column offset from the left edge */
06241                                 mov eax, columns        /* load columns into EAX */
06242                                 add edi, eax    /* 4 row offset from the top edge */
06243                                 add edi, eax
06244                                 add edi, eax
06245                                 add edi, eax
06246                                 mov ebx, rows           /* initialize ROWS counter */
06247                                 sub ebx, 8      /* do not use first 4 and last 4 rows */
06248                                 /* ---, */
06249 L10390:
06250                         mov ecx, eax    /* initialize COLUMNS counter */
06251                                 sub ecx, 8      /* do not use first 4 and last 4 columns */
06252                                 align 16                        /* 16 byte alignment of the loop entry */
06253 L10392:
06254                         pxor mm7, mm7           /* zero MM7 (accumulator) */
06255                                 movd mm6, esi           /* save ESI in MM6 */
06256                                 /* --- 1 */
06257                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06258                         movq mm2, mm1           /* copy MM1 into MM2 */
06259                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06260                                 movq mm3, [edx]         /* load 4 words of Kernel */
06261                         add edx, 8      /* move pointer to other 4 words */
06262                                 movq mm4, [edx]         /* load 4 words of Kernel */
06263                         add edx, 8      /* move pointer to other 4 words */
06264                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06265                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06266                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06267                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06268                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06269                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06270                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06271                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06272                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06273                         dec              esi
06274                                 add esi, eax    /* move Src pointer 1 row below */
06275                                 movq mm3, [edx]         /* load 4 words of Kernel */
06276                         add edx, 8      /* move pointer to other 4 words */
06277                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06278                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06279                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06280                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06281                                 /* --- 2 */
06282                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06283                         movq mm2, mm1           /* copy MM1 into MM2 */
06284                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06285                                 movq mm3, [edx]         /* load 4 words of Kernel */
06286                         add edx, 8      /* move pointer to other 4 words */
06287                                 movq mm4, [edx]         /* load 4 words of Kernel */
06288                         add edx, 8      /* move pointer to other 4 words */
06289                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06290                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06291                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06292                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06293                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06294                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06295                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06296                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06297                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06298                         dec              esi
06299                                 add esi, eax    /* move Src pointer 1 row below */
06300                                 movq mm3, [edx]         /* load 4 words of Kernel */
06301                         add edx, 8      /* move pointer to other 4 words */
06302                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06303                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06304                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06305                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06306                                 /* --- 3 */
06307                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06308                         movq mm2, mm1           /* copy MM1 into MM2 */
06309                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06310                                 movq mm3, [edx]         /* load 4 words of Kernel */
06311                         add edx, 8      /* move pointer to other 4 words */
06312                                 movq mm4, [edx]         /* load 4 words of Kernel */
06313                         add edx, 8      /* move pointer to other 4 words */
06314                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06315                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06316                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06317                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06318                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06319                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06320                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06321                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06322                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06323                         dec              esi
06324                                 add esi, eax    /* move Src pointer 1 row below */
06325                                 movq mm3, [edx]         /* load 4 words of Kernel */
06326                         add edx, 8      /* move pointer to other 4 words */
06327                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06328                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06329                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06330                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06331                                 /* --- 4 */
06332                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06333                         movq mm2, mm1           /* copy MM1 into MM2 */
06334                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06335                                 movq mm3, [edx]         /* load 4 words of Kernel */
06336                         add edx, 8      /* move pointer to other 4 words */
06337                                 movq mm4, [edx]         /* load 4 words of Kernel */
06338                         add edx, 8      /* move pointer to other 4 words */
06339                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06340                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06341                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06342                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06343                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06344                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06345                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06346                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06347                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06348                         dec              esi
06349                                 add esi, eax    /* move Src pointer 1 row below */
06350                                 movq mm3, [edx]         /* load 4 words of Kernel */
06351                         add edx, 8      /* move pointer to other 4 words */
06352                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06353                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06354                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06355                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06356                                 /* --- 5 */
06357                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06358                         movq mm2, mm1           /* copy MM1 into MM2 */
06359                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06360                                 movq mm3, [edx]         /* load 4 words of Kernel */
06361                         add edx, 8      /* move pointer to other 4 words */
06362                                 movq mm4, [edx]         /* load 4 words of Kernel */
06363                         add edx, 8      /* move pointer to other 4 words */
06364                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06365                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06366                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06367                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06368                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06369                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06370                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06371                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06372                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06373                         dec              esi
06374                                 add esi, eax    /* move Src pointer 1 row below */
06375                                 movq mm3, [edx]         /* load 4 words of Kernel */
06376                         add edx, 8      /* move pointer to other 4 words */
06377                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06378                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06379                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06380                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06381                                 /* --- 6 */
06382                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06383                         movq mm2, mm1           /* copy MM1 into MM2 */
06384                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06385                                 movq mm3, [edx]         /* load 4 words of Kernel */
06386                         add edx, 8      /* move pointer to other 4 words */
06387                                 movq mm4, [edx]         /* load 4 words of Kernel */
06388                         add edx, 8      /* move pointer to other 4 words */
06389                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06390                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06391                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06392                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06393                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06394                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06395                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06396                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06397                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06398                         dec              esi
06399                                 add esi, eax    /* move Src pointer 1 row below */
06400                                 movq mm3, [edx]         /* load 4 words of Kernel */
06401                         add edx, 8      /* move pointer to other 4 words */
06402                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06403                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06404                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06405                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06406                                 /* --- 7 */
06407                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06408                         movq mm2, mm1           /* copy MM1 into MM2 */
06409                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06410                                 movq mm3, [edx]         /* load 4 words of Kernel */
06411                         add edx, 8      /* move pointer to other 4 words */
06412                                 movq mm4, [edx]         /* load 4 words of Kernel */
06413                         add edx, 8      /* move pointer to other 4 words */
06414                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06415                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06416                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06417                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06418                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06419                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06420                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06421                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06422                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06423                         dec              esi
06424                                 add esi, eax    /* move Src pointer 1 row below */
06425                                 movq mm3, [edx]         /* load 4 words of Kernel */
06426                         add edx, 8      /* move pointer to other 4 words */
06427                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06428                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06429                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06430                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06431                                 /* --- 8 */
06432                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06433                         movq mm2, mm1           /* copy MM1 into MM2 */
06434                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06435                                 movq mm3, [edx]         /* load 4 words of Kernel */
06436                         add edx, 8      /* move pointer to other 4 words */
06437                                 movq mm4, [edx]         /* load 4 words of Kernel */
06438                         add edx, 8      /* move pointer to other 4 words */
06439                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06440                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06441                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06442                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06443                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06444                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06445                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06446                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06447                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06448                         dec              esi
06449                                 add esi, eax    /* move Src pointer 1 row below */
06450                                 movq mm3, [edx]         /* load 4 words of Kernel */
06451                         add edx, 8      /* move pointer to other 4 words */
06452                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06453                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06454                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06455                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06456                                 /* --- 9 */
06457                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06458                         movq mm2, mm1           /* copy MM1 into MM2 */
06459                                 inc              esi            /* move pointer to the next 8 bytes of Src */
06460                                 movq mm3, [edx]         /* load 4 words of Kernel */
06461                         add edx, 8      /* move pointer to other 4 words */
06462                                 movq mm4, [edx]         /* load 4 words of Kernel */
06463                         add edx, 8      /* move pointer to other 4 words */
06464                                 punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06465                                 punpckhbw mm2, mm0      /* unpack second 4 bytes into words */
06466                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06467                                 psrlw mm2, mm5          /* shift right each pixel NshiftRight times */
06468                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06469                                 pmullw mm2, mm4         /* mult 4 high words of Src and Kernel */
06470                                 paddsw mm1, mm2         /* add 4 words of the high and low bytes */
06471                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06472                                 movq mm1, [esi]         /* load 8 bytes of the Src */
06473                         movq mm3, [edx]         /* load 4 words of Kernel */
06474                         punpcklbw mm1, mm0      /* unpack first  4 bytes into words */
06475                                 psrlw mm1, mm5          /* shift right each pixel NshiftRight times */
06476                                 pmullw mm1, mm3         /* mult 4 low  words of Src and Kernel */
06477                                 paddsw mm7, mm1         /* add MM1 to accumulator MM7 */
06478                                 /* ---, */
06479                                 movq mm3, mm7           /* copy MM7 into MM3 */
06480                                 psrlq mm7, 32           /* shift 2 left words to the right */
06481                                 paddsw mm7, mm3         /* add 2 left and 2 right result words */
06482                                 movq mm2, mm7           /* copy MM7 into MM2 */
06483                                 psrlq mm7, 16           /* shift 1 left word to the right */
06484                                 paddsw mm7, mm2         /* add 1 left and 1 right result words */
06485                                 movd mm1, eax           /* save EAX in MM1 */
06486                                 packuswb mm7, mm0       /* pack division result with saturation */
06487                                 movd eax, mm7           /* copy saturated result into EAX */
06488                                 mov [edi], al           /* copy a byte result into Dest */
06489                                 movd eax, mm1           /* restore saved EAX */
06490                                 /* --, */
06491                                 movd esi, mm6           /* move Src pointer to the top pixel */
06492                                 sub edx, 208    /* EDX = Kernel address */
06493                                 inc              esi            /* move Src  pointer to the next pixel */
06494                                 inc              edi            /* move Dest pointer to the next pixel */
06495                                 /* ---, */
06496                                 dec              ecx            /* decrease loop counter COLUMNS */
06497                                 jnz            L10392           /* check loop termination, proceed if required */
06498                                 add esi, 8      /* move to the next row in Src */
06499                                 add edi, 8      /* move to the next row in Dest */
06500                                 dec              ebx            /* decrease loop counter ROWS */
06501                                 jnz            L10390           /* check loop termination, proceed if required */
06502                                 /* ---, */
06503                                 emms                            /* exit MMX state */
06504                                 popa
06505                 }
06506 #else
06507                 asm volatile
06508                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
06509                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
06510                         "mov           %5, %%bl \n\t"   /* load NRightShift into BL */
06511                         "movd      %%ebx, %%mm5 \n\t"   /* copy NRightShift into MM5 */
06512                         "mov          %4, %%edx \n\t"   /* load Kernel address into EDX */
06513                         "mov          %1, %%esi \n\t"   /* load Src  address to ESI */
06514                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
06515                         "add          $4, %%edi \n\t"   /* 4 column offset from the left edge */
06516                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
06517                         "add       %%eax, %%edi \n\t"   /* 4 row offset from the top edge */
06518                         "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "add       %%eax, %%edi \n\t" "mov          %2, %%ebx \n\t" /* initialize ROWS counter */
06519                         "sub          $8, %%ebx \n\t"   /* do not use first 4 and last 4 rows */
06520                         /* --- */
06521                         ".L10390:               \n\t" "mov       %%eax, %%ecx \n\t"     /* initialize COLUMNS counter */
06522                         "sub          $8, %%ecx \n\t"   /* do not use first 4 and last 4 columns */
06523                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
06524                         ".L10392:               \n\t" "pxor      %%mm7, %%mm7 \n\t"     /* zero MM7 (accumulator) */
06525                         "movd      %%esi, %%mm6 \n\t"   /* save ESI in MM6 */
06526                         /* --- 1 */
06527                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06528                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06529                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06530                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06531                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06532                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06533                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06534                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06535                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06536                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06537                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06538                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06539                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06540                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06541                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06542                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06543                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06544                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06545                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06546                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06547                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06548                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06549                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06550                         /* --- 2 */
06551                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06552                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06553                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06554                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06555                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06556                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06557                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06558                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06559                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06560                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06561                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06562                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06563                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06564                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06565                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06566                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06567                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06568                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06569                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06570                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06571                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06572                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06573                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06574                         /* --- 3 */
06575                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06576                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06577                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06578                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06579                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06580                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06581                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06582                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06583                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06584                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06585                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06586                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06587                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06588                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06589                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06590                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06591                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06592                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06593                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06594                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06595                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06596                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06597                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06598                         /* --- 4 */
06599                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06600                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06601                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06602                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06603                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06604                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06605                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06606                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06607                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06608                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06609                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06610                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06611                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06612                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06613                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06614                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06615                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06616                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06617                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06618                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06619                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06620                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06621                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06622                         /* --- 5 */
06623                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06624                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06625                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06626                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06627                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06628                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06629                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06630                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06631                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06632                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06633                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06634                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06635                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06636                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06637                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06638                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06639                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06640                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06641                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06642                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06643                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06644                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06645                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06646                         /* --- 6 */
06647                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06648                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06649                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06650                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06651                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06652                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06653                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06654                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06655                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06656                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06657                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06658                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06659                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06660                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06661                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06662                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06663                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06664                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06665                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06666                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06667                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06668                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06669                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06670                         /* --- 7 */
06671                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06672                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06673                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06674                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06675                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06676                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06677                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06678                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06679                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06680                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06681                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06682                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06683                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06684                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06685                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06686                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06687                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06688                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06689                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06690                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06691                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06692                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06693                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06694                         /* --- 8 */
06695                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06696                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06697                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06698                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06699                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06700                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06701                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06702                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06703                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06704                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06705                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06706                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06707                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06708                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06709                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06710                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06711                         "dec              %%esi \n\t" "add       %%eax, %%esi \n\t"     /* move Src pointer 1 row below */
06712                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06713                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06714                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06715                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06716                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06717                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06718                         /* --- 9 */
06719                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06720                         "movq      %%mm1, %%mm2 \n\t"   /* copy MM1 into MM2 */
06721                         "inc              %%esi \n\t"   /* move pointer to the next 8 bytes of Src */
06722                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06723                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06724                         "movq    (%%edx), %%mm4 \n\t"   /* load 4 words of Kernel */
06725                         "add          $8, %%edx \n\t"   /* move pointer to other 4 words */
06726                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06727                         "punpckhbw %%mm0, %%mm2 \n\t"   /* unpack second 4 bytes into words */
06728                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06729                         "psrlw     %%mm5, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
06730                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06731                         "pmullw    %%mm4, %%mm2 \n\t"   /* mult. 4 high words of Src and Kernel */
06732                         "paddsw    %%mm2, %%mm1 \n\t"   /* add 4 words of the high and low bytes */
06733                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06734                         "movq    (%%esi), %%mm1 \n\t"   /* load 8 bytes of the Src */
06735                         "movq    (%%edx), %%mm3 \n\t"   /* load 4 words of Kernel */
06736                         "punpcklbw %%mm0, %%mm1 \n\t"   /* unpack first  4 bytes into words */
06737                         "psrlw     %%mm5, %%mm1 \n\t"   /* shift right each pixel NshiftRight times */
06738                         "pmullw    %%mm3, %%mm1 \n\t"   /* mult. 4 low  words of Src and Kernel */
06739                         "paddsw    %%mm1, %%mm7 \n\t"   /* add MM1 to accumulator MM7 */
06740                         /* --- */
06741                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
06742                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
06743                         "paddsw    %%mm3, %%mm7 \n\t"   /* add 2 left and 2 right result words */
06744                         "movq      %%mm7, %%mm2 \n\t"   /* copy MM7 into MM2 */
06745                         "psrlq       $16, %%mm7 \n\t"   /* shift 1 left word to the right */
06746                         "paddsw    %%mm2, %%mm7 \n\t"   /* add 1 left and 1 right result words */
06747                         "movd      %%eax, %%mm1 \n\t"   /* save EAX in MM1 */
06748                         "packuswb  %%mm0, %%mm7 \n\t"   /* pack division result with saturation */
06749                         "movd      %%mm7, %%eax \n\t"   /* copy saturated result into EAX */
06750                         "mov      %%al, (%%edi) \n\t"   /* copy a byte result into Dest */
06751                         "movd      %%mm1, %%eax \n\t"   /* restore saved EAX */
06752                         /* -- */
06753                         "movd      %%mm6, %%esi \n\t"   /* move Src pointer to the top pixel */
06754                         "sub        $208, %%edx \n\t"   /* EDX = Kernel address */
06755                         "inc              %%esi \n\t"   /* move Src  pointer to the next pixel */
06756                         "inc              %%edi \n\t"   /* move Dest pointer to the next pixel */
06757                         /* --- */
06758                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
06759                         "jnz            .L10392 \n\t"   /* check loop termination, proceed if required */
06760                         "add          $8, %%esi \n\t"   /* move to the next row in Src */
06761                         "add          $8, %%edi \n\t"   /* move to the next row in Dest */
06762                         "dec              %%ebx \n\t"   /* decrease loop counter ROWS */
06763                         "jnz            .L10390 \n\t"   /* check loop termination, proceed if required */
06764                         /* --- */
06765                         "emms                   \n\t"   /* exit MMX state */
06766                         "popa                   \n\t":"=m" (Dest)       /* %0 */
06767                         :"m"(Src),              /* %1 */
06768                         "m"(rows),              /* %2 */
06769                         "m"(columns),           /* %3 */
06770                         "m"(Kernel),            /* %4 */
06771                         "m"(NRightShift)        /* %5 */
06772                         );
06773 #endif
06774 #endif
06775                 return (0);
06776         } else {
06777                 /* No non-MMX implementation yet */
06778                 return (-1);
06779         }
06780 }
06781 
06782 /* ------------------------------------------------------------------------------------ */
06783 
06796 int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns)
06797 {
06798         /* Validate input parameters */
06799         if ((Src == NULL) || (Dest == NULL))
06800                 return(-1);
06801 
06802         if ((columns < 8) || (rows < 3))
06803                 return (-1);
06804 
06805         if ((SDL_imageFilterMMXdetect())) {
06806 //#ifdef USE_MMX
06807 #if defined(USE_MMX) && defined(i386)
06808 #if !defined(GCC__)
06809                 __asm
06810                 {
06811                         pusha
06812                                 pxor mm0, mm0           /* zero MM0 */
06813                                 mov eax, columns        /* load columns into EAX */
06814                                 /* ---, */
06815                                 mov esi, Src    /* ESI = Src row 0 address */
06816                                 mov edi, Dest           /* load Dest address to EDI */
06817                                 add edi, eax    /* EDI = EDI + columns */
06818                                 inc              edi            /* 1 byte offset from the left edge */
06819                                 mov edx, rows           /* initialize ROWS counter */
06820                                 sub edx, 2      /* do not use first and last rows */
06821                                 /* ---, */
06822 L10400:
06823                         mov ecx, eax    /* initialize COLUMS counter */
06824                                 shr ecx, 3      /* EBX/8 (MMX loads 8 bytes at a time) */
06825                                 mov ebx, esi    /* save ESI in EBX */
06826                                 movd mm1, edi           /* save EDI in MM1 */
06827                                 align 16                        /* 16 byte alignment of the loop entry */
06828 L10402:
06829                         /* ---, */
06830                         movq mm4, [esi]         /* load 8 bytes from Src */
06831                         movq mm5, mm4           /* save MM4 in MM5 */
06832                                 add esi, 2      /* move ESI pointer 2 bytes right */
06833                                 punpcklbw mm4, mm0      /* unpack 4 low  bytes into words */
06834                                 punpckhbw mm5, mm0      /* unpack 4 high bytes into words */
06835                                 movq mm6, [esi]         /* load 8 bytes from Src */
06836                         movq mm7, mm6           /* save MM6 in MM7 */
06837                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
06838                                 punpcklbw mm6, mm0      /* unpack 4 low  bytes into words */
06839                                 punpckhbw mm7, mm0      /* unpack 4 high bytes into words */
06840                                 add esi, eax    /* move to the next row of Src */
06841                                 movq mm2, [esi]         /* load 8 bytes from Src */
06842                         movq mm3, mm2           /* save MM2 in MM3 */
06843                                 add esi, 2      /* move ESI pointer 2 bytes right */
06844                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06845                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06846                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
06847                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
06848                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
06849                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
06850                                 movq mm2, [esi]         /* load 8 bytes from Src */
06851                         movq mm3, mm2           /* save MM2 in MM3 */
06852                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
06853                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06854                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06855                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
06856                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
06857                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
06858                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
06859                                 add esi, eax    /* move to the next row of Src */
06860                                 movq mm2, [esi]         /* load 8 bytes from Src */
06861                         movq mm3, mm2           /* save MM2 in MM3 */
06862                                 add esi, 2      /* move ESI pointer 2 bytes right */
06863                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06864                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06865                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
06866                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
06867                                 movq mm2, [esi]         /* load 8 bytes from Src */
06868                         movq mm3, mm2           /* save MM2 in MM3 */
06869                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
06870                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
06871                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
06872                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
06873                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
06874                                 /* ---, */
06875                                 movq mm2, mm4           /* copy MM4 into MM2 */
06876                                 psrlq mm4, 32           /* shift 2 left words to the right */
06877                                 psubw mm4, mm2          /* MM4 = MM4 - MM2 */
06878                                 movq mm3, mm6           /* copy MM6 into MM3 */
06879                                 psrlq mm6, 32           /* shift 2 left words to the right */
06880                                 psubw mm6, mm3          /* MM6 = MM6 - MM3 */
06881                                 punpckldq mm4, mm6      /* combine 2 words of MM6 and 2 words of MM4 */
06882                                 movq mm2, mm5           /* copy MM6 into MM2 */
06883                                 psrlq mm5, 32           /* shift 2 left words to the right */
06884                                 psubw mm5, mm2          /* MM5 = MM5 - MM2 */
06885                                 movq mm3, mm7           /* copy MM7 into MM3 */
06886                                 psrlq mm7, 32           /* shift 2 left words to the right */
06887                                 psubw mm7, mm3          /* MM7 = MM7 - MM3 */
06888                                 punpckldq mm5, mm7      /* combine 2 words of MM7 and 2 words of MM5 */
06889                                 /* Take abs values of MM4 and MM5 */
06890                                 movq mm6, mm4           /* copy MM4 into MM6 */
06891                                 movq mm7, mm5           /* copy MM5 into MM7 */
06892                                 psraw mm6, 15           /* fill MM6 words with word sign bit */
06893                                 psraw mm7, 15           /* fill MM7 words with word sign bit */
06894                                 pxor mm4, mm6           /* take 1's compliment of only neg words */
06895                                 pxor mm5, mm7           /* take 1's compliment of only neg words */
06896                                 psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
06897                                 psubsw mm5, mm7         /* add 1 to only neg words, W-(-1) or W-0 */
06898                                 packuswb mm4, mm5       /* combine and pack/saturate MM5 and MM4 */
06899                                 movq [edi], mm4         /* store result in Dest */
06900                                 /* ---, */
06901                                 sub esi, eax    /* move to the current top row in Src */
06902                                 sub esi, eax
06903                                 add esi, 8      /* move Src  pointer to the next 8 pixels */
06904                                 add edi, 8      /* move Dest pointer to the next 8 pixels */
06905                                 /* ---, */
06906                                 dec              ecx            /* decrease loop counter COLUMNS */
06907                                 jnz            L10402           /* check loop termination, proceed if required */
06908                                 mov esi, ebx    /* restore most left current row Src  address */
06909                                 movd edi, mm1           /* restore most left current row Dest address */
06910                                 add esi, eax    /* move to the next row in Src */
06911                                 add edi, eax    /* move to the next row in Dest */
06912                                 dec              edx            /* decrease loop counter ROWS */
06913                                 jnz            L10400           /* check loop termination, proceed if required */
06914                                 /* ---, */
06915                                 emms                            /* exit MMX state */
06916                                 popa
06917                 }
06918 #else
06919                 asm volatile
06920                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
06921                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
06922                         /* --- */
06923                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
06924                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
06925                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
06926                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
06927                         "mov          %2, %%edx \n\t"   /* initialize ROWS counter */
06928                         "sub          $2, %%edx \n\t"   /* do not use first and last rows */
06929                         /* --- */
06930                         ".L10400:                \n\t" "mov       %%eax, %%ecx \n\t"    /* initialize COLUMS counter */
06931                         "shr          $3, %%ecx \n\t"   /* EBX/8 (MMX loads 8 bytes at a time) */
06932                         "mov       %%esi, %%ebx \n\t"   /* save ESI in EBX */
06933                         "movd      %%edi, %%mm1 \n\t"   /* save EDI in MM1 */
06934                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
06935                         ".L10402:               \n\t"
06936                         /* --- */
06937                         "movq    (%%esi), %%mm4 \n\t"   /* load 8 bytes from Src */
06938                         "movq      %%mm4, %%mm5 \n\t"   /* save MM4 in MM5 */
06939                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
06940                         "punpcklbw %%mm0, %%mm4 \n\t"   /* unpack 4 low  bytes into words */
06941                         "punpckhbw %%mm0, %%mm5 \n\t"   /* unpack 4 high bytes into words */
06942                         "movq    (%%esi), %%mm6 \n\t"   /* load 8 bytes from Src */
06943                         "movq      %%mm6, %%mm7 \n\t"   /* save MM6 in MM7 */
06944                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
06945                         "punpcklbw %%mm0, %%mm6 \n\t"   /* unpack 4 low  bytes into words */
06946                         "punpckhbw %%mm0, %%mm7 \n\t"   /* unpack 4 high bytes into words */
06947                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
06948                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06949                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06950                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
06951                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06952                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06953                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
06954                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
06955                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
06956                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
06957                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06958                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06959                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
06960                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06961                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06962                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
06963                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
06964                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
06965                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
06966                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
06967                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06968                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06969                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
06970                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06971                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06972                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
06973                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
06974                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
06975                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
06976                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
06977                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
06978                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
06979                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
06980                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
06981                         /* --- */
06982                         "movq      %%mm4, %%mm2 \n\t"   /* copy MM4 into MM2 */
06983                         "psrlq       $32, %%mm4 \n\t"   /* shift 2 left words to the right */
06984                         "psubw     %%mm2, %%mm4 \n\t"   /* MM4 = MM4 - MM2 */
06985                         "movq      %%mm6, %%mm3 \n\t"   /* copy MM6 into MM3 */
06986                         "psrlq       $32, %%mm6 \n\t"   /* shift 2 left words to the right */
06987                         "psubw     %%mm3, %%mm6 \n\t"   /* MM6 = MM6 - MM3 */
06988                         "punpckldq %%mm6, %%mm4 \n\t"   /* combine 2 words of MM6 and 2 words of MM4 */
06989                         "movq      %%mm5, %%mm2 \n\t"   /* copy MM6 into MM2 */
06990                         "psrlq       $32, %%mm5 \n\t"   /* shift 2 left words to the right */
06991                         "psubw     %%mm2, %%mm5 \n\t"   /* MM5 = MM5 - MM2 */
06992                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
06993                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
06994                         "psubw     %%mm3, %%mm7 \n\t"   /* MM7 = MM7 - MM3 */
06995                         "punpckldq %%mm7, %%mm5 \n\t"   /* combine 2 words of MM7 and 2 words of MM5 */
06996                         /* Take abs values of MM4 and MM5 */
06997                         "movq      %%mm4, %%mm6 \n\t"   /* copy MM4 into MM6 */
06998                         "movq      %%mm5, %%mm7 \n\t"   /* copy MM5 into MM7 */
06999                         "psraw       $15, %%mm6 \n\t"   /* fill MM6 words with word sign bit */
07000                         "psraw       $15, %%mm7 \n\t"   /* fill MM7 words with word sign bit */
07001                         "pxor      %%mm6, %%mm4 \n\t"   /* take 1's compliment of only neg. words */
07002                         "pxor      %%mm7, %%mm5 \n\t"   /* take 1's compliment of only neg. words */
07003                         "psubsw    %%mm6, %%mm4 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07004                         "psubsw    %%mm7, %%mm5 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07005                         "packuswb  %%mm5, %%mm4 \n\t"   /* combine and pack/saturate MM5 and MM4 */
07006                         "movq    %%mm4, (%%edi) \n\t"   /* store result in Dest */
07007                         /* --- */
07008                         "sub       %%eax, %%esi \n\t"   /* move to the current top row in Src */
07009                         "sub       %%eax, %%esi \n\t" "add $8,          %%esi \n\t"     /* move Src  pointer to the next 8 pixels */
07010                         "add $8,          %%edi \n\t"   /* move Dest pointer to the next 8 pixels */
07011                         /* --- */
07012                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
07013                         "jnz            .L10402 \n\t"   /* check loop termination, proceed if required */
07014                         "mov       %%ebx, %%esi \n\t"   /* restore most left current row Src  address */
07015                         "movd      %%mm1, %%edi \n\t"   /* restore most left current row Dest address */
07016                         "add       %%eax, %%esi \n\t"   /* move to the next row in Src */
07017                         "add       %%eax, %%edi \n\t"   /* move to the next row in Dest */
07018                         "dec              %%edx \n\t"   /* decrease loop counter ROWS */
07019                         "jnz            .L10400 \n\t"   /* check loop termination, proceed if required */
07020                         /* --- */
07021                         "emms                   \n\t"   /* exit MMX state */
07022                         "popa                   \n\t":"=m" (Dest)       /* %0 */
07023                         :"m"(Src),              /* %1 */
07024                         "m"(rows),              /* %2 */
07025                         "m"(columns)            /* %3 */
07026                         );
07027 #endif
07028 #endif
07029                 return (0);
07030         } else {
07031                 /* No non-MMX implementation yet */
07032                 return (-1);
07033         }
07034 }
07035 
07049 int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
07050                                                                         unsigned char NRightShift)
07051 {
07052         /* Validate input parameters */
07053         if ((Src == NULL) || (Dest == NULL))
07054                 return(-1);
07055         if ((columns < 8) || (rows < 3) || (NRightShift > 7))
07056                 return (-1);
07057 
07058         if ((SDL_imageFilterMMXdetect())) {
07059 //#ifdef USE_MMX
07060 #if defined(USE_MMX) && defined(i386)
07061 #if !defined(GCC__)
07062                 __asm
07063                 {
07064                         pusha
07065                                 pxor mm0, mm0           /* zero MM0 */
07066                                 mov eax, columns        /* load columns into EAX */
07067                                 xor ebx, ebx    /* zero EBX */
07068                                 mov bl, NRightShift     /* load NRightShift into BL */
07069                                 movd mm1, ebx           /* copy NRightShift into MM1 */
07070                                 /* ---, */
07071                                 mov esi, Src    /* ESI = Src row 0 address */
07072                                 mov edi, Dest           /* load Dest address to EDI */
07073                                 add edi, eax    /* EDI = EDI + columns */
07074                                 inc              edi            /* 1 byte offset from the left edge */
07075                                 /* initialize ROWS counter */
07076                                 sub rows, 2     /* do not use first and last rows */
07077                                 /* ---, */
07078 L10410:
07079                         mov ecx, eax    /* initialize COLUMS counter */
07080                                 shr ecx, 3      /* EBX/8 (MMX loads 8 bytes at a time) */
07081                                 mov ebx, esi    /* save ESI in EBX */
07082                                 mov edx, edi    /* save EDI in EDX */
07083                                 align 16                        /* 16 byte alignment of the loop entry */
07084 L10412:
07085                         /* ---, */
07086                         movq mm4, [esi]         /* load 8 bytes from Src */
07087                         movq mm5, mm4           /* save MM4 in MM5 */
07088                                 add esi, 2      /* move ESI pointer 2 bytes right */
07089                                 punpcklbw mm4, mm0      /* unpack 4 low  bytes into words */
07090                                 punpckhbw mm5, mm0      /* unpack 4 high bytes into words */
07091                                 psrlw mm4, mm1          /* shift right each pixel NshiftRight times */
07092                                 psrlw mm5, mm1          /* shift right each pixel NshiftRight times */
07093                                 movq mm6, [esi]         /* load 8 bytes from Src */
07094                         movq mm7, mm6           /* save MM6 in MM7 */
07095                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
07096                                 punpcklbw mm6, mm0      /* unpack 4 low  bytes into words */
07097                                 punpckhbw mm7, mm0      /* unpack 4 high bytes into words */
07098                                 psrlw mm6, mm1          /* shift right each pixel NshiftRight times */
07099                                 psrlw mm7, mm1          /* shift right each pixel NshiftRight times */
07100                                 add esi, eax    /* move to the next row of Src */
07101                                 movq mm2, [esi]         /* load 8 bytes from Src */
07102                         movq mm3, mm2           /* save MM2 in MM3 */
07103                                 add esi, 2      /* move ESI pointer 2 bytes right */
07104                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07105                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07106                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07107                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07108                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
07109                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
07110                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
07111                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
07112                                 movq mm2, [esi]         /* load 8 bytes from Src */
07113                         movq mm3, mm2           /* save MM2 in MM3 */
07114                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
07115                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07116                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07117                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07118                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07119                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
07120                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
07121                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
07122                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
07123                                 add esi, eax    /* move to the next row of Src */
07124                                 movq mm2, [esi]         /* load 8 bytes from Src */
07125                         movq mm3, mm2           /* save MM2 in MM3 */
07126                                 add esi, 2      /* move ESI pointer 2 bytes right */
07127                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07128                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07129                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07130                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07131                                 paddw mm4, mm2          /* add 4 low  bytes to accumolator MM4 */
07132                                 paddw mm5, mm3          /* add 4 high bytes to accumolator MM5 */
07133                                 movq mm2, [esi]         /* load 8 bytes from Src */
07134                         movq mm3, mm2           /* save MM2 in MM3 */
07135                                 sub esi, 2      /* move ESI pointer back 2 bytes left */
07136                                 punpcklbw mm2, mm0      /* unpack 4 low  bytes into words */
07137                                 punpckhbw mm3, mm0      /* unpack 4 high bytes into words */
07138                                 psrlw mm2, mm1          /* shift right each pixel NshiftRight times */
07139                                 psrlw mm3, mm1          /* shift right each pixel NshiftRight times */
07140                                 paddw mm6, mm2          /* add 4 low  bytes to accumolator MM6 */
07141                                 paddw mm7, mm3          /* add 4 high bytes to accumolator MM7 */
07142                                 /* ---, */
07143                                 movq mm2, mm4           /* copy MM4 into MM2 */
07144                                 psrlq mm4, 32           /* shift 2 left words to the right */
07145                                 psubw mm4, mm2          /* MM4 = MM4 - MM2 */
07146                                 movq mm3, mm6           /* copy MM6 into MM3 */
07147                                 psrlq mm6, 32           /* shift 2 left words to the right */
07148                                 psubw mm6, mm3          /* MM6 = MM6 - MM3 */
07149                                 punpckldq mm4, mm6      /* combine 2 words of MM6 and 2 words of MM4 */
07150                                 movq mm2, mm5           /* copy MM6 into MM2 */
07151                                 psrlq mm5, 32           /* shift 2 left words to the right */
07152                                 psubw mm5, mm2          /* MM5 = MM5 - MM2 */
07153                                 movq mm3, mm7           /* copy MM7 into MM3 */
07154                                 psrlq mm7, 32           /* shift 2 left words to the right */
07155                                 psubw mm7, mm3          /* MM7 = MM7 - MM3 */
07156                                 punpckldq mm5, mm7      /* combine 2 words of MM7 and 2 words of MM5 */
07157                                 /* Take abs values of MM4 and MM5 */
07158                                 movq mm6, mm4           /* copy MM4 into MM6 */
07159                                 movq mm7, mm5           /* copy MM5 into MM7 */
07160                                 psraw mm6, 15           /* fill MM6 words with word sign bit */
07161                                 psraw mm7, 15           /* fill MM7 words with word sign bit */
07162                                 pxor mm4, mm6           /* take 1's compliment of only neg words */
07163                                 pxor mm5, mm7           /* take 1's compliment of only neg words */
07164                                 psubsw mm4, mm6         /* add 1 to only neg words, W-(-1) or W-0 */
07165                                 psubsw mm5, mm7         /* add 1 to only neg words, W-(-1) or W-0 */
07166                                 packuswb mm4, mm5       /* combine and pack/saturate MM5 and MM4 */
07167                                 movq [edi], mm4         /* store result in Dest */
07168                                 /* ---, */
07169                                 sub esi, eax    /* move to the current top row in Src */
07170                                 sub esi, eax
07171                                 add esi, 8      /* move Src  pointer to the next 8 pixels */
07172                                 add edi, 8      /* move Dest pointer to the next 8 pixels */
07173                                 /* ---, */
07174                                 dec              ecx            /* decrease loop counter COLUMNS */
07175                                 jnz            L10412           /* check loop termination, proceed if required */
07176                                 mov esi, ebx    /* restore most left current row Src  address */
07177                                 mov edi, edx    /* restore most left current row Dest address */
07178                                 add esi, eax    /* move to the next row in Src */
07179                                 add edi, eax    /* move to the next row in Dest */
07180                                 dec rows        /* decrease loop counter ROWS */
07181                                 jnz            L10410           /* check loop termination, proceed if required */
07182                                 /* ---, */
07183                                 emms                            /* exit MMX state */
07184                                 popa
07185                 }
07186 #else
07187                 asm volatile
07188                         ("pusha              \n\t" "pxor      %%mm0, %%mm0 \n\t"        /* zero MM0 */
07189                         "mov          %3, %%eax \n\t"   /* load columns into EAX */
07190                         "xor       %%ebx, %%ebx \n\t"   /* zero EBX */
07191                         "mov           %4, %%bl \n\t"   /* load NRightShift into BL */
07192                         "movd      %%ebx, %%mm1 \n\t"   /* copy NRightShift into MM1 */
07193                         /* --- */
07194                         "mov          %1, %%esi \n\t"   /* ESI = Src row 0 address */
07195                         "mov          %0, %%edi \n\t"   /* load Dest address to EDI */
07196                         "add       %%eax, %%edi \n\t"   /* EDI = EDI + columns */
07197                         "inc              %%edi \n\t"   /* 1 byte offset from the left edge */
07198                         /* initialize ROWS counter */
07199                         "subl            $2, %2 \n\t"   /* do not use first and last rows */
07200                         /* --- */
07201                         ".L10410:                \n\t" "mov       %%eax, %%ecx \n\t"    /* initialize COLUMS counter */
07202                         "shr          $3, %%ecx \n\t"   /* EBX/8 (MMX loads 8 bytes at a time) */
07203                         "mov       %%esi, %%ebx \n\t"   /* save ESI in EBX */
07204                         "mov       %%edi, %%edx \n\t"   /* save EDI in EDX */
07205                         ".align 16              \n\t"   /* 16 byte alignment of the loop entry */
07206                         ".L10412:               \n\t"
07207                         /* --- */
07208                         "movq    (%%esi), %%mm4 \n\t"   /* load 8 bytes from Src */
07209                         "movq      %%mm4, %%mm5 \n\t"   /* save MM4 in MM5 */
07210                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
07211                         "punpcklbw %%mm0, %%mm4 \n\t"   /* unpack 4 low  bytes into words */
07212                         "punpckhbw %%mm0, %%mm5 \n\t"   /* unpack 4 high bytes into words */
07213                         "psrlw     %%mm1, %%mm4 \n\t"   /* shift right each pixel NshiftRight times */
07214                         "psrlw     %%mm1, %%mm5 \n\t"   /* shift right each pixel NshiftRight times */
07215                         "movq    (%%esi), %%mm6 \n\t"   /* load 8 bytes from Src */
07216                         "movq      %%mm6, %%mm7 \n\t"   /* save MM6 in MM7 */
07217                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
07218                         "punpcklbw %%mm0, %%mm6 \n\t"   /* unpack 4 low  bytes into words */
07219                         "punpckhbw %%mm0, %%mm7 \n\t"   /* unpack 4 high bytes into words */
07220                         "psrlw     %%mm1, %%mm6 \n\t"   /* shift right each pixel NshiftRight times */
07221                         "psrlw     %%mm1, %%mm7 \n\t"   /* shift right each pixel NshiftRight times */
07222                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
07223                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07224                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07225                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
07226                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07227                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07228                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07229                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07230                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
07231                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
07232                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
07233                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
07234                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07235                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07236                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
07237                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07238                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07239                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07240                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07241                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
07242                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
07243                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
07244                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
07245                         "add       %%eax, %%esi \n\t"   /* move to the next row of Src */
07246                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07247                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07248                         "add          $2, %%esi \n\t"   /* move ESI pointer 2 bytes right */
07249                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07250                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07251                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07252                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07253                         "paddw     %%mm2, %%mm4 \n\t"   /* add 4 low  bytes to accumolator MM4 */
07254                         "paddw     %%mm3, %%mm5 \n\t"   /* add 4 high bytes to accumolator MM5 */
07255                         "movq    (%%esi), %%mm2 \n\t"   /* load 8 bytes from Src */
07256                         "movq      %%mm2, %%mm3 \n\t"   /* save MM2 in MM3 */
07257                         "sub          $2, %%esi \n\t"   /* move ESI pointer back 2 bytes left */
07258                         "punpcklbw %%mm0, %%mm2 \n\t"   /* unpack 4 low  bytes into words */
07259                         "punpckhbw %%mm0, %%mm3 \n\t"   /* unpack 4 high bytes into words */
07260                         "psrlw     %%mm1, %%mm2 \n\t"   /* shift right each pixel NshiftRight times */
07261                         "psrlw     %%mm1, %%mm3 \n\t"   /* shift right each pixel NshiftRight times */
07262                         "paddw     %%mm2, %%mm6 \n\t"   /* add 4 low  bytes to accumolator MM6 */
07263                         "paddw     %%mm3, %%mm7 \n\t"   /* add 4 high bytes to accumolator MM7 */
07264                         /* --- */
07265                         "movq      %%mm4, %%mm2 \n\t"   /* copy MM4 into MM2 */
07266                         "psrlq       $32, %%mm4 \n\t"   /* shift 2 left words to the right */
07267                         "psubw     %%mm2, %%mm4 \n\t"   /* MM4 = MM4 - MM2 */
07268                         "movq      %%mm6, %%mm3 \n\t"   /* copy MM6 into MM3 */
07269                         "psrlq       $32, %%mm6 \n\t"   /* shift 2 left words to the right */
07270                         "psubw     %%mm3, %%mm6 \n\t"   /* MM6 = MM6 - MM3 */
07271                         "punpckldq %%mm6, %%mm4 \n\t"   /* combine 2 words of MM6 and 2 words of MM4 */
07272                         "movq      %%mm5, %%mm2 \n\t"   /* copy MM6 into MM2 */
07273                         "psrlq       $32, %%mm5 \n\t"   /* shift 2 left words to the right */
07274                         "psubw     %%mm2, %%mm5 \n\t"   /* MM5 = MM5 - MM2 */
07275                         "movq      %%mm7, %%mm3 \n\t"   /* copy MM7 into MM3 */
07276                         "psrlq       $32, %%mm7 \n\t"   /* shift 2 left words to the right */
07277                         "psubw     %%mm3, %%mm7 \n\t"   /* MM7 = MM7 - MM3 */
07278                         "punpckldq %%mm7, %%mm5 \n\t"   /* combine 2 words of MM7 and 2 words of MM5 */
07279                         /* Take abs values of MM4 and MM5 */
07280                         "movq      %%mm4, %%mm6 \n\t"   /* copy MM4 into MM6 */
07281                         "movq      %%mm5, %%mm7 \n\t"   /* copy MM5 into MM7 */
07282                         "psraw       $15, %%mm6 \n\t"   /* fill MM6 words with word sign bit */
07283                         "psraw       $15, %%mm7 \n\t"   /* fill MM7 words with word sign bit */
07284                         "pxor      %%mm6, %%mm4 \n\t"   /* take 1's compliment of only neg. words */
07285                         "pxor      %%mm7, %%mm5 \n\t"   /* take 1's compliment of only neg. words */
07286                         "psubsw    %%mm6, %%mm4 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07287                         "psubsw    %%mm7, %%mm5 \n\t"   /* add 1 to only neg. words, W-(-1) or W-0 */
07288                         "packuswb  %%mm5, %%mm4 \n\t"   /* combine and pack/saturate MM5 and MM4 */
07289                         "movq    %%mm4, (%%edi) \n\t"   /* store result in Dest */
07290                         /* --- */
07291                         "sub       %%eax, %%esi \n\t"   /* move to the current top row in Src */
07292                         "sub       %%eax, %%esi \n\t" "add $8,          %%esi \n\t"     /* move Src  pointer to the next 8 pixels */
07293                         "add $8,          %%edi \n\t"   /* move Dest pointer to the next 8 pixels */
07294                         /* --- */
07295                         "dec              %%ecx \n\t"   /* decrease loop counter COLUMNS */
07296                         "jnz            .L10412 \n\t"   /* check loop termination, proceed if required */
07297                         "mov       %%ebx, %%esi \n\t"   /* restore most left current row Src  address */
07298                         "mov       %%edx, %%edi \n\t"   /* restore most left current row Dest address */
07299                         "add       %%eax, %%esi \n\t"   /* move to the next row in Src */
07300                         "add       %%eax, %%edi \n\t"   /* move to the next row in Dest */
07301                         "decl                %2 \n\t"   /* decrease loop counter ROWS */
07302                         "jnz            .L10410 \n\t"   /* check loop termination, proceed if required */
07303                         /* --- */
07304                         "emms                   \n\t"   /* exit MMX state */
07305                         "popa                   \n\t":"=m" (Dest)       /* %0 */
07306                         :"m"(Src),              /* %1 */
07307                         "m"(rows),              /* %2 */
07308                         "m"(columns),           /* %3 */
07309                         "m"(NRightShift)        /* %4 */
07310                         );
07311 #endif
07312 #endif
07313                 return (0);
07314         } else {
07315                 /* No non-MMX implementation yet */
07316                 return (-1);
07317         }
07318 }
07319 
07323 void SDL_imageFilterAlignStack(void)
07324 {
07325 #ifdef USE_MMX
07326 #if !defined(GCC__)
07327         __asm
07328         {                               /* --- stack alignment --- */
07329                 mov ebx, esp    /* load ESP into EBX */
07330                         sub ebx, 4      /* reserve space on stack for old value of ESP */
07331                         and ebx, -32    /* align EBX along a 32 byte boundary */
07332                         mov [ebx], esp          /* save old value of ESP in stack, behind the bndry */
07333                         mov esp, ebx    /* align ESP along a 32 byte boundary */
07334         }
07335 #else
07336         asm volatile
07337                 (                               /* --- stack alignment --- */
07338                 "mov       %%esp, %%ebx \n\t"   /* load ESP into EBX */
07339                 "sub          $4, %%ebx \n\t"   /* reserve space on stack for old value of ESP */
07340                 "and        $-32, %%ebx \n\t"   /* align EBX along a 32 byte boundary */
07341                 "mov     %%esp, (%%ebx) \n\t"   /* save old value of ESP in stack, behind the bndry */
07342                 "mov       %%ebx, %%esp \n\t"   /* align ESP along a 32 byte boundary */
07343                 ::);
07344 #endif
07345 #endif
07346 }
07347 
07351 void SDL_imageFilterRestoreStack(void)
07352 {
07353 #ifdef USE_MMX
07354 #if !defined(GCC__)
07355         __asm
07356         {                               /* --- restoring old stack --- */
07357                 mov ebx, [esp]          /* load old value of ESP */
07358                 mov esp, ebx    /* restore old value of ESP */
07359         }
07360 #else
07361         asm volatile
07362                 (                               /* --- restoring old stack --- */
07363                 "mov     (%%esp), %%ebx \n\t"   /* load old value of ESP */
07364                 "mov       %%ebx, %%esp \n\t"   /* restore old value of ESP */
07365                 ::);
07366 #endif
07367 #endif
07368 }
sdlgfx-2.0.25/Docs/html/_s_d_l__image_filter_8h.html000066400000000000000000003653051225506657100223220ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.h File Reference
I:/Sources/sdlgfx/SDL_imageFilter.h File Reference

Go to the source code of this file.

Defines

#define SDL_IMAGEFILTER_SCOPE   extern

Functions

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect (void)
 MMX detection routine (with override flag).
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff (void)
 Disable MMX check for filter functions and and force to use non-MMX C based code.
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon (void)
 Enable MMX check for filter functions and use MMX code if available.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAdd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Add: D = saturation255(S1 + S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMean (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mean: D = S1/2 + S2/2.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSub (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Sub: D = saturation0(S1 - S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using AbsDiff: D = | S1 - S2 |.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMult (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Mult: D = saturation255(S1 * S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultNor: D = S1 * S2.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby2: D = saturation255(S1/2 * S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4 (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using MultDivby4: D = saturation255(S1/2 * S2/2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitAnd: D = S1 & S2.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using BitOr: D = S1 | S2.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterDiv (unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
 Filter using Div: D = S1 / S2.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation (unsigned char *Src1, unsigned char *Dest, unsigned int length)
 Filter using BitNegation: D = !S.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByte: D = saturation255(S + C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using AddByteToHalf: D = saturation255(S/2 + C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using SubByte: D = saturation0(S - C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
 Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRight: D = saturation0(S >> N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
 Filter using MultByByte: D = saturation255(S * C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C)
 Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftByte: D = (S << N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter using ShiftLeftUint: D = ((uint)S << N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
 Filter ShiftLeft: D = saturation255(S << N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
 Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange (unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax)
 Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear (unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax)
 Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9Divide (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor)
 Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9ShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift)
 Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelX (unsigned char *Src, unsigned char *Dest, int rows, int columns)
 Filter using SobelX: Dij = saturation255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelXShiftRight (unsigned char *Src, unsigned char *Dest, int rows, int columns, unsigned char NRightShift)
 Filter using SobelXShiftRight: Dij = saturation255( ... )
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterAlignStack (void)
 Align stack to 32 byte boundary,.
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterRestoreStack (void)
 Restore previously aligned stack.

Define Documentation

#define SDL_IMAGEFILTER_SCOPE   extern

Definition at line 50 of file SDL_imageFilter.h.


Function Documentation

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using AbsDiff: D = | S1 - S2 |.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 539 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAdd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Add: D = saturation255(S1 + S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 170 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByte: D = saturation255(S + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant value to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1788 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using AddByteToHalf: D = saturation255(S/2 + C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2065 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to add (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 1916 of file SDL_imageFilter.c.

Align stack to 32 byte boundary,.

Definition at line 7323 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  T 
)

Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TThe threshold boundary (inclusive).
Returns:
Returns 0 for success or -1 for error.

Definition at line 3531 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitAnd: D = S1 & S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1275 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitNegation: D = !S.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1668 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using BitOr: D = S1 | S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1389 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  Tmin,
unsigned char  Tmax 
)

Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax.

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
TminLower (inclusive) boundary of the clipping range.
TmaxUpper (inclusive) boundary of the clipping range.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3688 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >2.
KernelThe 2D convolution kernel of size 3x3.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 3977 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >2.
KernelThe 2D convolution kernel of size 3x3.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5375 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >4.
columnsNumber of columns in source/destination array. Must be >4.
KernelThe 2D convolution kernel of size 5x5.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4167 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >4.
columnsNumber of columns in source/destination array. Must be >4.
KernelThe 2D convolution kernel of size 5x5.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5552 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >6.
columnsNumber of columns in source/destination array. Must be >6.
KernelThe 2D convolution kernel of size 7x7.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4470 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >6.
columnsNumber of columns in source/destination array. Must be >6.
KernelThe 2D convolution kernel of size 7x7.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 5853 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9Divide ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  Divisor 
)

Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >8.
columnsNumber of columns in source/destination array. Must be >8.
KernelThe 2D convolution kernel of size 9x9.
DivisorThe divisor of the convolution sum. Must be >0.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 4827 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9ShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
signed short *  Kernel,
unsigned char  NRightShift 
)

Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to convolve. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >8.
columnsNumber of columns in source/destination array. Must be >8.
KernelThe 2D convolution kernel of size 9x9.
NRightShiftThe number of right bit shifts to apply to the convolution sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 6216 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterDiv ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Div: D = S1 / S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1546 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMean ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mean: D = S1/2 + S2/2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 305 of file SDL_imageFilter.c.

MMX detection routine (with override flag).

Returns:
1 of MMX was detected, 0 otherwise.

Definition at line 77 of file SDL_imageFilter.c.

Disable MMX check for filter functions and and force to use non-MMX C based code.

Definition at line 90 of file SDL_imageFilter.c.

Enable MMX check for filter functions and use MMX code if available.

Definition at line 98 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMult ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Mult: D = saturation255(S1 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 726 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using MultByByte: D = saturation255(S * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2787 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby2: D = saturation255(S1/2 * S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 997 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4 ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultDivby4: D = saturation255(S1/2 * S2/2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 1138 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using MultNor: D = S1 * S2.

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 859 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear ( unsigned char *  Src,
unsigned char *  Dest,
unsigned int  length,
int  Cmin,
int  Cmax,
int  Nmin,
int  Nmax 
)

Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)

Parameters:
SrcPointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CminNormalization constant.
CmaxNormalization constant.
NminNormalization constant.
NmaxNormalization constant.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3906 of file SDL_imageFilter.c.

Restore previously aligned stack.

Definition at line 7351 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter ShiftLeft: D = saturation255(S << N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3390 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftByte: D = (S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3090 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftLeftUint: D = ((uint)S << N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 3207 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRight: D = saturation0(S >> N)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2473 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N,
unsigned char  C 
)

Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 8.
CConstant to multiply with (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2940 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  N 
)

Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
NNumber of bit-positions to shift (N). Valid range is 0 to 32.
Returns:
Returns 0 for success or -1 for error.

Definition at line 2591 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelX ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns 
)

Filter using SobelX: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to sobel-filter. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 6796 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelXShiftRight ( unsigned char *  Src,
unsigned char *  Dest,
int  rows,
int  columns,
unsigned char  NRightShift 
)

Filter using SobelXShiftRight: Dij = saturation255( ... )

Parameters:
SrcThe source 2D byte array to sobel-filter. Should be different from destination.
DestThe destination 2D byte array to store the result in. Should be different from source.
rowsNumber of rows in source/destination array. Must be >2.
columnsNumber of columns in source/destination array. Must be >8.
NRightShiftThe number of right bit shifts to apply to the filter sum. Must be <7.

Note: Non-MMX implementation not available for this function.

Returns:
Returns 1 if filter was applied, 0 otherwise.

Definition at line 7049 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSub ( unsigned char *  Src1,
unsigned char *  Src2,
unsigned char *  Dest,
unsigned int  length 
)

Filter using Sub: D = saturation0(S1 - S2)

Parameters:
Src1Pointer to the start of the first source byte array (S1).
Src2Pointer to the start of the second source byte array (S2).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
Returns:
Returns 0 for success or -1 for error.

Definition at line 419 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned char  C 
)

Filter using SubByte: D = saturation0(S - C)

Parameters:
Src1Pointer to the start of the source byte array (S).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source arrays.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2193 of file SDL_imageFilter.c.

SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint ( unsigned char *  Src1,
unsigned char *  Dest,
unsigned int  length,
unsigned int  C 
)

Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)

Parameters:
Src1Pointer to the start of the source byte array (S1).
DestPointer to the start of the destination byte array (D).
lengthThe number of bytes in the source array.
CConstant to subtract (C).
Returns:
Returns 0 for success or -1 for error.

Definition at line 2322 of file SDL_imageFilter.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__image_filter_8h_source.html000066400000000000000000001300461225506657100236720ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_imageFilter.h Source File
I:/Sources/sdlgfx/SDL_imageFilter.h
Go to the documentation of this file.
00001 /*
00002 
00003 SDL_imageFilter.h: byte-image "filter" routines 
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL_imageFilter_h
00031 #define _SDL_imageFilter_h
00032 
00033 /* Set up for C function definitions, even when using C++ */
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038         /* ---- Function Prototypes */
00039 
00040 #ifdef _MSC_VER
00041 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
00042 #    define SDL_IMAGEFILTER_SCOPE __declspec(dllexport)
00043 #  else
00044 #    ifdef LIBSDL_GFX_DLL_IMPORT
00045 #      define SDL_IMAGEFILTER_SCOPE __declspec(dllimport)
00046 #    endif
00047 #  endif
00048 #endif
00049 #ifndef SDL_IMAGEFILTER_SCOPE
00050 #  define SDL_IMAGEFILTER_SCOPE extern
00051 #endif
00052 
00053         /* Comments:                                                                           */
00054         /*  1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */
00055         /*  2.) Data that is not within an 8 byte boundary is processed using the C routine.   */
00056         /*  3.) Convolution routines do not have C routines at this time.                      */
00057 
00058         // Detect MMX capability in CPU
00059         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect(void);
00060 
00061         // Force use of MMX off (or turn possible use back on)
00062         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff(void);
00063         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon(void);
00064 
00065         //
00066         // All routines return:
00067         //   0   OK
00068         //  -1   Error (internal error, parameter error)
00069         //
00070 
00071         //  SDL_imageFilterAdd: D = saturation255(S1 + S2)
00072         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00073 
00074         //  SDL_imageFilterMean: D = S1/2 + S2/2
00075         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00076 
00077         //  SDL_imageFilterSub: D = saturation0(S1 - S2)
00078         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00079 
00080         //  SDL_imageFilterAbsDiff: D = | S1 - S2 |
00081         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00082 
00083         //  SDL_imageFilterMult: D = saturation(S1 * S2)
00084         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00085 
00086         //  SDL_imageFilterMultNor: D = S1 * S2   (non-MMX)
00087         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00088 
00089         //  SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
00090         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
00091                 unsigned int length);
00092 
00093         //  SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
00094         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
00095                 unsigned int length);
00096 
00097         //  SDL_imageFilterBitAnd: D = S1 & S2
00098         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00099 
00100         //  SDL_imageFilterBitOr: D = S1 | S2
00101         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00102 
00103         //  SDL_imageFilterDiv: D = S1 / S2   (non-MMX)
00104         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00105 
00106         //  SDL_imageFilterBitNegation: D = !S
00107         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length);
00108 
00109         //  SDL_imageFilterAddByte: D = saturation255(S + C)
00110         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00111 
00112         //  SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
00113         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
00114 
00115         //  SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
00116         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00117                 unsigned char C);
00118 
00119         //  SDL_imageFilterSubByte: D = saturation0(S - C)
00120         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00121 
00122         //  SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
00123         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
00124 
00125         //  SDL_imageFilterShiftRight: D = saturation0(S >> N)
00126         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00127 
00128         //  SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
00129         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00130 
00131         //  SDL_imageFilterMultByByte: D = saturation255(S * C)
00132         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00133 
00134         //  SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
00135         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00136                 unsigned char N, unsigned char C);
00137 
00138         //  SDL_imageFilterShiftLeftByte: D = (S << N)
00139         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00140                 unsigned char N);
00141 
00142         //  SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
00143         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00144                 unsigned char N);
00145 
00146         //  SDL_imageFilterShiftLeft: D = saturation255(S << N)
00147         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00148 
00149         //  SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
00150         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00151                 unsigned char T);
00152 
00153         //  SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
00154         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00155                 unsigned char Tmin, unsigned char Tmax);
00156 
00157         //  SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
00158         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin,
00159                 int Cmax, int Nmin, int Nmax);
00160 
00161         /* !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! */
00162 
00163         //  SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
00164         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows,
00165                 int columns, signed short *Kernel, unsigned char Divisor);
00166 
00167         //  SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
00168         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows,
00169                 int columns, signed short *Kernel, unsigned char Divisor);
00170 
00171         //  SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
00172         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows,
00173                 int columns, signed short *Kernel, unsigned char Divisor);
00174 
00175         //  SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
00176         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows,
00177                 int columns, signed short *Kernel, unsigned char Divisor);
00178 
00179         //  SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
00180         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
00181                 int columns, signed short *Kernel,
00182                 unsigned char NRightShift);
00183 
00184         //  SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
00185         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
00186                 int columns, signed short *Kernel,
00187                 unsigned char NRightShift);
00188 
00189         //  SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
00190         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
00191                 int columns, signed short *Kernel,
00192                 unsigned char NRightShift);
00193 
00194         //  SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
00195         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
00196                 int columns, signed short *Kernel,
00197                 unsigned char NRightShift);
00198 
00199         //  SDL_imageFilterSobelX: Dij = saturation255( ... )
00200         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns);
00201 
00202         //  SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
00203         SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
00204                 unsigned char NRightShift);
00205 
00206         // Align/restore stack to 32 byte boundary -- Functionality untested! --
00207         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterAlignStack(void);
00208         SDL_IMAGEFILTER_SCOPE void SDL_imageFilterRestoreStack(void);
00209 
00210         /* Ends C function definitions when using C++ */
00211 #ifdef __cplusplus
00212 }
00213 #endif
00214 
00215 #endif                          /* _SDL_imageFilter_h */
sdlgfx-2.0.25/Docs/html/_s_d_l__rotozoom_8c.html000066400000000000000000001630061225506657100215500ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.c File Reference
I:/Sources/sdlgfx/SDL_rotozoom.c File Reference
#include <stdlib.h>
#include <string.h>
#include "SDL_rotozoom.h"

Go to the source code of this file.

Data Structures

struct  tColorRGBA
 A 32 bit RGBA pixel. More...
struct  tColorY
 A 8bit Y/palette pixel. More...

Defines

#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 Returns maximum of two numbers a and b.
#define GUARD_ROWS   (2)
 Number of guard rows added to destination surfaces.
#define VALUE_LIMIT   0.001
 Lower limit of absolute zoom factor or rotation degrees.

Typedefs

typedef struct tColorRGBA tColorRGBA
 A 32 bit RGBA pixel.
typedef struct tColorY tColorY
 A 8bit Y/palette pixel.

Functions

Uint32 _colorkey (SDL_Surface *src)
 Returns colorkey info for a surface.
int _shrinkSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
 Internal 32 bit integer-factor averaging Shrinker.
int _shrinkSurfaceY (SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
 Internal 8 bit integer-factor averaging shrinker.
int _zoomSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy, int smooth)
 Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.
int _zoomSurfaceY (SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy)
 Internal 8 bit Zoomer without smoothing.
void _transformSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
 Internal 32 bit rotozoomer with optional anti-aliasing.
void transformSurfaceY (SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
 Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.
SDL_Surface * rotateSurface90Degrees (SDL_Surface *src, int numClockwiseTurns)
 Rotates a 32 bit surface in increments of 90 degrees.
void _rotozoomSurfaceSizeTrig (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight, double *canglezoom, double *sanglezoom)
 Internal target surface sizing function for rotozooms with trig result return.
void rotozoomSurfaceSizeXY (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.
void rotozoomSurfaceSize (int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurface() call.
SDL_Surface * rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth)
 Rotates and zooms a surface and optional anti-aliasing.
SDL_Surface * rotozoomSurfaceXY (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)
 Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
void zoomSurfaceSize (int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Calculates the size of the target surface for a zoomSurface() call.
SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx, double zoomy, int smooth)
 Zoom a surface by independent horizontal and vertical factors with optional smoothing.
SDL_Surface * shrinkSurface (SDL_Surface *src, int factorx, int factory)
 Shrink a surface by an integer ratio using averaging.

Define Documentation

#define GUARD_ROWS   (2)

Number of guard rows added to destination surfaces.

This is a simple but effective workaround for observed issues. These rows allocate extra memory and are then hidden from the surface. Rows are added to the end of destination surfaces when they are allocated. This catches any potential overflows which seem to happen with just the right src image dimensions and scale/rotation and can lead to a situation where the program can segfault.

Definition at line 73 of file SDL_rotozoom.c.

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Returns maximum of two numbers a and b.

Definition at line 61 of file SDL_rotozoom.c.

#define VALUE_LIMIT   0.001

Lower limit of absolute zoom factor or rotation degrees.

Definition at line 78 of file SDL_rotozoom.c.


Typedef Documentation

typedef struct tColorRGBA tColorRGBA

A 32 bit RGBA pixel.

typedef struct tColorY tColorY

A 8bit Y/palette pixel.


Function Documentation

Uint32 _colorkey ( SDL_Surface *  src)

Returns colorkey info for a surface.

Definition at line 83 of file SDL_rotozoom.c.

void _rotozoomSurfaceSizeTrig ( int  width,
int  height,
double  angle,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight,
double *  canglezoom,
double *  sanglezoom 
)

Internal target surface sizing function for rotozooms with trig result return.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
dstwidthThe calculated width of the destination surface.
dstheightThe calculated height of the destination surface.
canglezoomThe sine of the angle adjusted by the zoom factor.
sanglezoomThe cosine of the angle adjusted by the zoom factor.

Definition at line 949 of file SDL_rotozoom.c.

int _shrinkSurfaceRGBA ( SDL_Surface *  src,
SDL_Surface *  dst,
int  factorx,
int  factory 
)

Internal 32 bit integer-factor averaging Shrinker.

Shrinks 32 bit RGBA/ABGR 'src' surface to 'dst' surface. Averages color and alpha values values of src pixels to calculate dst pixels. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to shrink (input).
dstThe shrunken surface (output).
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
0 for success or -1 for error.

Definition at line 113 of file SDL_rotozoom.c.

int _shrinkSurfaceY ( SDL_Surface *  src,
SDL_Surface *  dst,
int  factorx,
int  factory 
)

Internal 8 bit integer-factor averaging shrinker.

Shrinks 8bit Y 'src' surface to 'dst' surface. Averages color (brightness) values values of src pixels to calculate dst pixels. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to shrink (input).
dstThe shrunken surface (output).
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
0 for success or -1 for error.

Definition at line 202 of file SDL_rotozoom.c.

void _transformSurfaceRGBA ( SDL_Surface *  src,
SDL_Surface *  dst,
int  cx,
int  cy,
int  isin,
int  icos,
int  flipx,
int  flipy,
int  smooth 
)

Internal 32 bit rotozoomer with optional anti-aliasing.

Rotates and zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control parameters by scanning the destination surface and applying optionally anti-aliasing by bilinear interpolation. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcSource surface.
dstDestination surface.
cxHorizontal center coordinate.
cyVertical center coordinate.
isinInteger version of sine of angle.
icosInteger version of cosine of angle.
flipxFlag indicating horizontal mirroring should be applied.
flipyFlag indicating vertical mirroring should be applied.
smoothFlag indicating anti-aliasing should be used.

Definition at line 638 of file SDL_rotozoom.c.

int _zoomSurfaceRGBA ( SDL_Surface *  src,
SDL_Surface *  dst,
int  flipx,
int  flipy,
int  smooth 
)

Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.

Zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to zoom (input).
dstThe zoomed surface (output).
flipxFlag indicating if the image should be horizontally flipped.
flipyFlag indicating if the image should be vertically flipped.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
0 for success or -1 for error.

Definition at line 286 of file SDL_rotozoom.c.

int _zoomSurfaceY ( SDL_Surface *  src,
SDL_Surface *  dst,
int  flipx,
int  flipy 
)

Internal 8 bit Zoomer without smoothing.

Zooms 8bit palette/Y 'src' surface to 'dst' surface. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcThe surface to zoom (input).
dstThe zoomed surface (output).
flipxFlag indicating if the image should be horizontally flipped.
flipyFlag indicating if the image should be vertically flipped.
Returns:
0 for success or -1 for error.

Definition at line 519 of file SDL_rotozoom.c.

SDL_Surface* rotateSurface90Degrees ( SDL_Surface *  src,
int  numClockwiseTurns 
)

Rotates a 32 bit surface in increments of 90 degrees.

Specialized 90 degree rotator which rotates a 'src' surface in 90 degree increments clockwise returning a new surface. Faster than rotozoomer since not scanning or interpolation takes place. Input surface must be 32 bit. (code contributed by J. Schiller, improved by C. Allport and A. Schiffler)

Parameters:
srcSource surface to rotate.
numClockwiseTurnsNumber of clockwise 90 degree turns to apply to the source.
Returns:
The new, rotated surface; or NULL for surfaces with incorrect input format.

Definition at line 814 of file SDL_rotozoom.c.

SDL_Surface* rotozoomSurface ( SDL_Surface *  src,
double  angle,
double  zoom,
int  smooth 
)

Rotates and zooms a surface and optional anti-aliasing.

Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1030 of file SDL_rotozoom.c.

void rotozoomSurfaceSize ( int  width,
int  height,
double  angle,
double  zoom,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurface() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 1008 of file SDL_rotozoom.c.

void rotozoomSurfaceSizeXY ( int  width,
int  height,
double  angle,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 991 of file SDL_rotozoom.c.

SDL_Surface* rotozoomSurfaceXY ( SDL_Surface *  src,
double  angle,
double  zoomx,
double  zoomy,
int  smooth 
)

Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.

Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1051 of file SDL_rotozoom.c.

SDL_Surface* shrinkSurface ( SDL_Surface *  src,
int  factorx,
int  factory 
)

Shrink a surface by an integer ratio using averaging.

Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface. 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, 3=1/3 the size, etc.) The destination surface is antialiased by averaging the source box RGBA or Y information. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. The input surface is not modified. The output surface is newly allocated.

Parameters:
srcThe surface to shrink.
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
The new, shrunken surface.

Definition at line 1548 of file SDL_rotozoom.c.

void transformSurfaceY ( SDL_Surface *  src,
SDL_Surface *  dst,
int  cx,
int  cy,
int  isin,
int  icos,
int  flipx,
int  flipy 
)

Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.

Rotates and zooms 8 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control parameters by scanning the destination surface. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.

Parameters:
srcSource surface.
dstDestination surface.
cxHorizontal center coordinate.
cyVertical center coordinate.
isinInteger version of sine of angle.
icosInteger version of cosine of angle.
flipxFlag indicating horizontal mirroring should be applied.
flipyFlag indicating vertical mirroring should be applied.

Definition at line 755 of file SDL_rotozoom.c.

SDL_Surface* zoomSurface ( SDL_Surface *  src,
double  zoomx,
double  zoomy,
int  smooth 
)

Zoom a surface by independent horizontal and vertical factors with optional smoothing.

Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. If zoom factors are negative, the image is flipped on the axes.

Parameters:
srcThe surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new, zoomed surface.

Definition at line 1392 of file SDL_rotozoom.c.

void zoomSurfaceSize ( int  width,
int  height,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Calculates the size of the target surface for a zoomSurface() call.

The minimum size of the target surface is 1. The input factors can be positive or negative.

Parameters:
widthThe width of the source surface to zoom.
heightThe height of the source surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
dstwidthPointer to an integer to store the calculated width of the zoomed target surface.
dstheightPointer to an integer to store the calculated height of the zoomed target surface.

Definition at line 1342 of file SDL_rotozoom.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__rotozoom_8c_source.html000066400000000000000000004176371225506657100231440ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.c Source File
I:/Sources/sdlgfx/SDL_rotozoom.c
Go to the documentation of this file.
00001 /*  
00002 
00003 SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifdef WIN32
00031 #include <windows.h>
00032 #endif
00033 
00034 #include <stdlib.h>
00035 #include <string.h>
00036 
00037 #include "SDL_rotozoom.h"
00038 
00039 /* ---- Internally used structures */
00040 
00044 typedef struct tColorRGBA {
00045         Uint8 r;
00046         Uint8 g;
00047         Uint8 b;
00048         Uint8 a;
00049 } tColorRGBA;
00050 
00054 typedef struct tColorY {
00055         Uint8 y;
00056 } tColorY;
00057 
00061 #define MAX(a,b)    (((a) > (b)) ? (a) : (b))
00062 
00073 #define GUARD_ROWS (2)
00074 
00078 #define VALUE_LIMIT     0.001
00079 
00083 Uint32 _colorkey(SDL_Surface *src)
00084 {
00085         Uint32 key = 0; 
00086 #if (SDL_MINOR_VERSION == 3)
00087         SDL_GetColorKey(src, &key);
00088 #else
00089         if (src) 
00090         {
00091                 key = src->format->colorkey;
00092         }
00093 #endif
00094         return key;
00095 }
00096 
00097 
00113 int _shrinkSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory)
00114 {
00115         int x, y, dx, dy, sgap, dgap, ra, ga, ba, aa;
00116         int n_average;
00117         tColorRGBA *sp, *osp, *oosp;
00118         tColorRGBA *dp;
00119 
00120         /*
00121         * Averaging integer shrink
00122         */
00123 
00124         /* Precalculate division factor */
00125         n_average = factorx*factory;
00126 
00127         /*
00128         * Scan destination
00129         */
00130         sp = (tColorRGBA *) src->pixels;
00131         sgap = src->pitch - src->w * 4;
00132 
00133         dp = (tColorRGBA *) dst->pixels;
00134         dgap = dst->pitch - dst->w * 4;
00135 
00136         for (y = 0; y < dst->h; y++) {
00137 
00138                 osp=sp;
00139                 for (x = 0; x < dst->w; x++) {
00140 
00141                         /* Trace out source box and accumulate */
00142                         oosp=sp;
00143                         ra=ga=ba=aa=0;
00144                         for (dy=0; dy < factory; dy++) {
00145                                 for (dx=0; dx < factorx; dx++) {
00146                                         ra += sp->r;
00147                                         ga += sp->g;
00148                                         ba += sp->b;
00149                                         aa += sp->a;
00150 
00151                                         sp++;
00152                                 } 
00153                                 /* src dx loop */
00154                                 sp = (tColorRGBA *)((Uint8*)sp + (src->pitch - 4*factorx)); // next y
00155                         }
00156                         /* src dy loop */
00157 
00158                         /* next box-x */
00159                         sp = (tColorRGBA *)((Uint8*)oosp + 4*factorx);
00160 
00161                         /* Store result in destination */
00162                         dp->r = ra/n_average;
00163                         dp->g = ga/n_average;
00164                         dp->b = ba/n_average;
00165                         dp->a = aa/n_average;
00166 
00167                         /*
00168                         * Advance destination pointer 
00169                         */
00170                         dp++;
00171                 } 
00172                 /* dst x loop */
00173 
00174                 /* next box-y */
00175                 sp = (tColorRGBA *)((Uint8*)osp + src->pitch*factory);
00176 
00177                 /*
00178                 * Advance destination pointers 
00179                 */
00180                 dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
00181         } 
00182         /* dst y loop */
00183 
00184         return (0);
00185 }
00186 
00202 int _shrinkSurfaceY(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory)
00203 {
00204         int x, y, dx, dy, sgap, dgap, a;
00205         int n_average;
00206         Uint8 *sp, *osp, *oosp;
00207         Uint8 *dp;
00208 
00209         /*
00210         * Averaging integer shrink
00211         */
00212 
00213         /* Precalculate division factor */
00214         n_average = factorx*factory;
00215 
00216         /*
00217         * Scan destination
00218         */
00219         sp = (Uint8 *) src->pixels;
00220         sgap = src->pitch - src->w;
00221 
00222         dp = (Uint8 *) dst->pixels;
00223         dgap = dst->pitch - dst->w;
00224 
00225         for (y = 0; y < dst->h; y++) {    
00226 
00227                 osp=sp;
00228                 for (x = 0; x < dst->w; x++) {
00229 
00230                         /* Trace out source box and accumulate */
00231                         oosp=sp;
00232                         a=0;
00233                         for (dy=0; dy < factory; dy++) {
00234                                 for (dx=0; dx < factorx; dx++) {
00235                                         a += (*sp);
00236                                         /* next x */           
00237                                         sp++;
00238                                 } 
00239                                 /* end src dx loop */         
00240                                 /* next y */
00241                                 sp = (Uint8 *)((Uint8*)sp + (src->pitch - factorx)); 
00242                         } 
00243                         /* end src dy loop */
00244 
00245                         /* next box-x */
00246                         sp = (Uint8 *)((Uint8*)oosp + factorx);
00247 
00248                         /* Store result in destination */
00249                         *dp = a/n_average;
00250 
00251                         /*
00252                         * Advance destination pointer 
00253                         */
00254                         dp++;
00255                 } 
00256                 /* end dst x loop */
00257 
00258                 /* next box-y */
00259                 sp = (Uint8 *)((Uint8*)osp + src->pitch*factory);
00260 
00261                 /*
00262                 * Advance destination pointers 
00263                 */
00264                 dp = (Uint8 *)((Uint8 *)dp + dgap);
00265         } 
00266         /* end dst y loop */
00267 
00268         return (0);
00269 }
00270 
00286 int _zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy, int smooth)
00287 {
00288         int x, y, sx, sy, ssx, ssy, *sax, *say, *csax, *csay, *salast, csx, csy, ex, ey, cx, cy, sstep, sstepx, sstepy;
00289         tColorRGBA *c00, *c01, *c10, *c11;
00290         tColorRGBA *sp, *csp, *dp;
00291         int spixelgap, spixelw, spixelh, dgap, t1, t2;
00292 
00293         /*
00294         * Allocate memory for row/column increments 
00295         */
00296         if ((sax = (int *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) {
00297                 return (-1);
00298         }
00299         if ((say = (int *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
00300                 free(sax);
00301                 return (-1);
00302         }
00303 
00304         /*
00305         * Precalculate row increments 
00306         */
00307         spixelw = (src->w - 1);
00308         spixelh = (src->h - 1);
00309         if (smooth) {
00310                 sx = (int) (65536.0 * (float) spixelw / (float) (dst->w - 1));
00311                 sy = (int) (65536.0 * (float) spixelh / (float) (dst->h - 1));
00312         } else {
00313                 sx = (int) (65536.0 * (float) (src->w) / (float) (dst->w));
00314                 sy = (int) (65536.0 * (float) (src->h) / (float) (dst->h));
00315         }
00316 
00317         /* Maximum scaled source size */
00318         ssx = (src->w << 16) - 1;
00319         ssy = (src->h << 16) - 1;
00320 
00321         /* Precalculate horizontal row increments */
00322         csx = 0;
00323         csax = sax;
00324         for (x = 0; x <= dst->w; x++) {
00325                 *csax = csx;
00326                 csax++;
00327                 csx += sx;
00328 
00329                 /* Guard from overflows */
00330                 if (csx > ssx) { 
00331                         csx = ssx; 
00332                 }
00333         }
00334 
00335         /* Precalculate vertical row increments */
00336         csy = 0;
00337         csay = say;
00338         for (y = 0; y <= dst->h; y++) {
00339                 *csay = csy;
00340                 csay++;
00341                 csy += sy;
00342 
00343                 /* Guard from overflows */
00344                 if (csy > ssy) {
00345                         csy = ssy;
00346                 }
00347         }
00348 
00349         sp = (tColorRGBA *) src->pixels;
00350         dp = (tColorRGBA *) dst->pixels;
00351         dgap = dst->pitch - dst->w * 4;
00352         spixelgap = src->pitch/4;
00353 
00354         if (flipx) sp += spixelw;
00355         if (flipy) sp += (spixelgap * spixelh);
00356 
00357         /*
00358         * Switch between interpolating and non-interpolating code 
00359         */
00360         if (smooth) {
00361 
00362                 /*
00363                 * Interpolating Zoom 
00364                 */
00365                 csay = say;
00366                 for (y = 0; y < dst->h; y++) {
00367                         csp = sp;
00368                         csax = sax;
00369                         for (x = 0; x < dst->w; x++) {
00370                                 /*
00371                                 * Setup color source pointers 
00372                                 */
00373                                 ex = (*csax & 0xffff);
00374                                 ey = (*csay & 0xffff);
00375                                 cx = (*csax >> 16);
00376                                 cy = (*csay >> 16);
00377                                 sstepx = cx < spixelw;
00378                                 sstepy = cy < spixelh;
00379                                 c00 = sp;
00380                                 c01 = sp;
00381                                 c10 = sp;
00382                                 if (sstepy) {
00383                                         if (flipy) {
00384                                                 c10 -= spixelgap;
00385                                         } else {
00386                                                 c10 += spixelgap;
00387                                         }
00388                                 }
00389                                 c11 = c10;
00390                                 if (sstepx) {
00391                                         if (flipx) {
00392                                                 c01--;
00393                                                 c11--;
00394                                         } else {
00395                                                 c01++;
00396                                                 c11++;
00397                                         }
00398                                 }
00399 
00400                                 /*
00401                                 * Draw and interpolate colors 
00402                                 */
00403                                 t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
00404                                 t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
00405                                 dp->r = (((t2 - t1) * ey) >> 16) + t1;
00406                                 t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
00407                                 t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
00408                                 dp->g = (((t2 - t1) * ey) >> 16) + t1;
00409                                 t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
00410                                 t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
00411                                 dp->b = (((t2 - t1) * ey) >> 16) + t1;
00412                                 t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
00413                                 t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
00414                                 dp->a = (((t2 - t1) * ey) >> 16) + t1;                          
00415                                 /*
00416                                 * Advance source pointer x
00417                                 */
00418                                 salast = csax;
00419                                 csax++;                         
00420                                 sstep = (*csax >> 16) - (*salast >> 16);
00421                                 if (flipx) {
00422                                         sp -= sstep;
00423                                 } else {
00424                                         sp += sstep;
00425                                 }
00426 
00427                                 /*
00428                                 * Advance destination pointer x
00429                                 */
00430                                 dp++;
00431                         }
00432                         /*
00433                         * Advance source pointer y
00434                         */
00435                         salast = csay;
00436                         csay++;
00437                         sstep = (*csay >> 16) - (*salast >> 16);
00438                         sstep *= spixelgap;
00439                         if (flipy) { 
00440                                 sp = csp - sstep;
00441                         } else {
00442                                 sp = csp + sstep;
00443                         }
00444 
00445                         /*
00446                         * Advance destination pointer y
00447                         */
00448                         dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
00449                 }
00450         } else {
00451                 /*
00452                 * Non-Interpolating Zoom 
00453                 */              
00454                 csay = say;
00455                 for (y = 0; y < dst->h; y++) {
00456                         csp = sp;
00457                         csax = sax;
00458                         for (x = 0; x < dst->w; x++) {
00459                                 /*
00460                                 * Draw 
00461                                 */
00462                                 *dp = *sp;
00463 
00464                                 /*
00465                                 * Advance source pointer x
00466                                 */
00467                                 salast = csax;
00468                                 csax++;                         
00469                                 sstep = (*csax >> 16) - (*salast >> 16);
00470                                 if (flipx) sstep = -sstep;
00471                                 sp += sstep;
00472 
00473                                 /*
00474                                 * Advance destination pointer x
00475                                 */
00476                                 dp++;
00477                         }
00478                         /*
00479                         * Advance source pointer y
00480                         */
00481                         salast = csay;
00482                         csay++;
00483                         sstep = (*csay >> 16) - (*salast >> 16);
00484                         sstep *= spixelgap;
00485                         if (flipy) sstep = -sstep;                      
00486                         sp = csp + sstep;
00487 
00488                         /*
00489                         * Advance destination pointer y
00490                         */
00491                         dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
00492                 }
00493         }
00494 
00495         /*
00496         * Remove temp arrays 
00497         */
00498         free(sax);
00499         free(say);
00500 
00501         return (0);
00502 }
00503 
00519 int _zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
00520 {
00521         int x, y;
00522         Uint32 *sax, *say, *csax, *csay;
00523         int csx, csy;
00524         Uint8 *sp, *dp, *csp;
00525         int dgap;
00526 
00527         /*
00528         * Allocate memory for row increments 
00529         */
00530         if ((sax = (Uint32 *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) {
00531                 return (-1);
00532         }
00533         if ((say = (Uint32 *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
00534                 free(sax);
00535                 return (-1);
00536         }
00537 
00538         /*
00539         * Pointer setup 
00540         */
00541         sp = csp = (Uint8 *) src->pixels;
00542         dp = (Uint8 *) dst->pixels;
00543         dgap = dst->pitch - dst->w;
00544 
00545         if (flipx) csp += (src->w-1);
00546         if (flipy) csp  = ( (Uint8*)csp + src->pitch*(src->h-1) );
00547 
00548         /*
00549         * Precalculate row increments 
00550         */
00551         csx = 0;
00552         csax = sax;
00553         for (x = 0; x < dst->w; x++) {
00554                 csx += src->w;
00555                 *csax = 0;
00556                 while (csx >= dst->w) {
00557                         csx -= dst->w;
00558                         (*csax)++;
00559                 }
00560                 (*csax) = (*csax) * (flipx ? -1 : 1);
00561                 csax++;
00562         }
00563         csy = 0;
00564         csay = say;
00565         for (y = 0; y < dst->h; y++) {
00566                 csy += src->h;
00567                 *csay = 0;
00568                 while (csy >= dst->h) {
00569                         csy -= dst->h;
00570                         (*csay)++;
00571                 }
00572                 (*csay) = (*csay) * (flipy ? -1 : 1);
00573                 csay++;
00574         }
00575 
00576         /*
00577         * Draw 
00578         */
00579         csay = say;
00580         for (y = 0; y < dst->h; y++) {
00581                 csax = sax;
00582                 sp = csp;
00583                 for (x = 0; x < dst->w; x++) {
00584                         /*
00585                         * Draw 
00586                         */
00587                         *dp = *sp;
00588                         /*
00589                         * Advance source pointers 
00590                         */
00591                         sp += (*csax);
00592                         csax++;
00593                         /*
00594                         * Advance destination pointer 
00595                         */
00596                         dp++;
00597                 }
00598                 /*
00599                 * Advance source pointer (for row) 
00600                 */
00601                 csp += ((*csay) * src->pitch);
00602                 csay++;
00603 
00604                 /*
00605                 * Advance destination pointers 
00606                 */
00607                 dp += dgap;
00608         }
00609 
00610         /*
00611         * Remove temp arrays 
00612         */
00613         free(sax);
00614         free(say);
00615 
00616         return (0);
00617 }
00618 
00638 void _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
00639 {
00640         int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
00641         tColorRGBA c00, c01, c10, c11, cswap;
00642         tColorRGBA *pc, *sp;
00643         int gap;
00644 
00645         /*
00646         * Variable setup 
00647         */
00648         xd = ((src->w - dst->w) << 15);
00649         yd = ((src->h - dst->h) << 15);
00650         ax = (cx << 16) - (icos * cx);
00651         ay = (cy << 16) - (isin * cx);
00652         sw = src->w - 1;
00653         sh = src->h - 1;
00654         pc = (tColorRGBA*) dst->pixels;
00655         gap = dst->pitch - dst->w * 4;
00656 
00657         /*
00658         * Switch between interpolating and non-interpolating code 
00659         */
00660         if (smooth) {
00661                 for (y = 0; y < dst->h; y++) {
00662                         dy = cy - y;
00663                         sdx = (ax + (isin * dy)) + xd;
00664                         sdy = (ay - (icos * dy)) + yd;
00665                         for (x = 0; x < dst->w; x++) {
00666                                 dx = (sdx >> 16);
00667                                 dy = (sdy >> 16);
00668                                 if (flipx) dx = sw - dx;
00669                                 if (flipy) dy = sh - dy;
00670                                 if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
00671                                         sp = (tColorRGBA *)src->pixels;;
00672                                         sp += ((src->pitch/4) * dy);
00673                                         sp += dx;
00674                                         c00 = *sp;
00675                                         sp += 1;
00676                                         c01 = *sp;
00677                                         sp += (src->pitch/4);
00678                                         c11 = *sp;
00679                                         sp -= 1;
00680                                         c10 = *sp;
00681                                         if (flipx) {
00682                                                 cswap = c00; c00=c01; c01=cswap;
00683                                                 cswap = c10; c10=c11; c11=cswap;
00684                                         }
00685                                         if (flipy) {
00686                                                 cswap = c00; c00=c10; c10=cswap;
00687                                                 cswap = c01; c01=c11; c11=cswap;
00688                                         }
00689                                         /*
00690                                         * Interpolate colors 
00691                                         */
00692                                         ex = (sdx & 0xffff);
00693                                         ey = (sdy & 0xffff);
00694                                         t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
00695                                         t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
00696                                         pc->r = (((t2 - t1) * ey) >> 16) + t1;
00697                                         t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
00698                                         t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
00699                                         pc->g = (((t2 - t1) * ey) >> 16) + t1;
00700                                         t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
00701                                         t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
00702                                         pc->b = (((t2 - t1) * ey) >> 16) + t1;
00703                                         t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
00704                                         t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
00705                                         pc->a = (((t2 - t1) * ey) >> 16) + t1;
00706                                 }
00707                                 sdx += icos;
00708                                 sdy += isin;
00709                                 pc++;
00710                         }
00711                         pc = (tColorRGBA *) ((Uint8 *) pc + gap);
00712                 }
00713         } else {
00714                 for (y = 0; y < dst->h; y++) {
00715                         dy = cy - y;
00716                         sdx = (ax + (isin * dy)) + xd;
00717                         sdy = (ay - (icos * dy)) + yd;
00718                         for (x = 0; x < dst->w; x++) {
00719                                 dx = (short) (sdx >> 16);
00720                                 dy = (short) (sdy >> 16);
00721                                 if (flipx) dx = (src->w-1)-dx;
00722                                 if (flipy) dy = (src->h-1)-dy;
00723                                 if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
00724                                         sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy);
00725                                         sp += dx;
00726                                         *pc = *sp;
00727                                 }
00728                                 sdx += icos;
00729                                 sdy += isin;
00730                                 pc++;
00731                         }
00732                         pc = (tColorRGBA *) ((Uint8 *) pc + gap);
00733                 }
00734         }
00735 }
00736 
00755 void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
00756 {
00757         int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
00758         tColorY *pc, *sp;
00759         int gap;
00760 
00761         /*
00762         * Variable setup 
00763         */
00764         xd = ((src->w - dst->w) << 15);
00765         yd = ((src->h - dst->h) << 15);
00766         ax = (cx << 16) - (icos * cx);
00767         ay = (cy << 16) - (isin * cx);
00768         sw = src->w - 1;
00769         sh = src->h - 1;
00770         pc = (tColorY*) dst->pixels;
00771         gap = dst->pitch - dst->w;
00772         /*
00773         * Clear surface to colorkey 
00774         */      
00775         memset(pc, (int)(_colorkey(src) & 0xff), dst->pitch * dst->h);
00776         /*
00777         * Iterate through destination surface 
00778         */
00779         for (y = 0; y < dst->h; y++) {
00780                 dy = cy - y;
00781                 sdx = (ax + (isin * dy)) + xd;
00782                 sdy = (ay - (icos * dy)) + yd;
00783                 for (x = 0; x < dst->w; x++) {
00784                         dx = (short) (sdx >> 16);
00785                         dy = (short) (sdy >> 16);
00786                         if (flipx) dx = (src->w-1)-dx;
00787                         if (flipy) dy = (src->h-1)-dy;
00788                         if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
00789                                 sp = (tColorY *) (src->pixels);
00790                                 sp += (src->pitch * dy + dx);
00791                                 *pc = *sp;
00792                         }
00793                         sdx += icos;
00794                         sdy += isin;
00795                         pc++;
00796                 }
00797                 pc += gap;
00798         }
00799 }
00800 
00814 SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns) 
00815 {
00816         int row, col, newWidth, newHeight;
00817         int bpp, src_ipr, dst_ipr;
00818         SDL_Surface* dst;
00819         Uint32* srcBuf;
00820         Uint32* dstBuf;
00821 
00822         /* Has to be a valid surface pointer and only 32-bit surfaces (for now) */
00823         if (!src || src->format->BitsPerPixel != 32) { return NULL; }
00824 
00825         /* normalize numClockwiseTurns */
00826         while(numClockwiseTurns < 0) { numClockwiseTurns += 4; }
00827         numClockwiseTurns = (numClockwiseTurns % 4);
00828 
00829         /* if it's even, our new width will be the same as the source surface */
00830         newWidth = (numClockwiseTurns % 2) ? (src->h) : (src->w);
00831         newHeight = (numClockwiseTurns % 2) ? (src->w) : (src->h);
00832         dst = SDL_CreateRGBSurface( src->flags, newWidth, newHeight, src->format->BitsPerPixel,
00833                 src->format->Rmask,
00834                 src->format->Gmask, 
00835                 src->format->Bmask, 
00836                 src->format->Amask);
00837         if(!dst) {
00838                 return NULL;
00839         }
00840 
00841         if (SDL_MUSTLOCK(dst)) {
00842                 SDL_LockSurface(dst);
00843         }
00844         if (SDL_MUSTLOCK(dst)) {
00845                 SDL_LockSurface(dst);
00846         }
00847 
00848         /* Calculate int-per-row */
00849         bpp = src->format->BitsPerPixel / 8;
00850         src_ipr = src->pitch / bpp;
00851         dst_ipr = dst->pitch / bpp;
00852 
00853         switch(numClockwiseTurns) {
00854         case 0: /* Make a copy of the surface */
00855                 {
00856                         /* Unfortunately SDL_BlitSurface cannot be used to make a copy of the surface
00857                         since it does not preserve alpha. */
00858 
00859                         if (src->pitch == dst->pitch) {
00860                                 /* If the pitch is the same for both surfaces, the memory can be copied all at once. */
00861                                 memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
00862                         }
00863                         else
00864                         {
00865                                 /* If the pitch differs, copy each row separately */
00866                                 srcBuf = (Uint32*)(src->pixels); 
00867                                 dstBuf = (Uint32*)(dst->pixels);
00868                                 for (row = 0; row < src->h; row++) {
00869                                         memcpy(dstBuf, srcBuf, dst->w * bpp);
00870                                         srcBuf += src_ipr;
00871                                         dstBuf += dst_ipr;
00872                                 } /* end for(col) */
00873                         } /* end for(row) */
00874                 }
00875                 break;
00876 
00877                 /* rotate clockwise */
00878         case 1: /* rotated 90 degrees clockwise */
00879                 {
00880                         for (row = 0; row < src->h; ++row) {
00881                                 srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
00882                                 dstBuf = (Uint32*)(dst->pixels) + (dst->w - row - 1);
00883                                 for (col = 0; col < src->w; ++col) {
00884                                         *dstBuf = *srcBuf;
00885                                         ++srcBuf;
00886                                         dstBuf += dst_ipr;
00887                                 } 
00888                                 /* end for(col) */
00889                         } 
00890                         /* end for(row) */
00891                 }
00892                 break;
00893 
00894         case 2: /* rotated 180 degrees clockwise */
00895                 {
00896                         for (row = 0; row < src->h; ++row) {
00897                                 srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
00898                                 dstBuf = (Uint32*)(dst->pixels) + ((dst->h - row - 1) * dst_ipr) + (dst->w - 1);
00899                                 for (col = 0; col < src->w; ++col) {
00900                                         *dstBuf = *srcBuf;
00901                                         ++srcBuf;
00902                                         --dstBuf;
00903                                 } 
00904                         } 
00905                 }
00906                 break;
00907 
00908         case 3:
00909                 {
00910                         for (row = 0; row < src->h; ++row) {
00911                                 srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
00912                                 dstBuf = (Uint32*)(dst->pixels) + row + ((dst->h - 1) * dst_ipr);
00913                                 for (col = 0; col < src->w; ++col) {
00914                                         *dstBuf = *srcBuf;
00915                                         ++srcBuf;
00916                                         dstBuf -= dst_ipr;
00917                                 } 
00918                         } 
00919                 }
00920                 break;
00921         } 
00922         /* end switch */
00923 
00924         if (SDL_MUSTLOCK(src)) {
00925                 SDL_UnlockSurface(src);
00926         }
00927         if (SDL_MUSTLOCK(dst)) {
00928                 SDL_UnlockSurface(dst);
00929         }
00930 
00931         return dst;
00932 }
00933 
00934 
00949 void _rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, 
00950         int *dstwidth, int *dstheight, 
00951         double *canglezoom, double *sanglezoom)
00952 {
00953         double x, y, cx, cy, sx, sy;
00954         double radangle;
00955         int dstwidthhalf, dstheighthalf;
00956 
00957         /*
00958         * Determine destination width and height by rotating a centered source box 
00959         */
00960         radangle = angle * (M_PI / 180.0);
00961         *sanglezoom = sin(radangle);
00962         *canglezoom = cos(radangle);
00963         *sanglezoom *= zoomx;
00964         *canglezoom *= zoomx;
00965         x = (double)(width / 2);
00966         y = (double)(height / 2);
00967         cx = *canglezoom * x;
00968         cy = *canglezoom * y;
00969         sx = *sanglezoom * x;
00970         sy = *sanglezoom * y;
00971 
00972         dstwidthhalf = MAX((int)
00973                 ceil(MAX(MAX(MAX(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1);
00974         dstheighthalf = MAX((int)
00975                 ceil(MAX(MAX(MAX(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1);
00976         *dstwidth = 2 * dstwidthhalf;
00977         *dstheight = 2 * dstheighthalf;
00978 }
00979 
00991 void rotozoomSurfaceSizeXY(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
00992 {
00993         double dummy_sanglezoom, dummy_canglezoom;
00994 
00995         _rotozoomSurfaceSizeTrig(width, height, angle, zoomx, zoomy, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
00996 }
00997 
01008 void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
01009 {
01010         double dummy_sanglezoom, dummy_canglezoom;
01011 
01012         _rotozoomSurfaceSizeTrig(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
01013 }
01014 
01030 SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth)
01031 {
01032         return rotozoomSurfaceXY(src, angle, zoom, zoom, smooth);
01033 }
01034 
01051 SDL_Surface *rotozoomSurfaceXY(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth)
01052 {
01053         SDL_Surface *rz_src;
01054         SDL_Surface *rz_dst;
01055         double zoominv;
01056         double sanglezoom, canglezoom, sanglezoominv, canglezoominv;
01057         int dstwidthhalf, dstwidth, dstheighthalf, dstheight;
01058         int is32bit;
01059         int i, src_converted;
01060         int flipx,flipy;
01061         Uint8 r,g,b;
01062         Uint32 colorkey = 0;
01063         int colorKeyAvailable = 0;
01064 
01065         /*
01066         * Sanity check 
01067         */
01068         if (src == NULL)
01069                 return (NULL);
01070 
01071         if (src->flags & SDL_SRCCOLORKEY)
01072         {
01073                 colorkey = _colorkey(src);
01074                 SDL_GetRGB(colorkey, src->format, &r, &g, &b);
01075                 colorKeyAvailable = 1;
01076         }
01077         /*
01078         * Determine if source surface is 32bit or 8bit 
01079         */
01080         is32bit = (src->format->BitsPerPixel == 32);
01081         if ((is32bit) || (src->format->BitsPerPixel == 8)) {
01082                 /*
01083                 * Use source surface 'as is' 
01084                 */
01085                 rz_src = src;
01086                 src_converted = 0;
01087         } else {
01088                 /*
01089                 * New source surface is 32bit with a defined RGBA ordering 
01090                 */
01091                 rz_src =
01092                         SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 
01093 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
01094                         0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
01095 #else
01096                         0xff000000,  0x00ff0000, 0x0000ff00, 0x000000ff
01097 #endif
01098                         );
01099                 if(colorKeyAvailable)
01100                         SDL_SetColorKey(src, 0, 0);
01101 
01102                 SDL_BlitSurface(src, NULL, rz_src, NULL);
01103 
01104                 if(colorKeyAvailable)
01105                         SDL_SetColorKey(src, SDL_SRCCOLORKEY, colorkey);
01106                 src_converted = 1;
01107                 is32bit = 1;
01108         }
01109 
01110         /*
01111         * Sanity check zoom factor 
01112         */
01113         flipx = (zoomx<0.0);
01114         if (flipx) zoomx=-zoomx;
01115         flipy = (zoomy<0.0);
01116         if (flipy) zoomy=-zoomy;
01117         if (zoomx < VALUE_LIMIT) zoomx = VALUE_LIMIT;
01118         if (zoomy < VALUE_LIMIT) zoomy = VALUE_LIMIT;
01119         zoominv = 65536.0 / (zoomx * zoomx);
01120 
01121         /*
01122         * Check if we have a rotozoom or just a zoom 
01123         */
01124         if (fabs(angle) > VALUE_LIMIT) {
01125 
01126                 /*
01127                 * Angle!=0: full rotozoom 
01128                 */
01129                 /*
01130                 * ----------------------- 
01131                 */
01132 
01133                 /* Determine target size */
01134                 _rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, zoomx, zoomy, &dstwidth, &dstheight, &canglezoom, &sanglezoom);
01135 
01136                 /*
01137                 * Calculate target factors from sin/cos and zoom 
01138                 */
01139                 sanglezoominv = sanglezoom;
01140                 canglezoominv = canglezoom;
01141                 sanglezoominv *= zoominv;
01142                 canglezoominv *= zoominv;
01143 
01144                 /* Calculate half size */
01145                 dstwidthhalf = dstwidth / 2;
01146                 dstheighthalf = dstheight / 2;
01147 
01148                 /*
01149                 * Alloc space to completely contain the rotated surface 
01150                 */
01151                 rz_dst = NULL;
01152                 if (is32bit) {
01153                         /*
01154                         * Target surface is 32bit with source RGBA/ABGR ordering 
01155                         */
01156                         rz_dst =
01157                                 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01158                                 rz_src->format->Rmask, rz_src->format->Gmask,
01159                                 rz_src->format->Bmask, rz_src->format->Amask);
01160                 } else {
01161                         /*
01162                         * Target surface is 8bit 
01163                         */
01164                         rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01165                 }
01166 
01167                 /* Check target */
01168                 if (rz_dst == NULL)
01169                         return NULL;
01170 
01171                 /* Adjust for guard rows */
01172                 rz_dst->h = dstheight;
01173 
01174                 if (colorKeyAvailable == 1){
01175                         colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
01176 
01177                         SDL_FillRect(rz_dst, NULL, colorkey );
01178                 }
01179 
01180                 /*
01181                 * Lock source surface 
01182                 */
01183                 if (SDL_MUSTLOCK(rz_src)) {
01184                         SDL_LockSurface(rz_src);
01185                 }
01186 
01187                 /*
01188                 * Check which kind of surface we have 
01189                 */
01190                 if (is32bit) {
01191                         /*
01192                         * Call the 32bit transformation routine to do the rotation (using alpha) 
01193                         */
01194                         _transformSurfaceRGBA(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
01195                                 (int) (sanglezoominv), (int) (canglezoominv), 
01196                                 flipx, flipy,
01197                                 smooth);
01198                         /*
01199                         * Turn on source-alpha support 
01200                         */
01201                         SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
01202                         SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
01203                 } else {
01204                         /*
01205                         * Copy palette and colorkey info 
01206                         */
01207                         for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01208                                 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01209                         }
01210                         rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01211                         /*
01212                         * Call the 8bit transformation routine to do the rotation 
01213                         */
01214                         transformSurfaceY(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
01215                                 (int) (sanglezoominv), (int) (canglezoominv),
01216                                 flipx, flipy);
01217                         SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
01218                 }
01219                 /*
01220                 * Unlock source surface 
01221                 */
01222                 if (SDL_MUSTLOCK(rz_src)) {
01223                         SDL_UnlockSurface(rz_src);
01224                 }
01225 
01226         } else {
01227 
01228                 /*
01229                 * Angle=0: Just a zoom 
01230                 */
01231                 /*
01232                 * -------------------- 
01233                 */
01234 
01235                 /*
01236                 * Calculate target size
01237                 */
01238                 zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
01239 
01240                 /*
01241                 * Alloc space to completely contain the zoomed surface 
01242                 */
01243                 rz_dst = NULL;
01244                 if (is32bit) {
01245                         /*
01246                         * Target surface is 32bit with source RGBA/ABGR ordering 
01247                         */
01248                         rz_dst =
01249                                 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01250                                 rz_src->format->Rmask, rz_src->format->Gmask,
01251                                 rz_src->format->Bmask, rz_src->format->Amask);
01252                 } else {
01253                         /*
01254                         * Target surface is 8bit 
01255                         */
01256                         rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01257                 }
01258 
01259                 /* Check target */
01260                 if (rz_dst == NULL)
01261                         return NULL;
01262 
01263                 /* Adjust for guard rows */
01264                 rz_dst->h = dstheight;
01265 
01266                 if (colorKeyAvailable == 1){
01267                         colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
01268 
01269                         SDL_FillRect(rz_dst, NULL, colorkey );
01270                 }
01271 
01272                 /*
01273                 * Lock source surface 
01274                 */
01275                 if (SDL_MUSTLOCK(rz_src)) {
01276                         SDL_LockSurface(rz_src);
01277                 }
01278 
01279                 /*
01280                 * Check which kind of surface we have 
01281                 */
01282                 if (is32bit) {
01283                         /*
01284                         * Call the 32bit transformation routine to do the zooming (using alpha) 
01285                         */
01286                         _zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth);
01287 
01288                         /*
01289                         * Turn on source-alpha support 
01290                         */
01291                         SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
01292                         SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
01293                 } else {
01294                         /*
01295                         * Copy palette and colorkey info 
01296                         */
01297                         for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01298                                 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01299                         }
01300                         rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01301 
01302                         /*
01303                         * Call the 8bit transformation routine to do the zooming 
01304                         */
01305                         _zoomSurfaceY(rz_src, rz_dst, flipx, flipy);
01306                         SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
01307                 }
01308 
01309                 /*
01310                 * Unlock source surface 
01311                 */
01312                 if (SDL_MUSTLOCK(rz_src)) {
01313                         SDL_UnlockSurface(rz_src);
01314                 }
01315         }
01316 
01317         /*
01318         * Cleanup temp surface 
01319         */
01320         if (src_converted) {
01321                 SDL_FreeSurface(rz_src);
01322         }
01323 
01324         /*
01325         * Return destination surface 
01326         */
01327         return (rz_dst);
01328 }
01329 
01342 void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
01343 {
01344         /*
01345         * Make zoom factors positive 
01346         */
01347         int flipx, flipy;
01348         flipx = (zoomx<0.0);
01349         if (flipx) zoomx = -zoomx;
01350         flipy = (zoomy<0.0);
01351         if (flipy) zoomy = -zoomy;
01352 
01353         /*
01354         * Sanity check zoom factors 
01355         */
01356         if (zoomx < VALUE_LIMIT) {
01357                 zoomx = VALUE_LIMIT;
01358         }
01359         if (zoomy < VALUE_LIMIT) {
01360                 zoomy = VALUE_LIMIT;
01361         }
01362 
01363         /*
01364         * Calculate target size 
01365         */
01366         *dstwidth = (int) floor(((double) width * zoomx) + 0.5);
01367         *dstheight = (int) floor(((double) height * zoomy) + 0.5);
01368         if (*dstwidth < 1) {
01369                 *dstwidth = 1;
01370         }
01371         if (*dstheight < 1) {
01372                 *dstheight = 1;
01373         }
01374 }
01375 
01392 SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth)
01393 {
01394         SDL_Surface *rz_src;
01395         SDL_Surface *rz_dst;
01396         int dstwidth, dstheight;
01397         int is32bit;
01398         int i, src_converted;
01399         int flipx, flipy;
01400 
01401         /*
01402         * Sanity check 
01403         */
01404         if (src == NULL)
01405                 return (NULL);
01406 
01407         /*
01408         * Determine if source surface is 32bit or 8bit 
01409         */
01410         is32bit = (src->format->BitsPerPixel == 32);
01411         if ((is32bit) || (src->format->BitsPerPixel == 8)) {
01412                 /*
01413                 * Use source surface 'as is' 
01414                 */
01415                 rz_src = src;
01416                 src_converted = 0;
01417         } else {
01418                 /*
01419                 * New source surface is 32bit with a defined RGBA ordering 
01420                 */
01421                 rz_src =
01422                         SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 
01423 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
01424                         0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
01425 #else
01426                         0xff000000,  0x00ff0000, 0x0000ff00, 0x000000ff
01427 #endif
01428                         );
01429                 if (rz_src == NULL) {
01430                         return NULL;
01431                 }
01432                 SDL_BlitSurface(src, NULL, rz_src, NULL);
01433                 src_converted = 1;
01434                 is32bit = 1;
01435         }
01436 
01437         flipx = (zoomx<0.0);
01438         if (flipx) zoomx = -zoomx;
01439         flipy = (zoomy<0.0);
01440         if (flipy) zoomy = -zoomy;
01441 
01442         /* Get size if target */
01443         zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
01444 
01445         /*
01446         * Alloc space to completely contain the zoomed surface 
01447         */
01448         rz_dst = NULL;
01449         if (is32bit) {
01450                 /*
01451                 * Target surface is 32bit with source RGBA/ABGR ordering 
01452                 */
01453                 rz_dst =
01454                         SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01455                         rz_src->format->Rmask, rz_src->format->Gmask,
01456                         rz_src->format->Bmask, rz_src->format->Amask);
01457         } else {
01458                 /*
01459                 * Target surface is 8bit 
01460                 */
01461                 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01462         }
01463 
01464         /* Check target */
01465         if (rz_dst == NULL) {
01466                 /*
01467                 * Cleanup temp surface 
01468                 */
01469                 if (src_converted) {
01470                         SDL_FreeSurface(rz_src);
01471                 }               
01472                 return NULL;
01473         }
01474 
01475         /* Adjust for guard rows */
01476         rz_dst->h = dstheight;
01477 
01478         /*
01479         * Lock source surface 
01480         */
01481         if (SDL_MUSTLOCK(rz_src)) {
01482                 SDL_LockSurface(rz_src);
01483         }
01484 
01485         /*
01486         * Check which kind of surface we have 
01487         */
01488         if (is32bit) {
01489                 /*
01490                 * Call the 32bit transformation routine to do the zooming (using alpha) 
01491                 */
01492                 _zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth);
01493                 /*
01494                 * Turn on source-alpha support 
01495                 */
01496                 SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
01497         } else {
01498                 /*
01499                 * Copy palette and colorkey info 
01500                 */
01501                 for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01502                         rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01503                 }
01504                 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01505                 /*
01506                 * Call the 8bit transformation routine to do the zooming 
01507                 */
01508                 _zoomSurfaceY(rz_src, rz_dst, flipx, flipy);
01509                 SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
01510         }
01511         /*
01512         * Unlock source surface 
01513         */
01514         if (SDL_MUSTLOCK(rz_src)) {
01515                 SDL_UnlockSurface(rz_src);
01516         }
01517 
01518         /*
01519         * Cleanup temp surface 
01520         */
01521         if (src_converted) {
01522                 SDL_FreeSurface(rz_src);
01523         }
01524 
01525         /*
01526         * Return destination surface 
01527         */
01528         return (rz_dst);
01529 }
01530 
01547 /*@null@*/ 
01548 SDL_Surface *shrinkSurface(SDL_Surface *src, int factorx, int factory)
01549 {
01550         int result;
01551         SDL_Surface *rz_src;
01552         SDL_Surface *rz_dst = NULL;
01553         int dstwidth, dstheight;
01554         int is32bit;
01555         int i, src_converted;
01556         int haveError = 0;
01557 
01558         /*
01559         * Sanity check 
01560         */
01561         if (src == NULL) {
01562                 return (NULL);
01563         }
01564 
01565         /*
01566         * Determine if source surface is 32bit or 8bit 
01567         */
01568         is32bit = (src->format->BitsPerPixel == 32);
01569         if ((is32bit) || (src->format->BitsPerPixel == 8)) {
01570                 /*
01571                 * Use source surface 'as is' 
01572                 */
01573                 rz_src = src;
01574                 src_converted = 0;
01575         } else {
01576                 /*
01577                 * New source surface is 32bit with a defined RGBA ordering 
01578                 */
01579                 rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 
01580 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
01581                         0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
01582 #else
01583                         0xff000000,  0x00ff0000, 0x0000ff00, 0x000000ff
01584 #endif
01585                         );
01586                 if (rz_src==NULL) {
01587                         haveError = 1;
01588                         goto exitShrinkSurface;
01589                 }
01590 
01591                 SDL_BlitSurface(src, NULL, rz_src, NULL);
01592                 src_converted = 1;
01593                 is32bit = 1;
01594         }
01595 
01596         /*
01597         * Lock the surface 
01598         */
01599         if (SDL_MUSTLOCK(rz_src)) {
01600                 if (SDL_LockSurface(rz_src) < 0) {
01601                         haveError = 1;
01602                         goto exitShrinkSurface;
01603                 }
01604         }
01605 
01606         /* Get size for target */
01607         dstwidth=rz_src->w/factorx;
01608         while (dstwidth*factorx>rz_src->w) { dstwidth--; }
01609         dstheight=rz_src->h/factory;
01610         while (dstheight*factory>rz_src->h) { dstheight--; }
01611 
01612         /*
01613         * Alloc space to completely contain the shrunken surface
01614         * (with added guard rows)
01615         */
01616         if (is32bit==1) {
01617                 /*
01618                 * Target surface is 32bit with source RGBA/ABGR ordering 
01619                 */
01620                 rz_dst =
01621                         SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
01622                         rz_src->format->Rmask, rz_src->format->Gmask,
01623                         rz_src->format->Bmask, rz_src->format->Amask);
01624         } else {
01625                 /*
01626                 * Target surface is 8bit 
01627                 */
01628                 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
01629         }
01630 
01631         /* Check target */
01632         if (rz_dst == NULL) {
01633                 haveError = 1;
01634                 goto exitShrinkSurface;
01635         }
01636 
01637         /* Adjust for guard rows */
01638         rz_dst->h = dstheight;
01639 
01640         /*
01641         * Check which kind of surface we have 
01642         */
01643         if (is32bit==1) {
01644                 /*
01645                 * Call the 32bit transformation routine to do the shrinking (using alpha) 
01646                 */
01647                 result = _shrinkSurfaceRGBA(rz_src, rz_dst, factorx, factory);          
01648                 if ((result!=0) || (rz_dst==NULL)) {
01649                         haveError = 1;
01650                         goto exitShrinkSurface;
01651                 }
01652 
01653                 /*
01654                 * Turn on source-alpha support 
01655                 */
01656                 result = SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
01657                 if (result!=0) {
01658                         haveError = 1;
01659                         goto exitShrinkSurface;
01660                 }
01661         } else {
01662                 /*
01663                 * Copy palette and colorkey info 
01664                 */
01665                 for (i = 0; i < rz_src->format->palette->ncolors; i++) {
01666                         rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
01667                 }
01668                 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
01669                 /*
01670                 * Call the 8bit transformation routine to do the shrinking 
01671                 */
01672                 result = _shrinkSurfaceY(rz_src, rz_dst, factorx, factory);
01673                 if (result!=0) {
01674                         haveError = 1;
01675                         goto exitShrinkSurface;
01676                 }
01677 
01678                 /*
01679                 * Set colorkey on target
01680                 */
01681                 result = SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
01682                 if (result!=0) {
01683                         haveError = 1;
01684                         goto exitShrinkSurface;
01685                 }               
01686         }
01687 
01688 exitShrinkSurface:
01689         if (rz_src!=NULL) {
01690                 /*
01691                 * Unlock source surface 
01692                 */
01693                 if (SDL_MUSTLOCK(rz_src)) {
01694                         SDL_UnlockSurface(rz_src);
01695                 }
01696 
01697                 /*
01698                 * Cleanup temp surface 
01699                 */
01700                 if (src_converted==1) {
01701                         SDL_FreeSurface(rz_src);
01702                 }
01703         }
01704 
01705         /* Check error state; maybe need to cleanup destination */
01706         if (haveError==1) {
01707                 if (rz_dst!=NULL) {
01708                         SDL_FreeSurface(rz_dst);
01709                 }
01710                 rz_dst=NULL;
01711         } 
01712 
01713         /*
01714         * Return destination surface 
01715         */
01716         return (rz_dst);
01717 }
sdlgfx-2.0.25/Docs/html/_s_d_l__rotozoom_8h.html000066400000000000000000000776761225506657100215760ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.h File Reference
I:/Sources/sdlgfx/SDL_rotozoom.h File Reference
#include <math.h>
#include "SDL.h"

Go to the source code of this file.

Defines

#define M_PI   3.141592654
#define SMOOTHING_OFF   0
 Disable anti-aliasing (no smoothing).
#define SMOOTHING_ON   1
 Enable anti-aliasing (smoothing).
#define SDL_ROTOZOOM_SCOPE   extern

Functions

SDL_ROTOZOOM_SCOPE SDL_Surface * rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth)
 Rotates and zooms a surface and optional anti-aliasing.
SDL_ROTOZOOM_SCOPE SDL_Surface * rotozoomSurfaceXY (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)
 Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize (int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurface() call.
SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.
SDL_ROTOZOOM_SCOPE SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx, double zoomy, int smooth)
 Zoom a surface by independent horizontal and vertical factors with optional smoothing.
SDL_ROTOZOOM_SCOPE void zoomSurfaceSize (int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
 Calculates the size of the target surface for a zoomSurface() call.
SDL_ROTOZOOM_SCOPE SDL_Surface * shrinkSurface (SDL_Surface *src, int factorx, int factory)
 Shrink a surface by an integer ratio using averaging.
SDL_ROTOZOOM_SCOPE SDL_Surface * rotateSurface90Degrees (SDL_Surface *src, int numClockwiseTurns)
 Rotates a 32 bit surface in increments of 90 degrees.

Define Documentation

#define M_PI   3.141592654

Definition at line 41 of file SDL_rotozoom.h.

#define SDL_ROTOZOOM_SCOPE   extern

Definition at line 70 of file SDL_rotozoom.h.

#define SMOOTHING_OFF   0

Disable anti-aliasing (no smoothing).

Definition at line 51 of file SDL_rotozoom.h.

#define SMOOTHING_ON   1

Enable anti-aliasing (smoothing).

Definition at line 56 of file SDL_rotozoom.h.


Function Documentation

SDL_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees ( SDL_Surface *  src,
int  numClockwiseTurns 
)

Rotates a 32 bit surface in increments of 90 degrees.

Specialized 90 degree rotator which rotates a 'src' surface in 90 degree increments clockwise returning a new surface. Faster than rotozoomer since not scanning or interpolation takes place. Input surface must be 32 bit. (code contributed by J. Schiller, improved by C. Allport and A. Schiffler)

Parameters:
srcSource surface to rotate.
numClockwiseTurnsNumber of clockwise 90 degree turns to apply to the source.
Returns:
The new, rotated surface; or NULL for surfaces with incorrect input format.

Definition at line 814 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE SDL_Surface* rotozoomSurface ( SDL_Surface *  src,
double  angle,
double  zoom,
int  smooth 
)

Rotates and zooms a surface and optional anti-aliasing.

Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1030 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize ( int  width,
int  height,
double  angle,
double  zoom,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurface() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomThe scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 1008 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY ( int  width,
int  height,
double  angle,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.

Parameters:
widthThe source surface width.
heightThe source surface height.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
dstwidthThe calculated width of the rotozoomed destination surface.
dstheightThe calculated height of the rotozoomed destination surface.

Definition at line 991 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE SDL_Surface* rotozoomSurfaceXY ( SDL_Surface *  src,
double  angle,
double  zoomx,
double  zoomy,
int  smooth 
)

Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.

Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
srcThe surface to rotozoom.
angleThe angle to rotate in degrees.
zoomxThe horizontal scaling factor.
zoomyThe vertical scaling factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new rotozoomed surface.

Definition at line 1051 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE SDL_Surface* shrinkSurface ( SDL_Surface *  src,
int  factorx,
int  factory 
)

Shrink a surface by an integer ratio using averaging.

Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface. 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, 3=1/3 the size, etc.) The destination surface is antialiased by averaging the source box RGBA or Y information. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. The input surface is not modified. The output surface is newly allocated.

Parameters:
srcThe surface to shrink.
factorxThe horizontal shrinking ratio.
factoryThe vertical shrinking ratio.
Returns:
The new, shrunken surface.

Definition at line 1548 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE SDL_Surface* zoomSurface ( SDL_Surface *  src,
double  zoomx,
double  zoomy,
int  smooth 
)

Zoom a surface by independent horizontal and vertical factors with optional smoothing.

Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. If zoom factors are negative, the image is flipped on the axes.

Parameters:
srcThe surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
smoothAntialiasing flag; set to SMOOTHING_ON to enable.
Returns:
The new, zoomed surface.

Definition at line 1392 of file SDL_rotozoom.c.

SDL_ROTOZOOM_SCOPE void zoomSurfaceSize ( int  width,
int  height,
double  zoomx,
double  zoomy,
int *  dstwidth,
int *  dstheight 
)

Calculates the size of the target surface for a zoomSurface() call.

The minimum size of the target surface is 1. The input factors can be positive or negative.

Parameters:
widthThe width of the source surface to zoom.
heightThe height of the source surface to zoom.
zoomxThe horizontal zoom factor.
zoomyThe vertical zoom factor.
dstwidthPointer to an integer to store the calculated width of the zoomed target surface.
dstheightPointer to an integer to store the calculated height of the zoomed target surface.

Definition at line 1342 of file SDL_rotozoom.c.

sdlgfx-2.0.25/Docs/html/_s_d_l__rotozoom_8h_source.html000066400000000000000000000352621225506657100231370ustar00rootroot00000000000000 SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.h Source File
I:/Sources/sdlgfx/SDL_rotozoom.h
Go to the documentation of this file.
00001 /*  
00002 
00003 SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL_rotozoom_h
00031 #define _SDL_rotozoom_h
00032 
00033 #include <math.h>
00034 
00035 /* Set up for C function definitions, even when using C++ */
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #ifndef M_PI
00041 #define M_PI    3.141592654
00042 #endif
00043 
00044 #include "SDL.h"
00045 
00046         /* ---- Defines */
00047 
00051 #define SMOOTHING_OFF           0
00052 
00056 #define SMOOTHING_ON            1
00057 
00058         /* ---- Function Prototypes */
00059 
00060 #ifdef _MSC_VER
00061 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
00062 #    define SDL_ROTOZOOM_SCOPE __declspec(dllexport)
00063 #  else
00064 #    ifdef LIBSDL_GFX_DLL_IMPORT
00065 #      define SDL_ROTOZOOM_SCOPE __declspec(dllimport)
00066 #    endif
00067 #  endif
00068 #endif
00069 #ifndef SDL_ROTOZOOM_SCOPE
00070 #  define SDL_ROTOZOOM_SCOPE extern
00071 #endif
00072 
00073         /* 
00074 
00075         Rotozoom functions
00076 
00077         */
00078 
00079         SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
00080 
00081         SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY
00082                 (SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth);
00083 
00084 
00085         SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
00086                 int *dstheight);
00087 
00088         SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY
00089                 (int width, int height, double angle, double zoomx, double zoomy, 
00090                 int *dstwidth, int *dstheight);
00091 
00092         /* 
00093 
00094         Zooming functions
00095 
00096         */
00097 
00098         SDL_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
00099 
00100         SDL_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
00101 
00102         /* 
00103 
00104         Shrinking functions
00105 
00106         */     
00107 
00108         SDL_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory);
00109 
00110         /* 
00111 
00112         Specialized rotation functions
00113 
00114         */
00115 
00116         SDL_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns);
00117 
00118         /* Ends C function definitions when using C++ */
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122 
00123 #endif                          /* _SDL_rotozoom_h */
sdlgfx-2.0.25/Docs/html/annotated.html000066400000000000000000000057741225506657100176140ustar00rootroot00000000000000 SDL_gfx: Data Structures
Data Structures
Here are the data structures with brief descriptions:
FPSmanagerStructure holding the state and timing information of the framerate controller
SDL_gfxBlitInfoThe structure passed to the low level blit functions
SDL_gfxBresenhamIteratorThe structure passed to the internal Bresenham iterator
SDL_gfxMurphyIteratorThe structure passed to the internal Murphy iterator
tColorRGBAA 32 bit RGBA pixel
tColorYA 8bit Y/palette pixel
sdlgfx-2.0.25/Docs/html/bc_s.png000077500000000000000000000013011225506657100163460ustar00rootroot00000000000000PNG  IHDR /9IDATxKQ9 SDL_gfx: Data Structure Index
Data Structure Index
F | S | T
  F  
  S  
SDL_gfxBresenhamIterator   tColorY   
SDL_gfxMurphyIterator   
FPSmanager   SDL_gfxBlitInfo   
  T  
tColorRGBA   
F | S | T
sdlgfx-2.0.25/Docs/html/closed.png000077500000000000000000000001761225506657100167220ustar00rootroot00000000000000PNG  IHDR EIDATxA @! Pi/`Є.?,!u zlޖJh1ߘ+vRLx@ (*79H l)IENDB`sdlgfx-2.0.25/Docs/html/doxygen.css000066400000000000000000000374161225506657100171360ustar00rootroot00000000000000/* The standard CSS for doxygen */ body, table, div, p, dl { font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; font-size: 13px; line-height: 1.3; } /* @group Heading Levels */ h1 { font-size: 150%; } .title { font-size: 150%; font-weight: bold; margin: 10px 2px; } h2 { font-size: 120%; } h3 { font-size: 100%; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited { color: #4665A2; } a.codeRef, a.codeRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } .fragment { font-family: monospace, fixed; font-size: 105%; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 8px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memItemLeft, .memItemRight, .memTemplParams { border-top: 1px solid #C4CFE5; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; } .memname { white-space: nowrap; font-weight: bold; margin-left: 6px; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 8px; border-top-left-radius: 8px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 8px; -moz-border-radius-topleft: 8px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 8px; -webkit-border-top-left-radius: 8px; background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 2px 5px; background-color: #FBFCFD; border-top-width: 0; /* opera specific markup */ border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); /* webkit specific markup */ -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .params, .retval, .exception, .tparams { border-spacing: 6px 2px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } /* @end */ /* @group Directory (tree) */ /* for the tree view */ .ftvtree { font-family: sans-serif; margin: 0px; } /* these are for tree view when used as main index */ .directory { font-size: 9pt; font-weight: bold; margin: 5px; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } /* The following two styles can be used to replace the root node title with an image of your choice. Simply uncomment the next two styles, specify the name of your image and be sure to set 'height' to the proper pixel height of your image. */ /* .directory h3.swap { height: 61px; background-repeat: no-repeat; background-image: url("yourimage.gif"); } .directory h3.swap span { display: none; } */ .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { font-size: 100%; font-weight: bold; } .directory-alt h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory-alt > h3 { margin-top: 0; } .directory-alt p { margin: 0px; white-space: nowrap; } .directory-alt div { display: none; margin: 0px; } .directory-alt img { vertical-align: -30%; } /* @end */ div.dynheader { margin-top: 8px; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.ingroups { margin-left: 5px; font-size: 8pt; padding-left: 5px; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 7px; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { border-left:4px solid; padding: 0 0 0 6px; } dl.note { border-color: #D0C000; } dl.warning, dl.attention { border-color: #FF0000; } dl.pre, dl.post, dl.invariant { border-color: #00D000; } dl.deprecated { border-color: #505050; } dl.todo { border-color: #00C0E0; } dl.test { border-color: #3030E0; } dl.bug { border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } pre.fragment { overflow: visible; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ } } sdlgfx-2.0.25/Docs/html/doxygen.png000066400000000000000000000075461225506657100171330ustar00rootroot00000000000000PNG  IHDRh ;-IDATx]{XysZ%ʔNF:FЪքb@;~ӎ"DHZm_4!-2UCe["_3LS|y>_ LZߦajLo}.2$Z);*.d~߳w'0@!ZZeͺwډ?O =\L[gdxr0 RrjJ*.WJN5qM[mޕSb58ļRB5SRus[2< %V'+%$fvĺRK$ C 4+xsQ}f[vZ 6c}!,Lt<ūdxH)/f襧C1v[~ 9%DDKgrN}M9Y3*/i謷%ÓU^#vr'p=]_7ySka-/!Ev902ɖF*, O!1k>QӳdxX:=GD<'fvRKUZjbi`t9cxڪVWsabiw11x%h޶9׉>oծhkG~Nls"^™d2%swW윧Dz W8c>1mBv8܉AZ Turth9kRSf/d1kbA.@+;:j ˫҉|#p4i]V~njxfv$եy| S[;BOKVցa 4x0:DN54>gxpo;Z:ɔbۇ|^T7=$4)L!/u#)9/rq%~a-poE,|gm /9/s|c /u P\a’1,;ueyK\"7-K!3>2amm r7M.(~[2Ʉ]C<b9[)v[~,_@\|8qܴ{}Qޔugr7J]|eڐ`4s5+ҡ\ٕxJ,uds&@yIeD;8nZ={ʘfQU|Xڝ)ض"tV-woJy>6谹 Frf͍ Kb(!@~) F{Ave'3H͍u @A$j"s&&b~twQ J~I J]=;=|S{瑓nʍ9˿˄.{ܴ`b ڞ)j\ΕY_E_.g0u2ݪiDWX'kqVgDO݄E 6 1cZėnNXx(]gL_M!b4+eʤd62[]Am,b@JՄ_,Wrr_g8&(QA4.ajAghSFJhheg;Lcs /RĢ,849:n`,o_~6YIqavʐv>=VEX޾5=uu^/ AeD䆸XjS#^˞3-٣[@vm X W¤v9ѽQ_{3W\؏:pajeI)tܱ8I>xdEd:4kONIq>m1!)[Vb47a@暍̱ p%5P~Z?| 30DN  } Un@ 3'T(,ϗ^.MA8a?UپJ<2S~@=hj3-G|8Y.]XRIT9XA$hIPv!vH}o)Ͷ8rߚ =*^iE«8"< Ht"Бx.ZM!b~ƒ !c bwzqT\ L*a.P7:*(Fp8O@5<917>y1zazs{/Q†9 j}SvYD*n]!rhyakj ʄg͑ d_*ll]^&}hnpȨ[.Y7..OڲX|e%L%L9e tO^ (p 3U%r J v2C z2Sf1]@ȝnp%"nJR2G+Z[?@[PcWKZ=Qi?yE`3+W;ӿfH%x2!%#M?;p)*u;p_z%#M !pWRphϦiE8gF?Kp)_+ǩXP&#j&q=n0Ln>D\J[tsI5)&~J :ÚAB@PKƴdoC)aSteLg.襩?M|ָbٚs+stٛ@`ᰱ*q:htw_Zِ^:cn{ӆݺ`N;כj*K}^4?&=zizkCcPBht'|UE1 ;&5v۵]@kS}pեy &>{f>P~ޞk^IENDB`sdlgfx-2.0.25/Docs/html/files.html000066400000000000000000000104041225506657100167230ustar00rootroot00000000000000 SDL_gfx: File List
File List
Here is a list of all files with brief descriptions:
I:/Sources/sdlgfx/README [code]
I:/Sources/sdlgfx/SDL_framerate.c [code]
I:/Sources/sdlgfx/SDL_framerate.h [code]
I:/Sources/sdlgfx/SDL_gfxBlitFunc.c [code]
I:/Sources/sdlgfx/SDL_gfxBlitFunc.h [code]
I:/Sources/sdlgfx/SDL_gfxPrimitives.c [code]
I:/Sources/sdlgfx/SDL_gfxPrimitives.h [code]
I:/Sources/sdlgfx/SDL_gfxPrimitives_font.h [code]
I:/Sources/sdlgfx/SDL_imageFilter.c [code]
I:/Sources/sdlgfx/SDL_imageFilter.h [code]
I:/Sources/sdlgfx/SDL_rotozoom.c [code]
I:/Sources/sdlgfx/SDL_rotozoom.h [code]
sdlgfx-2.0.25/Docs/html/functions.html000066400000000000000000000252271225506657100176420ustar00rootroot00000000000000 SDL_gfx: Data Fields
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- a -

- b -

- c -

- d -

- e -

- f -

- g -

- k -

- l -

- o -

- q -

- r -

- s -

- t -

- u -

- v -

- x -

- y -

sdlgfx-2.0.25/Docs/html/functions_vars.html000066400000000000000000000250531225506657100206720ustar00rootroot00000000000000 SDL_gfx: Data Fields - Variables sdlgfx-2.0.25/Docs/html/globals.html000066400000000000000000000152571225506657100172570ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- _ -

sdlgfx-2.0.25/Docs/html/globals_0x61.html000066400000000000000000000156311225506657100200310ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- a -

sdlgfx-2.0.25/Docs/html/globals_0x62.html000066400000000000000000000106621225506657100200310ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- b -

sdlgfx-2.0.25/Docs/html/globals_0x63.html000066400000000000000000000136061225506657100200330ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- c -

sdlgfx-2.0.25/Docs/html/globals_0x64.html000066400000000000000000000071601225506657100200320ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- d -

sdlgfx-2.0.25/Docs/html/globals_0x65.html000066400000000000000000000077131225506657100200370ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- e -

sdlgfx-2.0.25/Docs/html/globals_0x66.html000066400000000000000000000172301225506657100200330ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- f -

sdlgfx-2.0.25/Docs/html/globals_0x67.html000066400000000000000000000124471225506657100200410ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- g -

sdlgfx-2.0.25/Docs/html/globals_0x68.html000066400000000000000000000105361225506657100200370ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- h -

sdlgfx-2.0.25/Docs/html/globals_0x6c.html000066400000000000000000000077051225506657100201160ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- l -

sdlgfx-2.0.25/Docs/html/globals_0x6d.html000066400000000000000000000074611225506657100201160ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- m -

sdlgfx-2.0.25/Docs/html/globals_0x70.html000066400000000000000000000125161225506657100200300ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- p -

sdlgfx-2.0.25/Docs/html/globals_0x72.html000066400000000000000000000141321225506657100200260ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- r -

sdlgfx-2.0.25/Docs/html/globals_0x73.html000066400000000000000000000445001225506657100200310ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- s -

sdlgfx-2.0.25/Docs/html/globals_0x74.html000066400000000000000000000124541225506657100200350ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- t -

sdlgfx-2.0.25/Docs/html/globals_0x76.html000066400000000000000000000101021225506657100200230ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- v -

sdlgfx-2.0.25/Docs/html/globals_0x77.html000066400000000000000000000060741225506657100200410ustar00rootroot00000000000000 SDL_gfx: Data Fields
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- w -


Generated by  doxygen 1.6.2
sdlgfx-2.0.25/Docs/html/globals_0x7a.html000066400000000000000000000076421225506657100201150ustar00rootroot00000000000000 SDL_gfx: Globals
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- z -

sdlgfx-2.0.25/Docs/html/globals_defs.html000066400000000000000000000213341225506657100202510ustar00rootroot00000000000000 SDL_gfx: Globals
 

- a -

- c -

- d -

- f -

- g -

- h -

- m -

- s -

- v -

sdlgfx-2.0.25/Docs/html/globals_func.html000066400000000000000000000147471225506657100202750ustar00rootroot00000000000000 SDL_gfx: Globals
 

- _ -

sdlgfx-2.0.25/Docs/html/globals_func_0x61.html000066400000000000000000000142721225506657100210440ustar00rootroot00000000000000 SDL_gfx: Globals sdlgfx-2.0.25/Docs/html/globals_func_0x62.html000066400000000000000000000103521225506657100210400ustar00rootroot00000000000000 SDL_gfx: Globals sdlgfx-2.0.25/Docs/html/globals_func_0x63.html000066400000000000000000000103661225506657100210460ustar00rootroot00000000000000 SDL_gfx: Globals sdlgfx-2.0.25/Docs/html/globals_func_0x64.html000066400000000000000000000055601225506657100210470ustar00rootroot00000000000000 SDL_gfx: Data Fields
 

- d -


Generated by  doxygen 1.6.2
sdlgfx-2.0.25/Docs/html/globals_func_0x65.html000066400000000000000000000074031225506657100210460ustar00rootroot00000000000000 SDL_gfx: Globals
 

- e -

sdlgfx-2.0.25/Docs/html/globals_func_0x66.html000066400000000000000000000161211225506657100210440ustar00rootroot00000000000000 SDL_gfx: Globals
 

- f -

sdlgfx-2.0.25/Docs/html/globals_func_0x67.html000066400000000000000000000074341225506657100210540ustar00rootroot00000000000000 SDL_gfx: Globals
 

- g -

sdlgfx-2.0.25/Docs/html/globals_func_0x68.html000066400000000000000000000100261225506657100210440ustar00rootroot00000000000000 SDL_gfx: Globals
 

- h -

sdlgfx-2.0.25/Docs/html/globals_func_0x6c.html000066400000000000000000000073751225506657100211340ustar00rootroot00000000000000 SDL_gfx: Globals sdlgfx-2.0.25/Docs/html/globals_func_0x70.html000066400000000000000000000122061225506657100210370ustar00rootroot00000000000000 SDL_gfx: Globals
 

- p -

sdlgfx-2.0.25/Docs/html/globals_func_0x72.html000066400000000000000000000136221225506657100210440ustar00rootroot00000000000000 SDL_gfx: Globals
 

- r -

sdlgfx-2.0.25/Docs/html/globals_func_0x73.html000066400000000000000000000412311225506657100210420ustar00rootroot00000000000000 SDL_gfx: Globals
 

- s -

sdlgfx-2.0.25/Docs/html/globals_func_0x74.html000066400000000000000000000115631225506657100210500ustar00rootroot00000000000000 SDL_gfx: Globals
 

- t -

sdlgfx-2.0.25/Docs/html/globals_func_0x76.html000066400000000000000000000073771225506657100210620ustar00rootroot00000000000000 SDL_gfx: Globals sdlgfx-2.0.25/Docs/html/globals_func_0x77.html000066400000000000000000000057411225506657100210540ustar00rootroot00000000000000 SDL_gfx: Data Fields
 

- w -


Generated by  doxygen 1.6.2
sdlgfx-2.0.25/Docs/html/globals_func_0x7a.html000066400000000000000000000073321225506657100211240ustar00rootroot00000000000000 SDL_gfx: Globals
 

- z -

sdlgfx-2.0.25/Docs/html/globals_type.html000077500000000000000000000044211225506657100203120ustar00rootroot00000000000000 SDL_gfx: Globals
 
sdlgfx-2.0.25/Docs/html/globals_vars.html000066400000000000000000000044331225506657100203040ustar00rootroot00000000000000 SDL_gfx: Globals
 
sdlgfx-2.0.25/Docs/html/index.html000066400000000000000000001030701225506657100167320ustar00rootroot00000000000000 SDL_gfx: SDL_gfx - SDL-1.2 graphics drawing primitives, rotozoom and other supporting functions
SDL_gfx  2.0.25
SDL_gfx - SDL-1.2 graphics drawing primitives, rotozoom and other supporting functions

Contact and License

Email aschiffler at ferzkopp dot net to contact the author or better check author's homepage at http://www.ferzkopp.net for the most up-to-date contact information.

This library is licenced under the zlib License, see the file LICENSE for details.

Introduction

The SDL_gfx library evolved out of the SDL_gfxPrimitives code which provided basic drawing routines such as lines, circles or polygons for SDL Surfaces and adding a couple other useful functions for zooming images for example and doing basic image processing on byte arrays.

Note that SDL_gfx is compatible with SDL version 1.2 (not SDL2).

The current components of the SDL_gfx library are:

Notes on Graphics Primitives

Care has been taken so that all routines are fully alpha-aware and can blend any primitive onto the target surface if ALPHA<255. Surface depths supported are 1,2,3 and 4 bytes per pixel. Surface locking is implemented in each routine and the library should work well with hardware accelerated surfaces.


Currently, The following Anti-Aliased drawing primitives are available:

  • AA-line
  • AA-polygon
  • AA-circle
  • AA-ellipse

Note: All ___Color routines expect the color to be in the format 0xRRGGBBAA.

Notes on Rotozoomer

The rotozoom code is not ASM-speed quality, but it should be fast enough even for some realtime effects if the CPU is good or bitmaps small. With interpolation the routines are typically used for pre-rendering stuff in higher quality (i.e. smoothing) - that's also the reason why the API differs from SDL_BlitRect() - as they create a new target surface each time rotozoom is called. The final rendering speed is dependent on the target surface size as it is beeing xy-scanned when rendering the new surface.


Note also that the smoothing toggle is dependent on the input surface bit depth. 8bit surfaces will never be smoothed - only 32bit surfaces will.

Note that surfaces of other bit depth then 8 and 32 will be converted on the fly to a 32bit surface using a blit into a temporary surface. This impacts performance somewhat.

Smoothing (interpolation) flags work only on 32bit surfaces:

 #define SMOOTHING_OFF          0
 #define SMOOTHING_ON           1

Notes on Framerate Manager

The framerate functions are used to insert delays into the graphics loop to maintain a constant framerate.

The implementation is more sophisticated that the usual

        SDL_Delay(1000/FPS); 

call since these functions keep track of the desired game time per frame for a linearly interpolated sequence of future timing points of each frame. This is done to avoid rounding errors from the inherent instability in the delay generation and application.


i.e. the 100th frame of a game running at 50Hz will be accurately 2.00sec after the 1st frame (if the machine can keep up with the drawing).

The functions return 0 or 'value' for sucess and -1 for error. All functions use a pointer to a framerate-manager variable to operate.

Notes on ImageFilters

The imagefilter functions are a collection of MMX optimized routines that operate on continuous buffers of bytes - typically greyscale images from framegrabbers and such - performing functions such as image addition and binarization. All functions (almost ... not the the convolution routines) have a C implementation that is automatically used on systems without MMX capabilities.

The compiler flag -DUSE_MMX toggles the conditional compile of MMX assembly. An assembler must be installed (i.e. "nasm").

Notes on Custom Blitters

The custom blitter functions provide (limited) support for surface compositing - that is surfaces can be blitted together, and then still blitted to the screen with transparency intact.

Supported Platforms

Unix/Linux

The library compiles and is tested for a Linux target (gcc compiler) via the the usual configure;make;make install sequence.

Windows

A Win32 target is available (VisualC6/7/8/9, mingw32, xmingw32 cross-compiler). The SDL_gfx_VS2010.sln will open VS2010 (the old VS2008 .sln is also still included) including express versions.

See "Other Builds" for additional makefiles (may be out of date).

When using the cross-compiler (available on the author's homepage, very out of date), the build process generates .DLLs. You can use the command line 'LIB.EXE' tool to generate VC6 compatible .LIB files for linking purposes.

Mac OSX

The usual autotools build chain should be used. MacPorts or fink may be required (that's what the author uses).

Xcode is supported via templates. See "Other Builds" folder Xcode3+.zip - this template only supports SDL_gfx and not the tests. For this template, the Deployment Target (the lowest version to run on) is set to 10.5 and expects the SDL.framework preinstalled in some default location (either /Library/Frameworks, or ~/Library/Frameworks).

Older targets are also reported to work (10.3+ native and Project Builder).

QNX

QNX was reported to build (see .diff in "Other Builds").

Zune

ZuneHD (WinCE 6 ARM) is reported to build (see OpenZDK in "Other Builds"). Note that between rendering on the Zune's ARM CPU and constantly uploading textures to the GPU, SDL_gfx is going to be slow. Also, the libc math functions all use software FP emulation even when VFP floating point support is turned on in the compiler, so there's extra overhead due to that as well.

Others

Other platforms might work but have not been tested by the author. Please check the file "INSTALL" as well as the folder "Other Builds".

See also section "Installation" below for more build instructions.

Installation

Unix/Linux

To compile the library your need the SDL 1.2 installed from source or installed with the 'devel' RPM package. For example on Mandriva, run:

        urpmi  libSDL1.2-devel

Then run

        ./autogen.sh    # (optional, recommended)
        ./configure
        make
        make install
        ldconfig

to compile and install the library. The default location for the installation is /usr/local/lib and /usr/local/include. The libary path might need to be added to the file: /etc/ld.so.conf

Run the shell script 'nodebug.sh' before make, to patch the makefile for optimized compilation:

        ./autogen.sh    # (optional, recommended)
        ./configure
        ./nodebug.sh
        make
        make install
        ldconfig

Check the folder "Other Builds" for alternative makefiles.

Build Prep

Run autogen.sh or manually:

        aclocal --force
        libtoolize --force --copy
        autoreconf -fvi

No-MMX

To build without MMX code enabled (i.e. PPC or for AMD64 architecture which is missing pusha/popa):

        ./configure --disable-mmx
        make
        make install

i.e. to build on MacOSX 10.3+ use:

        ./configure --disable-mmx && make

Windows (VC9, VS2010)

Open SDL_gfx_VS2010.sln solution file and review README.

Windows (VC8, VS2008)

Open SDL_gfx_VS2008.sln solution file and review README.

Windows (VC6/7)

See folder Other Builds.

To create a Windows DLL using VisualC6:

        unzip -a VisualC6.zip
        vcvars32.bat
        copy VisualC/makefile
        nmake

or

        unzip -a VisualC7.zip

and open the project file.

WindowsCE

See folder Other Builds.

May need workaround for missing lrint.

Cross-Compilation

To build using mingw32 on Win32, check the makefile contained in mingw.zip

To create a Windows DLL using the xmingw32 cross-compiler:

        cross-configure
        cross-make
        cross-make install

Make sure the -DBUILD_DLL is used (and only then) when creating the DLLs. Make sure -DWIN32 is used when compiling the sources (creating or using the DLLs.

Specify the path to your cross-compiled 'sdl-config', and invoke './configure' with the '--host' and '--build' arguments. For example, to cross-compile a .DLL from GNU/Linux:

        SDL_CONFIG=/usr/local/cross-tools/i386-mingw32msvc/bin/sdl-config \
                ./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu
        make
        make install

QNX

To build on QNX6, patch first using:

        patch -p0 <QNX.diff

OSX

Use standard unix build sequence.

To build on MacOS X with Project Builder, follow these steps:

  • Update your developer tools to the lastest version.
  • Install the SDL Developers framework for Mac OS X.
  • Download the latest SDL_gfx source distribution and extract the archive in a convenient location.
  • Extract the included OSX-PB.tgz archive into the top directory of the SDL_gfx distribution (from step 3). This will create a PB that contains the project files.
  • The project has targets for the SDL_gfx framework and the four test programs. All can be built using the 'deployment' or 'development' build styles.

A newer version for MaxOS X is included in the OSX-PB-XCode.zip archive. The updated version uses relative pathnames where appropriate, and pointers to the standard installation location of SDL. However, it may require XCode in order to be used.

Language Interfaces

SDL_gfx has been integrated with the following language interfaces:

Test Programs

Change to the ./Test directory and run

        ./autogen.sh
        ./configure
        make

to create several test programs for the libraries functions. This requires the library to be previously compiled and installed.

See the source code .c files for some sample code and implementation hints.

Contributors

  • Fix for filledbox by Ingo van Lil, inguin at gmx.de - thanks Ingo.
  • Non-alpha line drawing code adapted from routine by Pete Shinners, pete at shinners.org - thanks Pete.
  • More fixes by Karl Bartel, karlb at gmx.net - thanks Karl.
  • Much testing and suggestions for fixes from Danny van Bruggen, danny at froukepc.dhs.org - thanks Danny.
  • Original AA-circle/-ellipse code idea from Stephane Magnenat, nct at wg0.ysagoon.com - thanks Stephane.
  • Faster blending routines contributed by Anders Lindstroem, cal at swipnet.se - thanks Anders.
  • New AA-circle/-ellipse code based on ideas from Anders Lindstroem - thanks Anders.
  • VisualC makefile contributed by Danny van Bruggen, danny at froukepc.dhs.org - thanks Danny.
  • VisualC7 project file contributed by James Turk, jturk at conceptofzero.com - thanks James.
  • Project Builder package contributed by Thomas Tongue, TTongue at imagiware.com - Thanks Thomas.
  • Fix for filledPolygon contributed by Kentaro Fukuchi fukuchi at is.titech.ac.jp - Thanks Kentaro.
  • QNX6 patch contributed by Mike Gorchak, mike at malva.ua - Thanks Mike.
  • Pie idea contributed by Eike Lange, eike.lange at uni-essen.de - Thanks Eike.
  • Dynamic font setup by Todor Prokopov, koprok at dir.bg - Thanks Todor.
  • Horizontal/Vertical flipping code by Victor (Haypo) Stinner, victor.stinner at haypocalc.com - Thanks Victor.
  • OSX build fixes by Michael Wybrow, mjwybrow at cs.mu.oz.au - Thanks Michael.
  • gcc3.4 build fixes by Dries Verachtert, dries at ulyssis.org - Thanks Dries.
  • Updated OSX build by Brian Rice, water451 at gmail.com - Thanks Brian.
  • aaellipse issues pointed out by Marco Wertz, marco.wertz at gmx.de - Thanks Marco.
  • texturedPolygon idea and code by Kees Jongenburger, kees.jongenburger at gmail.com - Thanks Kees.
  • Several bugfixes contributed by Sigborn Skjaeret, cisc at broadpark.no - Thanks CISC.
  • Syntax error for C++ found by Olivier Boudeville, olivier.boudeville at online.fr - Thanks Olivier.
  • hline/vline clipping fixes found by Daniel Roggen, droggen at gmail.com and Mikael Thieme, mikael.thieme at his.se - Thanks Daniel+Mikael.
  • rotozoom fix for big-endian machines (i.e. PPC) by Julian Mayer, julianmayer at mac.com - Thanks Julian.
  • Cross-compilation notes contributed by Sylvain Beucler, beuc at beuc.net - Thanks Sylvain.
  • Fix duplicate pixel renders in circleColor contributed by David Raber, lotharstar at gmail.com - Thanks David.
  • New arcColor (and arcRGBA) routine contributed by David Raber, lotharstar at gmail.com - Thanks David.
  • Idea for polygonColorMT and texturePolygonMT routines for multithreaded operation contributed by "unknown" - Thank you.
  • Multiple patches applied and repackaged version 2.0.18 by Paul, sweetlilmre at gmail.com - Thanks Paul and other contributors of patches.
  • Change to avoid gcc4 compiler warnings contributed by Thien-Thi nguyen, ttn at gnuvola.org - thanks Thi.
  • hline 1bpp off-by-one patch contributed by Manuel Lausch mail at manuellausch.de - Thanks Manuel.
  • pkg-config support contributed by Luca Bigliardi, shammash at artha.org - thanks Luca.
  • Updated mingw Makefile contributed by Jan Leike, jan dot leike at gmx dot net - thanks Jan.
  • Rotozoom debugging help by Jeff Wilges, heff at ifup dot us - thanks Jeff.
  • Build updates provided by Barry deFreese, bdefreese at debian dot org - thanks Barry.
  • Fix for 1-pixel postponement with 8bit scaling by Sylvain Beucler, beuc at beuc dot net - thanks Sylvain.
  • Updates to headers and configure to allow for cross-compiling to DLL (not just static .a) and fixes for compiling on Windows using autotools by Sylvain Beucler, beuc at beuc dot net - thanks Sylvain.
  • Added Visual CE Project to Builds. Contributed by vrichomme at smartmobili dot com - thanks.
  • Added Symbian and Windows 64bit fix with lrint function by Rene Dudfield, renesd at gmail dot com - thanks Rene.
  • Fixes for Rotate90 0-degree case by Chris Allport, chris dot allport at gmail dot com - thanks Chris.
  • Fixed for Win32 build support defines by tigerfishdaisy (SF) - thanks Tiger Tiger.
  • Patch for OpenSDK contributed by itsnotabigtruck at ovi dot com - thanks IsNotABigTruck.
  • OSX Xcode 3+ template ZIP contributed by marabus at meta dot ua - thanks Vasyl.
  • Memory leak/error check patch for zoomSurface contributed by RodolfoRG - thanks Rodolfo.
  • Zoom scaling factor rounding bugfix patch contributed by WanderWander Lairson Costa - thanks Wander.
  • Suggestions for speed improvements contributed by inkyankes - thanks.
  • Pixel blend routine patches contributed by mitja at lxnav dot com - thanks Mitja.
  • ImageFilter patches contributed by beuc at beuc dot net - thanks Sylvain.
  • Bug reports contributed by Yannick dot Guesnet at univ-rouen dot fr -
  • thanks Yannick.

Change Log

CHANGES/VERSION
===============

Ver 2.0.25 - Sun, Oct 27, 2013  3:08:15 PM
* Added patch for 32- and 64-bit GCC-compiled MMX support
  (contributed by Sylvain Beucler, backported from SDL2_gfx)
* Fixed bug in _aaline when x1>x2 and dy==0 (found by Yannick 
  Guesnet - thanks!)
* Updated documentation.
* Fixed header in SDL_gfxBlitFunc.h (reported by Jaders77 on
  sourceforge - thanks!)

Ver 2.0.24 - Sun, Jul 22, 2012  9:27:29 AM
* Removed some missed LGPL references
* Fixed thick line swap bug (patch contributed by Thien-Thi)
  and added accuracy test for thick line
* Improved interface to SDL_framerateDelay (idea contributed by
  Neil)
* Fixed dramerate modules dependency on SDL_GetTicks returning a 
  value >0 (issue report contributed by Douglas)
* Fixed 32bpp blending function for BGRA (thanks for the test code
  and contributing a fix sabbetts/Jay)
* Updated VS2010 solution file to use SDL-1.2 sources
* Fix for pixel blend routine (patch contributes by Mitjia)

Ver 2.0.23 - Sat Dec  3 22:55:04 PST 2011
* Updated sources to resolve some splint (static code analysis)
  issues
* Updates for OpenSDK (WinCE6/ARM) build target (patch contributed
  itsnotabigtruck)
* Added OSX Xcode3+ template files to Other Builds collection
  (contributed by Vasyl)
* Added various fixes and improvements contributed by folks on 
  sourceforge (thanks contributors).
* Switched library and test code to zlib license.

Ver 2.0.22 - Sat Sep 11 23:26:42 EDT 2010
* Fixed line width calculation for normal and textured polygons
  (patch contributed by Daniel (SupSuper) 
* Fixed version setup in configure.in
* Added rounded rectangle and rounded box primitives
* Updated test program for roundedbox + left/right-click support
* Fixed pie calculation (line-case detection, end-angle clipping)
* Updated DLL_EXPORT handling and added WIN64 test 
  (patch contributed by tigerfishdaisy)
* Added thick line primitive based on Murphy's algorithm

Ver 2.0.21 - Thu May 27 21:14:37 PDT 2010
* Add VC9 project files, source code formatting, fix compiler 
  warnings, move VC8 project files, remove leftover autoconf/m4 files
* Move static transfer lookup array from .h to .c 
  (patch contributed by Zbigniew Holdys)
* Add support for VC++ compiler/MASM assembly with active USE_MMX 
  (contributed by Markus Hossner)
* Added Haiku build support in configure.in 
  (contributed by Scott McCreary)
* Added helper function that multiplies the alpha channel in
  a 32bit surface (contributed by Zbigniew Holdys)
* Disable MMX for 64bit platforms due to lack of support for
  pusha/popa (contributed by Olivier Boudeville)
* Update all library functions for doxygen markup. Add doxygen
  configuration file.
* Added font rotation support and updated TestFonts sample
* Fixed rotate90 for 0 degree case
  (contributed by Chris Allport)
* Updated TestRotozoom with rotate90 case and message display
* Added support for SDL 1.3
* Added doxygen generated documentation.

Ver 2.0.20 - Wed Sep 23 18:42:02 PDT 2009
* Fix for 1-pixel postponement with 8bit scaling 
* Updates to headers and configure to allow for cross-compiling 
  to DLL (not just static .a) and fixes for compiling on Windows 
  using autotools
* Added Visual CE Project to Other Builds
* Added Symbian and Windows 64bit fix for lrint function.

Ver 2.0.19 - Mon Apr 20 22:56:59 PDT 2009

* gcc43 compiler patch for asm code in image filters 
  as per http://bugs.gentoo.org/219621 (Peter Alfredsen)
* off-by-one hline patch for 1byte indexed surfaces (Manuel Lausch)
* update acinclude.m4 from SDL-1.2 and moved # serial in file
* applied patch to add pkg-config support for SDL_gfx (Luca Bigliardi)
* changed configure.in INTERFACE_AGE and BINARY_AGE based on Debian
  build feedback (Barry deFreese)
* fixed zoom XY-flip code and made it available for all modes in
  zoom and rotations
* fixed edge issue on interpolated rotozoom modes
* updated TestRotozoom custom test mode, added delay parameter, added
  tests which include flipping, included negative rotation
* update libtool files
* updated Makefile.mingw (Jan Leike)

Ver 2.0.18 - Sun Dec 21 08:38:20 PST 2008

* libtool update for dependencies
* MSVC C89 variable hoisting to enable MSVC compile (sweetlilmre)
* addition of VC9 (Visual Studio 2008) project file (sweetlilmre)
* update to MinGW make file (Sergio Padrino, sweetlilmre)
* fix uninitialised variables in _putPixelAlpha() (Paul Pedriana)
* reverted to original alpha routine in _putPixelAlpha() as new one was causing issues in 16bbp
  new routine #define has been renamed to EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
  original is now DEFAULT_ALPHA_PIXEL_ROUTINE
* added colorkey handling patch to rotozoom (Sergio Padrino)
* downgraded optimization to -O for asm compatibility with gcc4


Ver 2.0.17 - Sun Jun  1 15:39:38 EDT 2008

* hline/vline clipping and swap-logic fixed
* clipping box dimension check added and clipping-checks optimized
* TestFonts program updated
* Updated documentation on cross-compilation, AMD64
* Fixed circleColor overdraw
* Added arcColor routine
* Added polygonColorMT and polygonTextureMT routines
* Updated 32bit alpha blending routine


Ver 2.0.16 - Mon Feb  5 19:03:31 AST 2007
* updated config.sub to newer version 
* added custom RGBA blitter function that sets/maintains target alpha
* added setAlpha function that sets alpha values in 32bit surfaces
* added TextGfxBlit testprogram for new functions
* Fixed C++ type in .h files (thanks Olivier)
* Update some text in README and .spec file
* Removed broken Uint filter routines from test program
* "Cosmetic" changes to test programs and Automake.am


Ver 2.0.15 - Fri Dec 22 08:44:31 AST 2006
* bugfixes in 32bit _putPixelAlpha/filledRectAlpha (thanks CISC)
* various bugfixes in return value generation and return (thanks CISC)
* lock font-surface before using it (thanks CISC)
* fix some breakage in non-MMX filter routines (thanks CISC)
* fix typo in TestABGR (thanks CISC)
* fix double buffer flipping in Tets programs (thanks CISC)
* fixed microversion in .h
* fixed texturePolygon inverted bug
* fixed wrong surface use in test 21 of TestRotozoom
* added pitch handling in font surface (thanks CISC)


Ver 2.0.14 - Tue Dec 19 08:49:02 AST 2006
* added texturedPolygon routine to library (thanks Jees)
* changed iterator condition in aaellipse to add some overdraw to smooth circle
* added ShrinkImage routine to rotozoom code
* added TestABGR Test program (bug in SDL_gfx or SDL??)
* improved TestImageFilter program (bug in Uint filters) 
* changed .so versioning from .so.13.0.0 to .so.0.0.14
  (best is to remove all old libs before installing)
* added updated MacOSX ProjectBuilder file (thanks Brian)
* added info on MacOSX 10.3 build
* added mingw (on cygwin) makefile (thanks Brian)
* added Dev-Cpp makefile (thanks Sebastian)
* removed some unused variables from gfx and rotozoom code (thanks Thi)
* fixed a non-critical typecast mistake (thanks Thi)
* converted all C++ comments to C comments in SDL_imageFilter


Ver 2.0.13 - Tue Dec 21 08:41:25 EST 2004
* changed include back to "SDL.h"
* compile fixes for OSX fink  (thanks (Michael)
* compile fixes for gcc3.4 (thanks Dries)
* support vertical and horizontal flipping of axis in new 
  rotozoomSurfaceXY function (thanks Victor)
* updated TestRotozoom program 


Ver 2.0.12 - Mon Aug 30 09:04:11 EDT 2004
* piecolor naming fix
* primitive API change to 'filledPie'
* introduction of some const variables


Ver 2.0.11 - Thu May 13 09:42:34 EDT 2004
* added pieRGBA/pieColor primitive (non filled pie)
* added QNX6 build patch
* use $(includedir)/SDL to automake setup
* updated README
* added 2x2 box & pie tests
* added dynamic font setup routine
* added sample font files to the Fonts directory
* added font test program
* string routines changed to use const char
* fixed TestRotozoom clear color bug


Ver 2.0.10 - Thu Dec 11 09:40:08 EST 2003
* Updated "missing" script to newer version to avoid build errors
* Fixed filled polygon int32 overflow error in calculation
* Updated RPM spec file for new website path
* Added micro version number to .h file


Ver 2.0.9 - Mon Oct 27 10:03:18 EST 2003
* Fixed "filled-box width too small by 1 bug" for A=255
* Wrong versioning in .h file


Ver 2.0.8 - Wed Jul 16 16:18:13 EDT 2003
* Modified filledPolygon drawing
  (The edges of a filled polygon and a polyline were 
   reported to not intersect correctly. With this fix, the
   edges do still do not intersect 100% due to the difference
   in the algorithms. But now a polygon will never draw 
   outside of the area enclosed by a polyline.)

Ver 2.0.7 - Sun Jun  8 08:17:38 EDT 2003
* Added MacOS X Project Builder code
* changed SDL include to <SDL/SDL.h>
* Added bezier curve


Ver 2.0.6 - Sat May 25 15:12:17 EDT 2002
* Fixed clipping code for most primitives
* Added clipping code for character
* Added VC7 project file


Ver 2.0.5 - n/a
* Removed some unused code


Ver 2.0.4 - Sat Feb  9 22:09:45 EST 2002
* Fixed rectangle drawing bug on edges for A<255
* Added trigons (triangles) as wrapper calls to polygon.


Ver 2.0.3 - Sat Jan 26 10:06:16 EST 2002

* Zipped VisualC directory to avoid EOL problems.
* Fixed aalineColor call (y2 parameter was y1).
* Fixed rotozoom bug that caused black or undefined pixels on edges.


Ver 2.0.2 - Sat Jan 19 21:41:28 EST 2002
* Removed dependency from GL libraries during compile.
* Added VisualC makefile.


Ver 2.0.1 - Sat Jan  5 22:08:17 EST 2002

* New better quality aacircle/aaellipse code
* Better locking optimization for a 4-8% speed improvement on some
  primitives (line, aaline, circle, ellipse)


Ver 2.0 - Sat Dec 29 16:27:57 EST 2001

* Initial release of SDL_gfx based on SDL_gfxPrimitives and SDL_rotozoom
  code.
* Added framerate code and testprogram.
* Added imageFilters code and testprogram.
* New distribution: source code, README, configure system etc.


Previous versions
=================

SDL_gfxPrimitives:
------------------

Ver 1.5 - Mon Jul  2 11:27:40 EDT 2001

* New alpha blending code for factor 4 speedups if a<255 on all functions.
* Modified include file for W32 DLL support.
* Added VC6 project files for DLL and static library building.
* Added simple AA-circle/-ellipse routine - quality needs improvement.
* Removed 32bit shift on 64bit number from aaline for better portability
  across platforms.
* Removed a couple more compiler warnings (i.e. purely cosmetic fix).

Ver 1.4 - Sun Jun  3 11:52:07 EDT 2001

* Fixed hline, vline and rectangle clipping and result codes.
* Fixed AA-line arithmetic (was alpha subtraction, should be alpha ratio).
* More caching on fonts for speedups.
* More pointer checks in several places.
* New special cases for ellipses for rx=0/ry=0.
* Same sanity checks for circles/ellipses.
* Same return code for polygon/filledpolygon.

Ver 1.3 - Thu May 31 12:41:35 EDT 2001

* Minor cleanups and fixes (gcc -Wall is your friend).

Ver 1.2 again - Thu Apr  5 07:50:57 EDT 2001

* Fixed lineRGBA and aalineRGBA calls (had coordinate-passing mixed up twice,
  thanks Lion for pointing this out)

Ver 1.2 - Wed Apr  4 08:32:42 EDT 2001

* Changed to a dual, you-have-the-choice(TM) licencing system 
  to accomodate GPL developments using SDL_gfxPrimitives.
* Some minor fixes (thanks Karl).
* All routines return proper result code now.
* Clipping for aaline, circle and ellipse.

Ver 1.1 - Thu Mar 22 15:28:27 EST 2001

* Added code for Alpha=255 pixel drawing through direct memory writes to all routines
resulting in a much faster performance (factor 5 to 20) for non transparent pixels.
* New test and benchmark program with better info and nicer look.
* More info in README. Proper licence file. Comment cleanup.

Ver 1.0 - Fri Mar 16 08:38:07 EST 2001

* Initial release


SDL_rotozoom:
-------------

Ver 1.6 - Mon Nov 19 21:19:26 EST 2001
* Added interpolation to alpha channel (simplifies code)
* Ran the sourcecode through 'indent' for better readability

Ver 1.5 - Sat Jul  7 13:02:07 EDT 2001
* Added project files (VisualC.zip) and modifications for VC project building.
* Fixed old versioning in configure.in file.
* Fixed LICENSE file and LGPL source reference.

Ver 1.4 - Mon Jun  4 12:15:31 EDT 2001
* Removed SDL_SoftStretch call again in favour of an internal zoom routine.
* Added new zoomSurface() function with seperate X and Y zoom factors.

Ver 1.3 - Thu May 31 08:37:36 EDT 2001
* Modified code to handle RGBA or ABGR source surfaces transparently.
* More error checking, source surface locking.
* Slighly expanded test program with event handling.

Ver 1.2 - Wed May 30 18:18:05 EDT 2001
* Fixed the completely broken 32bit routine's pointer arithmetic.
* Uses SDL_SoftStretch in certain cases (angle=0, smooth=0).
* Convert source surface on the fly if not 8/32bit.
* Added license file - was empty before (duh).

Ver 1.1 - Wed May 23 15:04:42 EDT 2001
* Added automake/autoconf scripts and testprogram.

Ver 1.0 - Fri Mar 16 08:16:06 EST 2001
* Initial release

sdlgfx-2.0.25/Docs/html/jquery.js000077500000000000000000002506121225506657100166220ustar00rootroot00000000000000/* * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); /* * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) {I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() {G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); /* * jQuery hashchange event - v1.3 - 7/21/2010 * http://benalman.com/projects/jquery-hashchange-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('