tests.inc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. Test:y_bitmap_Fade1()
  2. {
  3. new
  4. Bitmap:ctx;
  5. ctx = Bitmap_Create(256, 256);
  6. for (new y = 0; y != 256; ++y)
  7. {
  8. for (new x = 0; x != 256; ++x)
  9. {
  10. Bitmap_WritePixel(ctx, x, y, Y_RED | (x * y / 256));
  11. }
  12. }
  13. Bitmap_Write(ctx, "y_bitmap_Fade1.bmp");
  14. Bitmap_Destroy(ctx);
  15. }
  16. Test:y_bitmap_Fade2()
  17. {
  18. new
  19. Bitmap:ctx;
  20. ctx = Bitmap_Create(256, 256);
  21. for (new y = 0; y != 256; ++y)
  22. {
  23. for (new x = 0; x != 256; ++x)
  24. {
  25. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  26. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  27. }
  28. }
  29. Bitmap_Write(ctx, "y_bitmap_Fade2.bmp");
  30. Bitmap_Destroy(ctx);
  31. }
  32. Test:y_bitmap_Rect1()
  33. {
  34. new
  35. Bitmap:ctx;
  36. ctx = Bitmap_Create(256, 256);
  37. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0xFF);
  38. Bitmap_Write(ctx, "y_bitmap_Rect1.bmp");
  39. Bitmap_Destroy(ctx);
  40. }
  41. Test:y_bitmap_Rect2()
  42. {
  43. new
  44. Bitmap:ctx;
  45. ctx = Bitmap_Create(256, 256);
  46. Bitmap_DrawRectangle(ctx, 64, 64, 128, 192, Y_YELLOW | 0x80);
  47. Bitmap_DrawRectangle(ctx, 128, 64, 192, 192, Y_ALICEBLUE | 0x80);
  48. Bitmap_Write(ctx, "y_bitmap_Rect2.bmp");
  49. Bitmap_Destroy(ctx);
  50. }
  51. Test:y_bitmap_Rect3()
  52. {
  53. new
  54. Bitmap:ctx;
  55. ctx = Bitmap_Create(256, 256);
  56. Bitmap_DrawRectangle(ctx, 64, 64, 148, 192, Y_YELLOW | 0x80);
  57. Bitmap_DrawRectangle(ctx, 108, 64, 192, 192, Y_ALICEBLUE | 0x80);
  58. Bitmap_Write(ctx, "y_bitmap_Rect3.bmp");
  59. Bitmap_Destroy(ctx);
  60. }
  61. Test:y_bitmap_FadeRect1()
  62. {
  63. new
  64. Bitmap:ctx;
  65. ctx = Bitmap_Create(256, 256);
  66. for (new y = 0; y != 256; ++y)
  67. {
  68. for (new x = 0; x != 256; ++x)
  69. {
  70. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  71. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  72. }
  73. }
  74. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40);
  75. Bitmap_Write(ctx, "y_bitmap_FadeRect1.bmp");
  76. Bitmap_Destroy(ctx);
  77. }
  78. Test:y_bitmap_Diagonal1()
  79. {
  80. new
  81. Bitmap:ctx;
  82. ctx = Bitmap_Create(256, 256);
  83. _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 4, STRIPE2 = 4));
  84. for (new y = 0; y != 256; ++y)
  85. {
  86. for (new x = 0; x != 256; ++x)
  87. {
  88. //Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
  89. new
  90. alpha = YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX};
  91. if (alpha == 255)
  92. Bitmap_WritePixel(ctx, x, y, X11_RED);
  93. else if (alpha == 0)
  94. Bitmap_WritePixel(ctx, x, y, X11_WHITE);
  95. else if (alpha > 127)
  96. Bitmap_WritePixel(ctx, x, y, X11_GREEN);
  97. else
  98. Bitmap_WritePixel(ctx, x, y, X11_BLUE);
  99. }
  100. }
  101. Bitmap_Write(ctx, "y_bitmap_Diagonal1.bmp");
  102. Bitmap_Destroy(ctx);
  103. }
  104. Test:y_bitmap_Diagonal2()
  105. {
  106. new
  107. Bitmap:ctx;
  108. ctx = Bitmap_Create(256, 256);
  109. _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 2, STRIPE2 = 2));
  110. for (new y = 0; y != 256; ++y)
  111. {
  112. for (new x = 0; x != 256; ++x)
  113. {
  114. Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
  115. }
  116. }
  117. Bitmap_Write(ctx, "y_bitmap_Diagonal2.bmp");
  118. Bitmap_Destroy(ctx);
  119. }
  120. Test:y_bitmap_Diagonal3()
  121. {
  122. new
  123. Bitmap:ctx;
  124. ctx = Bitmap_Create(256, 256);
  125. _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 3, STRIPE2 = 3));
  126. for (new y = 0; y != 256; ++y)
  127. {
  128. for (new x = 0; x != 256; ++x)
  129. {
  130. Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
  131. }
  132. }
  133. Bitmap_Write(ctx, "y_bitmap_Diagonal3.bmp");
  134. Bitmap_Destroy(ctx);
  135. }
  136. Test:y_bitmap_Diagonal4()
  137. {
  138. new
  139. Bitmap:ctx;
  140. ctx = Bitmap_Create(256, 256);
  141. _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 2, STRIPE2 = 4));
  142. for (new y = 0; y != 256; ++y)
  143. {
  144. for (new x = 0; x != 256; ++x)
  145. {
  146. Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
  147. }
  148. }
  149. Bitmap_Write(ctx, "y_bitmap_Diagonal4.bmp");
  150. Bitmap_Destroy(ctx);
  151. }
  152. Test:y_bitmap_Diagonal5()
  153. {
  154. new
  155. Bitmap:ctx;
  156. ctx = Bitmap_Create(256, 256);
  157. _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 4, STRIPE2 = 2));
  158. for (new y = 0; y != 256; ++y)
  159. {
  160. for (new x = 0; x != 256; ++x)
  161. {
  162. Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
  163. }
  164. }
  165. Bitmap_Write(ctx, "y_bitmap_Diagonal5.bmp");
  166. Bitmap_Destroy(ctx);
  167. }
  168. Test:y_bitmap_Diagonal6()
  169. {
  170. new
  171. Bitmap:ctx;
  172. ctx = Bitmap_Create(256, 256);
  173. _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL));
  174. for (new y = 0; y != 256; ++y)
  175. {
  176. for (new x = 0; x != 256; ++x)
  177. {
  178. Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
  179. }
  180. }
  181. Bitmap_Write(ctx, "y_bitmap_Diagonal6.bmp");
  182. Bitmap_Destroy(ctx);
  183. }
  184. Test:y_bitmap_Pattern1()
  185. {
  186. new
  187. Bitmap:ctx;
  188. ctx = Bitmap_Create(256, 256);
  189. for (new y = 0; y != 256; ++y)
  190. {
  191. for (new x = 0; x != 256; ++x)
  192. {
  193. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  194. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  195. }
  196. }
  197. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(SOLID));
  198. Bitmap_Write(ctx, "y_bitmap_Pattern1.bmp");
  199. Bitmap_Destroy(ctx);
  200. }
  201. Test:y_bitmap_Pattern2()
  202. {
  203. new
  204. Bitmap:ctx;
  205. ctx = Bitmap_Create(256, 256);
  206. for (new y = 0; y != 256; ++y)
  207. {
  208. for (new x = 0; x != 256; ++x)
  209. {
  210. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  211. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  212. }
  213. }
  214. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL));
  215. Bitmap_Write(ctx, "y_bitmap_Pattern2.bmp");
  216. Bitmap_Destroy(ctx);
  217. }
  218. Test:y_bitmap_Pattern3()
  219. {
  220. new
  221. Bitmap:ctx;
  222. ctx = Bitmap_Create(256, 256);
  223. for (new y = 0; y != 256; ++y)
  224. {
  225. for (new x = 0; x != 256; ++x)
  226. {
  227. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  228. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  229. }
  230. }
  231. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE1 = 16));
  232. Bitmap_Write(ctx, "y_bitmap_Pattern3.bmp");
  233. Bitmap_Destroy(ctx);
  234. }
  235. Test:y_bitmap_Pattern4()
  236. {
  237. new
  238. Bitmap:ctx;
  239. ctx = Bitmap_Create(256, 256);
  240. for (new y = 0; y != 256; ++y)
  241. {
  242. for (new x = 0; x != 256; ++x)
  243. {
  244. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  245. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  246. }
  247. }
  248. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE2 = 16));
  249. Bitmap_Write(ctx, "y_bitmap_Pattern4.bmp");
  250. Bitmap_Destroy(ctx);
  251. }
  252. Test:y_bitmap_Pattern5()
  253. {
  254. new
  255. Bitmap:ctx;
  256. ctx = Bitmap_Create(256, 256);
  257. for (new y = 0; y != 256; ++y)
  258. {
  259. for (new x = 0; x != 256; ++x)
  260. {
  261. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  262. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  263. }
  264. }
  265. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE1 = 16, STRIPE2 = 8));
  266. Bitmap_Write(ctx, "y_bitmap_Pattern5.bmp");
  267. Bitmap_Destroy(ctx);
  268. }
  269. Test:y_bitmap_Pattern6()
  270. {
  271. new
  272. Bitmap:ctx;
  273. ctx = Bitmap_Create(256, 256);
  274. for (new y = 0; y != 256; ++y)
  275. {
  276. for (new x = 0; x != 256; ++x)
  277. {
  278. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  279. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  280. }
  281. }
  282. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE1 = 16, STRIPE2 = 8, RIGHT));
  283. Bitmap_Write(ctx, "y_bitmap_Pattern6.bmp");
  284. Bitmap_Destroy(ctx);
  285. }
  286. Test:y_bitmap_Pattern7()
  287. {
  288. new
  289. Bitmap:ctx;
  290. ctx = Bitmap_Create(256, 256);
  291. for (new y = 0; y != 256; ++y)
  292. {
  293. for (new x = 0; x != 256; ++x)
  294. {
  295. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  296. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  297. }
  298. }
  299. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(STRIPED));
  300. Bitmap_Write(ctx, "y_bitmap_Pattern7.bmp");
  301. Bitmap_Destroy(ctx);
  302. }
  303. Test:y_bitmap_Pattern8()
  304. {
  305. new
  306. Bitmap:ctx;
  307. ctx = Bitmap_Create(256, 256);
  308. for (new y = 0; y != 256; ++y)
  309. {
  310. for (new x = 0; x != 256; ++x)
  311. {
  312. Bitmap_WritePixel(ctx, x, y, Y_RED | y);
  313. Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
  314. }
  315. }
  316. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(STRIPED, HORIZONTAL));
  317. Bitmap_Write(ctx, "y_bitmap_Pattern8.bmp");
  318. Bitmap_Destroy(ctx);
  319. }
  320. Test:y_bitmap_Border1()
  321. {
  322. new
  323. Bitmap:ctx;
  324. ctx = Bitmap_Create(256, 256);
  325. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE);
  326. Bitmap_Write(ctx, "y_bitmap_Border1.bmp");
  327. Bitmap_Destroy(ctx);
  328. }
  329. Test:y_bitmap_Border2()
  330. {
  331. new
  332. Bitmap:ctx;
  333. ctx = Bitmap_Create(256, 256);
  334. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(SOLID, BORDER = 16));
  335. Bitmap_Write(ctx, "y_bitmap_Border2.bmp");
  336. Bitmap_Destroy(ctx);
  337. }
  338. Test:y_bitmap_Border3()
  339. {
  340. new
  341. Bitmap:ctx;
  342. ctx = Bitmap_Create(256, 256);
  343. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DIAGONAL, BORDER = 32));
  344. Bitmap_Write(ctx, "y_bitmap_Border3.bmp");
  345. Bitmap_Destroy(ctx);
  346. }
  347. Test:y_bitmap_Border4()
  348. {
  349. new
  350. Bitmap:ctx;
  351. ctx = Bitmap_Create(256, 256);
  352. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DOTTED));
  353. Bitmap_Write(ctx, "y_bitmap_Border4.bmp");
  354. Bitmap_Destroy(ctx);
  355. }
  356. Test:y_bitmap_Border5()
  357. {
  358. new
  359. Bitmap:ctx;
  360. ctx = Bitmap_Create(256, 256);
  361. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DOTTED, STRIPE1 = 16, STRIPE2 = 4));
  362. Bitmap_Write(ctx, "y_bitmap_Border5.bmp");
  363. Bitmap_Destroy(ctx);
  364. }
  365. Test:y_bitmap_Border6()
  366. {
  367. new
  368. Bitmap:ctx;
  369. ctx = Bitmap_Create(256, 256);
  370. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DOTTED, STRIPE1 = 1, STRIPE2 = 8));
  371. Bitmap_Write(ctx, "y_bitmap_Border6.bmp");
  372. Bitmap_Destroy(ctx);
  373. }
  374. Test:y_bitmap_Large1()
  375. {
  376. new
  377. Bitmap:ctx;
  378. ctx = Bitmap_Create(512, 512);
  379. Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_LAVENDER | 0xFF);
  380. Bitmap_Write(ctx, "y_bitmap_Large1.bmp");
  381. Bitmap_Destroy(ctx);
  382. }
  383. Test:y_bitmap_Large2()
  384. {
  385. new
  386. Bitmap:ctx;
  387. ctx = Bitmap_Create(512, 512);
  388. Bitmap_DrawRectangle(ctx, 0, 0, 256, 256, Y_LAVENDER | 0xFF);
  389. Bitmap_Write(ctx, "y_bitmap_Large2.bmp");
  390. Bitmap_Destroy(ctx);
  391. }
  392. Test:y_bitmap_Large3()
  393. {
  394. new
  395. Bitmap:ctx;
  396. ctx = Bitmap_Create(512, 512);
  397. Bitmap_DrawRectangle(ctx, 64, 64, 512, 512, Y_LAVENDER | 0xFF);
  398. Bitmap_Write(ctx, "y_bitmap_Large3.bmp");
  399. Bitmap_Destroy(ctx);
  400. }
  401. Test:y_bitmap_Large4()
  402. {
  403. new
  404. Bitmap:ctx;
  405. ctx = Bitmap_Create(512, 512);
  406. Bitmap_DrawRectangle(ctx, 64, 64, 70, 500, Y_LAVENDER | 0xFF);
  407. Bitmap_Write(ctx, "y_bitmap_Large4.bmp");
  408. Bitmap_Destroy(ctx);
  409. }
  410. Test:y_bitmap_Large5()
  411. {
  412. new
  413. Bitmap:ctx;
  414. ctx = Bitmap_Create(512, 512);
  415. Bitmap_DrawRectangle(ctx, 64, 64, 500, 70, Y_LAVENDER | 0xFF);
  416. Bitmap_Write(ctx, "y_bitmap_Large5.bmp");
  417. Bitmap_Destroy(ctx);
  418. }
  419. Test:y_bitmap_VLarge1()
  420. {
  421. new
  422. Bitmap:ctx;
  423. ctx = Bitmap_Create(1024, 1024);
  424. Bitmap_DrawRectangle(ctx, 256, 256, 768, 768, Y_MINTCREAM | 0xFF);
  425. Bitmap_Write(ctx, "y_bitmap_VLarge1.bmp");
  426. Bitmap_Destroy(ctx);
  427. }