home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / XfeWidgets / XfeTest / TestAnim.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  15.8 KB  |  424 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /*-----------------------------------------*/
  19. /*                                                                        */
  20. /* Name:        <XfeTest/TestAnim.c>                                    */
  21. /* Description:    Xfe widget animation tests stuff.                        */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26. #include <Xfe/XfeTest.h>
  27.  
  28. /*----------------------------------------------------------------------*/
  29. /*                                                                        */
  30. /* Main Animation 20x20                                                    */
  31. /*                                                                        */
  32. /*----------------------------------------------------------------------*/
  33. #include <animations/main/20x20/MainSmall00.xpm>
  34. #include <animations/main/20x20/MainSmall01.xpm>
  35. #include <animations/main/20x20/MainSmall02.xpm>
  36. #include <animations/main/20x20/MainSmall03.xpm>
  37. #include <animations/main/20x20/MainSmall04.xpm>
  38. #include <animations/main/20x20/MainSmall05.xpm>
  39. #include <animations/main/20x20/MainSmall06.xpm>
  40. #include <animations/main/20x20/MainSmall07.xpm>
  41. #include <animations/main/20x20/MainSmall08.xpm>
  42. #include <animations/main/20x20/MainSmall09.xpm>
  43. #include <animations/main/20x20/MainSmall10.xpm>
  44. #include <animations/main/20x20/MainSmall11.xpm>
  45. #include <animations/main/20x20/MainSmall12.xpm>
  46. #include <animations/main/20x20/MainSmall13.xpm>
  47. #include <animations/main/20x20/MainSmall14.xpm>
  48. #include <animations/main/20x20/MainSmall15.xpm>
  49. #include <animations/main/20x20/MainSmall16.xpm>
  50. #include <animations/main/20x20/MainSmall17.xpm>
  51. #include <animations/main/20x20/MainSmall18.xpm>
  52. #include <animations/main/20x20/MainSmall19.xpm>
  53. #include <animations/main/20x20/MainSmall20.xpm>
  54. #include <animations/main/20x20/MainSmall21.xpm>
  55. #include <animations/main/20x20/MainSmall22.xpm>
  56. #include <animations/main/20x20/MainSmall23.xpm>
  57. #include <animations/main/20x20/MainSmall24.xpm>
  58. #include <animations/main/20x20/MainSmall25.xpm>
  59. #include <animations/main/20x20/MainSmall26.xpm>
  60. #include <animations/main/20x20/MainSmall27.xpm>
  61. #include <animations/main/20x20/MainSmall28.xpm>
  62. #include <animations/main/20x20/MainSmall29.xpm>
  63. #include <animations/main/20x20/MainSmall30.xpm>
  64. #include <animations/main/20x20/MainSmall31.xpm>
  65. #include <animations/main/20x20/MainSmall32.xpm>
  66. #include <animations/main/20x20/MainSmall33.xpm>
  67. #include <animations/main/20x20/MainSmall34.xpm>
  68.  
  69. static char ** anim_main_20x20[] =
  70. {
  71.     anim_MainSmall00_xpm,
  72.     anim_MainSmall01_xpm,
  73.     anim_MainSmall02_xpm,
  74.     anim_MainSmall03_xpm,
  75.     anim_MainSmall04_xpm,
  76.     anim_MainSmall05_xpm,
  77.     anim_MainSmall06_xpm,
  78.     anim_MainSmall07_xpm,
  79.     anim_MainSmall08_xpm,
  80.     anim_MainSmall09_xpm,
  81.     anim_MainSmall10_xpm,
  82.     anim_MainSmall11_xpm,
  83.     anim_MainSmall12_xpm,
  84.     anim_MainSmall13_xpm,
  85.     anim_MainSmall14_xpm,
  86.     anim_MainSmall15_xpm,
  87.     anim_MainSmall16_xpm,
  88.     anim_MainSmall17_xpm,
  89.     anim_MainSmall18_xpm,
  90.     anim_MainSmall19_xpm,
  91.     anim_MainSmall20_xpm,
  92.     anim_MainSmall21_xpm,
  93.     anim_MainSmall22_xpm,
  94.     anim_MainSmall23_xpm,
  95.     anim_MainSmall24_xpm,
  96.     anim_MainSmall25_xpm,
  97.     anim_MainSmall26_xpm,
  98.     anim_MainSmall27_xpm,
  99.     anim_MainSmall28_xpm,
  100.     anim_MainSmall29_xpm,
  101.     anim_MainSmall30_xpm,
  102.     anim_MainSmall31_xpm,
  103.     anim_MainSmall32_xpm,
  104.     anim_MainSmall33_xpm,
  105.     anim_MainSmall34_xpm,
  106.     NULL
  107. };
  108.  
  109. /*----------------------------------------------------------------------*/
  110. /*                                                                        */
  111. /* Main Animation 40x40                                                    */
  112. /*                                                                        */
  113. /*----------------------------------------------------------------------*/
  114. #include <animations/main/40x40/MainLarge00.xpm>
  115. #include <animations/main/40x40/MainLarge01.xpm>
  116. #include <animations/main/40x40/MainLarge02.xpm>
  117. #include <animations/main/40x40/MainLarge03.xpm>
  118. #include <animations/main/40x40/MainLarge04.xpm>
  119. #include <animations/main/40x40/MainLarge05.xpm>
  120. #include <animations/main/40x40/MainLarge06.xpm>
  121. #include <animations/main/40x40/MainLarge07.xpm>
  122. #include <animations/main/40x40/MainLarge08.xpm>
  123. #include <animations/main/40x40/MainLarge09.xpm>
  124. #include <animations/main/40x40/MainLarge10.xpm>
  125. #include <animations/main/40x40/MainLarge11.xpm>
  126. #include <animations/main/40x40/MainLarge12.xpm>
  127. #include <animations/main/40x40/MainLarge13.xpm>
  128. #include <animations/main/40x40/MainLarge14.xpm>
  129. #include <animations/main/40x40/MainLarge15.xpm>
  130. #include <animations/main/40x40/MainLarge16.xpm>
  131. #include <animations/main/40x40/MainLarge17.xpm>
  132. #include <animations/main/40x40/MainLarge18.xpm>
  133. #include <animations/main/40x40/MainLarge19.xpm>
  134. #include <animations/main/40x40/MainLarge20.xpm>
  135. #include <animations/main/40x40/MainLarge21.xpm>
  136. #include <animations/main/40x40/MainLarge22.xpm>
  137. #include <animations/main/40x40/MainLarge23.xpm>
  138. #include <animations/main/40x40/MainLarge24.xpm>
  139. #include <animations/main/40x40/MainLarge25.xpm>
  140. #include <animations/main/40x40/MainLarge26.xpm>
  141. #include <animations/main/40x40/MainLarge27.xpm>
  142. #include <animations/main/40x40/MainLarge28.xpm>
  143. #include <animations/main/40x40/MainLarge29.xpm>
  144. #include <animations/main/40x40/MainLarge30.xpm>
  145. #include <animations/main/40x40/MainLarge31.xpm>
  146. #include <animations/main/40x40/MainLarge32.xpm>
  147. #include <animations/main/40x40/MainLarge33.xpm>
  148. #include <animations/main/40x40/MainLarge34.xpm>
  149.  
  150. static char ** anim_main_40x40[] =
  151. {
  152.     anim_MainLarge00_xpm,
  153.     anim_MainLarge01_xpm,
  154.     anim_MainLarge02_xpm,
  155.     anim_MainLarge03_xpm,
  156.     anim_MainLarge04_xpm,
  157.     anim_MainLarge05_xpm,
  158.     anim_MainLarge06_xpm,
  159.     anim_MainLarge07_xpm,
  160.     anim_MainLarge08_xpm,
  161.     anim_MainLarge09_xpm,
  162.     anim_MainLarge10_xpm,
  163.     anim_MainLarge11_xpm,
  164.     anim_MainLarge12_xpm,
  165.     anim_MainLarge13_xpm,
  166.     anim_MainLarge14_xpm,
  167.     anim_MainLarge15_xpm,
  168.     anim_MainLarge16_xpm,
  169.     anim_MainLarge17_xpm,
  170.     anim_MainLarge18_xpm,
  171.     anim_MainLarge19_xpm,
  172.     anim_MainLarge20_xpm,
  173.     anim_MainLarge21_xpm,
  174.     anim_MainLarge22_xpm,
  175.     anim_MainLarge23_xpm,
  176.     anim_MainLarge24_xpm,
  177.     anim_MainLarge25_xpm,
  178.     anim_MainLarge26_xpm,
  179.     anim_MainLarge27_xpm,
  180.     anim_MainLarge28_xpm,
  181.     anim_MainLarge29_xpm,
  182.     anim_MainLarge30_xpm,
  183.     anim_MainLarge31_xpm,
  184.     anim_MainLarge32_xpm,
  185.     anim_MainLarge33_xpm,
  186.     anim_MainLarge34_xpm,
  187.     NULL
  188. };
  189.  
  190. /*----------------------------------------------------------------------*/
  191. /*                                                                        */
  192. /* Transparent Animation 20x20                                            */
  193. /*                                                                        */
  194. /*----------------------------------------------------------------------*/
  195. #include <animations/transparent/20x20/TransparentSmall00.xpm>
  196. #include <animations/transparent/20x20/TransparentSmall01.xpm>
  197. #include <animations/transparent/20x20/TransparentSmall02.xpm>
  198. #include <animations/transparent/20x20/TransparentSmall03.xpm>
  199. #include <animations/transparent/20x20/TransparentSmall04.xpm>
  200. #include <animations/transparent/20x20/TransparentSmall05.xpm>
  201. #include <animations/transparent/20x20/TransparentSmall06.xpm>
  202. #include <animations/transparent/20x20/TransparentSmall07.xpm>
  203. #include <animations/transparent/20x20/TransparentSmall08.xpm>
  204. #include <animations/transparent/20x20/TransparentSmall09.xpm>
  205. #include <animations/transparent/20x20/TransparentSmall10.xpm>
  206. #include <animations/transparent/20x20/TransparentSmall11.xpm>
  207. #include <animations/transparent/20x20/TransparentSmall12.xpm>
  208. #include <animations/transparent/20x20/TransparentSmall13.xpm>
  209. #include <animations/transparent/20x20/TransparentSmall14.xpm>
  210. #include <animations/transparent/20x20/TransparentSmall15.xpm>
  211. #include <animations/transparent/20x20/TransparentSmall16.xpm>
  212. #include <animations/transparent/20x20/TransparentSmall17.xpm>
  213. #include <animations/transparent/20x20/TransparentSmall18.xpm>
  214. #include <animations/transparent/20x20/TransparentSmall19.xpm>
  215. #include <animations/transparent/20x20/TransparentSmall20.xpm>
  216. #include <animations/transparent/20x20/TransparentSmall21.xpm>
  217. #include <animations/transparent/20x20/TransparentSmall22.xpm>
  218. #include <animations/transparent/20x20/TransparentSmall23.xpm>
  219. #include <animations/transparent/20x20/TransparentSmall24.xpm>
  220. #include <animations/transparent/20x20/TransparentSmall25.xpm>
  221. #include <animations/transparent/20x20/TransparentSmall26.xpm>
  222. #include <animations/transparent/20x20/TransparentSmall27.xpm>
  223. #include <animations/transparent/20x20/TransparentSmall28.xpm>
  224. #include <animations/transparent/20x20/TransparentSmall29.xpm>
  225. #include <animations/transparent/20x20/TransparentSmall30.xpm>
  226. #include <animations/transparent/20x20/TransparentSmall31.xpm>
  227. #include <animations/transparent/20x20/TransparentSmall32.xpm>
  228. #include <animations/transparent/20x20/TransparentSmall33.xpm>
  229. #include <animations/transparent/20x20/TransparentSmall34.xpm>
  230.  
  231. static char ** anim_transparent_20x20[] =
  232. {
  233.     anim_TransparentSmall00_xpm,
  234.     anim_TransparentSmall01_xpm,
  235.     anim_TransparentSmall02_xpm,
  236.     anim_TransparentSmall03_xpm,
  237.     anim_TransparentSmall04_xpm,
  238.     anim_TransparentSmall05_xpm,
  239.     anim_TransparentSmall06_xpm,
  240.     anim_TransparentSmall07_xpm,
  241.     anim_TransparentSmall08_xpm,
  242.     anim_TransparentSmall09_xpm,
  243.     anim_TransparentSmall10_xpm,
  244.     anim_TransparentSmall11_xpm,
  245.     anim_TransparentSmall12_xpm,
  246.     anim_TransparentSmall13_xpm,
  247.     anim_TransparentSmall14_xpm,
  248.     anim_TransparentSmall15_xpm,
  249.     anim_TransparentSmall16_xpm,
  250.     anim_TransparentSmall17_xpm,
  251.     anim_TransparentSmall18_xpm,
  252.     anim_TransparentSmall19_xpm,
  253.     anim_TransparentSmall20_xpm,
  254.     anim_TransparentSmall21_xpm,
  255.     anim_TransparentSmall22_xpm,
  256.     anim_TransparentSmall23_xpm,
  257.     anim_TransparentSmall24_xpm,
  258.     anim_TransparentSmall25_xpm,
  259.     anim_TransparentSmall26_xpm,
  260.     anim_TransparentSmall27_xpm,
  261.     anim_TransparentSmall28_xpm,
  262.     anim_TransparentSmall29_xpm,
  263.     anim_TransparentSmall30_xpm,
  264.     anim_TransparentSmall31_xpm,
  265.     anim_TransparentSmall32_xpm,
  266.     anim_TransparentSmall33_xpm,
  267.     anim_TransparentSmall34_xpm,
  268.     NULL
  269. };
  270.  
  271. /*----------------------------------------------------------------------*/
  272. /*                                                                        */
  273. /* Transparent Animation 40x40                                            */
  274. /*                                                                        */
  275. /*----------------------------------------------------------------------*/
  276. #include <animations/transparent/40x40/TransparentLarge00.xpm>
  277. #include <animations/transparent/40x40/TransparentLarge01.xpm>
  278. #include <animations/transparent/40x40/TransparentLarge02.xpm>
  279. #include <animations/transparent/40x40/TransparentLarge03.xpm>
  280. #include <animations/transparent/40x40/TransparentLarge04.xpm>
  281. #include <animations/transparent/40x40/TransparentLarge05.xpm>
  282. #include <animations/transparent/40x40/TransparentLarge06.xpm>
  283. #include <animations/transparent/40x40/TransparentLarge07.xpm>
  284. #include <animations/transparent/40x40/TransparentLarge08.xpm>
  285. #include <animations/transparent/40x40/TransparentLarge09.xpm>
  286. #include <animations/transparent/40x40/TransparentLarge10.xpm>
  287. #include <animations/transparent/40x40/TransparentLarge11.xpm>
  288. #include <animations/transparent/40x40/TransparentLarge12.xpm>
  289. #include <animations/transparent/40x40/TransparentLarge13.xpm>
  290. #include <animations/transparent/40x40/TransparentLarge14.xpm>
  291. #include <animations/transparent/40x40/TransparentLarge15.xpm>
  292. #include <animations/transparent/40x40/TransparentLarge16.xpm>
  293. #include <animations/transparent/40x40/TransparentLarge17.xpm>
  294. #include <animations/transparent/40x40/TransparentLarge18.xpm>
  295. #include <animations/transparent/40x40/TransparentLarge19.xpm>
  296. #include <animations/transparent/40x40/TransparentLarge20.xpm>
  297. #include <animations/transparent/40x40/TransparentLarge21.xpm>
  298. #include <animations/transparent/40x40/TransparentLarge22.xpm>
  299. #include <animations/transparent/40x40/TransparentLarge23.xpm>
  300. #include <animations/transparent/40x40/TransparentLarge24.xpm>
  301. #include <animations/transparent/40x40/TransparentLarge25.xpm>
  302. #include <animations/transparent/40x40/TransparentLarge26.xpm>
  303. #include <animations/transparent/40x40/TransparentLarge27.xpm>
  304. #include <animations/transparent/40x40/TransparentLarge28.xpm>
  305. #include <animations/transparent/40x40/TransparentLarge29.xpm>
  306. #include <animations/transparent/40x40/TransparentLarge30.xpm>
  307. #include <animations/transparent/40x40/TransparentLarge31.xpm>
  308. #include <animations/transparent/40x40/TransparentLarge32.xpm>
  309. #include <animations/transparent/40x40/TransparentLarge33.xpm>
  310. #include <animations/transparent/40x40/TransparentLarge34.xpm>
  311.  
  312. static char ** anim_transparent_40x40[] =
  313. {
  314.     anim_TransparentLarge00_xpm,
  315.     anim_TransparentLarge01_xpm,
  316.     anim_TransparentLarge02_xpm,
  317.     anim_TransparentLarge03_xpm,
  318.     anim_TransparentLarge04_xpm,
  319.     anim_TransparentLarge05_xpm,
  320.     anim_TransparentLarge06_xpm,
  321.     anim_TransparentLarge07_xpm,
  322.     anim_TransparentLarge08_xpm,
  323.     anim_TransparentLarge09_xpm,
  324.     anim_TransparentLarge10_xpm,
  325.     anim_TransparentLarge11_xpm,
  326.     anim_TransparentLarge12_xpm,
  327.     anim_TransparentLarge13_xpm,
  328.     anim_TransparentLarge14_xpm,
  329.     anim_TransparentLarge15_xpm,
  330.     anim_TransparentLarge16_xpm,
  331.     anim_TransparentLarge17_xpm,
  332.     anim_TransparentLarge18_xpm,
  333.     anim_TransparentLarge19_xpm,
  334.     anim_TransparentLarge20_xpm,
  335.     anim_TransparentLarge21_xpm,
  336.     anim_TransparentLarge22_xpm,
  337.     anim_TransparentLarge23_xpm,
  338.     anim_TransparentLarge24_xpm,
  339.     anim_TransparentLarge25_xpm,
  340.     anim_TransparentLarge26_xpm,
  341.     anim_TransparentLarge27_xpm,
  342.     anim_TransparentLarge28_xpm,
  343.     anim_TransparentLarge29_xpm,
  344.     anim_TransparentLarge30_xpm,
  345.     anim_TransparentLarge31_xpm,
  346.     anim_TransparentLarge32_xpm,
  347.     anim_TransparentLarge33_xpm,
  348.     anim_TransparentLarge34_xpm,
  349.     NULL
  350. };
  351.  
  352.  
  353. /*----------------------------------------------------------------------*/
  354. void
  355. XfeAnimationCreate(Widget            w,
  356.                    char ***            animation_data,
  357.                    Pixmap **        pixmaps_out,
  358.                    Cardinal *        num_pixmaps_out)
  359. {
  360.     Pixmap *        pixmaps;
  361.     Cardinal        num_pixmaps;
  362.     Cardinal        i;
  363.  
  364.     assert( XfeIsAlive(w) );
  365.     assert( animation_data != NULL );
  366.     assert( pixmaps_out != NULL );
  367.     assert( *pixmaps_out == NULL );
  368.     assert( num_pixmaps_out != NULL );
  369.  
  370.     /* First count the number of entries in the pixmap data */
  371.     i = 0;
  372.  
  373.     while(animation_data[i] != NULL)
  374.     {
  375.         i++;
  376.     }
  377.  
  378.     num_pixmaps = i;
  379.  
  380.     /* Allocate space for the pixmaps */
  381.     pixmaps = (Pixmap *) XtMalloc(sizeof(Pixmap) * num_pixmaps);
  382.     
  383.     for (i = 0; i < num_pixmaps; i++)
  384.     {
  385.         pixmaps[i] = XfeGetPixmapFromData(w,animation_data[i]);
  386.     }
  387.  
  388.     *pixmaps_out        = pixmaps;
  389.     *num_pixmaps_out    = num_pixmaps;
  390. }
  391. /*----------------------------------------------------------------------*/
  392. void
  393. XfeGetMain20x20Animation(Widget        w,
  394.                          Pixmap **    pixmaps_out,
  395.                          Cardinal *    num_pixmaps_out)
  396. {
  397.     XfeAnimationCreate(w,anim_main_20x20,pixmaps_out,num_pixmaps_out);
  398. }
  399. /*----------------------------------------------------------------------*/
  400. void
  401. XfeGetMain40x40Animation(Widget        w,
  402.                          Pixmap **    pixmaps_out,
  403.                          Cardinal *    num_pixmaps_out)
  404. {
  405.     XfeAnimationCreate(w,anim_main_40x40,pixmaps_out,num_pixmaps_out);
  406. }
  407. /*----------------------------------------------------------------------*/
  408. void
  409. XfeGetTransparent20x20Animation(Widget        w,
  410.                                 Pixmap **    pixmaps_out,
  411.                                 Cardinal *    num_pixmaps_out)
  412. {
  413.     XfeAnimationCreate(w,anim_transparent_20x20,pixmaps_out,num_pixmaps_out);
  414. }
  415. /*----------------------------------------------------------------------*/
  416. void
  417. XfeGetTransparent40x40Animation(Widget        w,
  418.                                 Pixmap **    pixmaps_out,
  419.                                 Cardinal *    num_pixmaps_out)
  420. {
  421.     XfeAnimationCreate(w,anim_transparent_40x40,pixmaps_out,num_pixmaps_out);
  422. }
  423. /*----------------------------------------------------------------------*/
  424.