| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- /*
- Legal:
- Version: MPL 1.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 the "License"; you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the YSI framework.
-
- The Initial Developer of the Original Code is Alex "Y_Less" Cole.
- Portions created by the Initial Developer are Copyright C 2011
- the Initial Developer. All Rights Reserved.
- Contributors:
- Y_Less
- koolk
- JoeBullet/Google63
- g_aSlice/Slice
- Misiur
- samphunter
- tianmeta
- maddinat0r
- spacemud
- Crayder
- Dayvison
- Ahmad45123
- Zeex
- irinel1996
- Yiin-
- Chaprnks
- Konstantinos
- Masterchen09
- Southclaws
- PatchwerkQWER
- m0k1
- paulommu
- udan111
- Thanks:
- JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
- ZeeX - Very productive conversations.
- koolk - IsPlayerinAreaEx code.
- TheAlpha - Danish translation.
- breadfish - German translation.
- Fireburn - Dutch translation.
- yom - French translation.
- 50p - Polish translation.
- Zamaroht - Spanish translation.
- Los - Portuguese translation.
- Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
- me to strive to better.
- Pixels^ - Running XScripters where the idea was born.
- Matite - Pestering me to release it and using it.
- Very special thanks to:
- Thiadmer - PAWN, whose limits continue to amaze me!
- Kye/Kalcor - SA:MP.
- SA:MP Team past, present and future - SA:MP.
- Optional plugins:
- Gamer_Z - GPS.
- Incognito - Streamer.
- Me - sscanf2, fixes2, Whirlpool.
- */
- Test:y_bitmap_Fade1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | (x * y / 256));
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Fade1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Fade2()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Fade2.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Rect1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_Rect1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Rect2()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 128, 192, Y_YELLOW | 0x80);
- Bitmap_DrawRectangle(ctx, 128, 64, 192, 192, Y_ALICEBLUE | 0x80);
- Bitmap_Write(ctx, "y_bitmap_Rect2.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Rect3()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 148, 192, Y_YELLOW | 0x80);
- Bitmap_DrawRectangle(ctx, 108, 64, 192, 192, Y_ALICEBLUE | 0x80);
- Bitmap_Write(ctx, "y_bitmap_Rect3.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_FadeRect1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40);
- Bitmap_Write(ctx, "y_bitmap_FadeRect1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Diagonal1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 4, STRIPE2 = 4));
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- //Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
- new
- alpha = YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX};
- if (alpha == 255)
- Bitmap_WritePixel(ctx, x, y, X11_RED);
- else if (alpha == 0)
- Bitmap_WritePixel(ctx, x, y, X11_WHITE);
- else if (alpha > 127)
- Bitmap_WritePixel(ctx, x, y, X11_GREEN);
- else
- Bitmap_WritePixel(ctx, x, y, X11_BLUE);
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Diagonal1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Diagonal2()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 2, STRIPE2 = 2));
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Diagonal2.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Diagonal3()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 3, STRIPE2 = 3));
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Diagonal3.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Diagonal4()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 2, STRIPE2 = 4));
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Diagonal4.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Diagonal5()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL, STRIPE1 = 4, STRIPE2 = 2));
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Diagonal5.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Diagonal6()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- _BMP_PAT@DIAGONAL(0, 0, 0, 0, PATTERN(DIAGONAL));
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | (YSI_gBitmapAlpha[y % YSI_gBitmapAlphaY]{x % YSI_gBitmapAlphaX}));
- }
- }
- Bitmap_Write(ctx, "y_bitmap_Diagonal6.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(SOLID));
- Bitmap_Write(ctx, "y_bitmap_Pattern1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern2()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL));
- Bitmap_Write(ctx, "y_bitmap_Pattern2.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern3()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE1 = 16));
- Bitmap_Write(ctx, "y_bitmap_Pattern3.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern4()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE2 = 16));
- Bitmap_Write(ctx, "y_bitmap_Pattern4.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern5()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE1 = 16, STRIPE2 = 8));
- Bitmap_Write(ctx, "y_bitmap_Pattern5.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern6()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(DIAGONAL, STRIPE1 = 16, STRIPE2 = 8, RIGHT));
- Bitmap_Write(ctx, "y_bitmap_Pattern6.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern7()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(STRIPED));
- Bitmap_Write(ctx, "y_bitmap_Pattern7.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Pattern8()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- for (new y = 0; y != 256; ++y)
- {
- for (new x = 0; x != 256; ++x)
- {
- Bitmap_WritePixel(ctx, x, y, Y_RED | y);
- Bitmap_WritePixel(ctx, x, y, Y_GREEN | x);
- }
- }
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_YELLOW | 0x40, .fillPattern = PATTERN(STRIPED, HORIZONTAL));
- Bitmap_Write(ctx, "y_bitmap_Pattern8.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Border1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE);
- Bitmap_Write(ctx, "y_bitmap_Border1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Border2()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(SOLID, BORDER = 16));
- Bitmap_Write(ctx, "y_bitmap_Border2.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Border3()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DIAGONAL, BORDER = 32));
- Bitmap_Write(ctx, "y_bitmap_Border3.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Border4()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DOTTED));
- Bitmap_Write(ctx, "y_bitmap_Border4.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Border5()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DOTTED, STRIPE1 = 16, STRIPE2 = 4));
- Bitmap_Write(ctx, "y_bitmap_Border5.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Border6()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(256, 256);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, 0, X11_ROYALBLUE, .linePattern = PATTERN(DOTTED, STRIPE1 = 1, STRIPE2 = 8));
- Bitmap_Write(ctx, "y_bitmap_Border6.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Large1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(512, 512);
- Bitmap_DrawRectangle(ctx, 64, 64, 192, 192, Y_LAVENDER | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_Large1.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Large2()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(512, 512);
- Bitmap_DrawRectangle(ctx, 0, 0, 256, 256, Y_LAVENDER | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_Large2.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Large3()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(512, 512);
- Bitmap_DrawRectangle(ctx, 64, 64, 512, 512, Y_LAVENDER | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_Large3.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Large4()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(512, 512);
- Bitmap_DrawRectangle(ctx, 64, 64, 70, 500, Y_LAVENDER | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_Large4.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_Large5()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(512, 512);
- Bitmap_DrawRectangle(ctx, 64, 64, 500, 70, Y_LAVENDER | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_Large5.bmp");
- Bitmap_Destroy(ctx);
- }
- Test:y_bitmap_VLarge1()
- {
- new
- Bitmap:ctx;
- ctx = Bitmap_Create(1024, 1024);
- Bitmap_DrawRectangle(ctx, 256, 256, 768, 768, Y_MINTCREAM | 0xFF);
- Bitmap_Write(ctx, "y_bitmap_VLarge1.bmp");
- Bitmap_Destroy(ctx);
- }
|