From 4de225d462f0cdb5ce3fffa4a2ffe41f7435c80c Mon Sep 17 00:00:00 2001 From: huyhuynh2319 Date: Wed, 11 Dec 2024 14:42:25 +1100 Subject: [PATCH] 5 Usage example for Graphics P2 --- .../current_clip/current-clip-1-simple-oop.cs | 24 +++++++++++ .../current-clip-1-simple-top-level.cs | 19 +++++++++ .../current_clip/current-clip-1-simple.cpp | 24 +++++++++++ .../current_clip/current-clip-1-simple.png | Bin 0 -> 8916 bytes .../current_clip/current-clip-1-simple.py | 21 ++++++++++ .../current_clip/current-clip-1-simple.txt | 3 ++ .../pop_clip/pop-clip-1-simple-oop.cs | 34 ++++++++++++++++ .../pop_clip/pop-clip-1-simple-top-level.cs | 31 ++++++++++++++ .../graphics/pop_clip/pop-clip-1-simple.cpp | 33 +++++++++++++++ .../graphics/pop_clip/pop-clip-1-simple.png | Bin 0 -> 6968 bytes .../graphics/pop_clip/pop-clip-1-simple.py | 28 +++++++++++++ .../graphics/pop_clip/pop-clip-1-simple.txt | 3 ++ .../push_clip/push-clip-1-simple-oop.cs | 34 ++++++++++++++++ .../push_clip/push-clip-1-simple-top-level.cs | 31 ++++++++++++++ .../graphics/push_clip/push-clip-1-simple.cpp | 33 +++++++++++++++ .../graphics/push_clip/push-clip-1-simple.png | Bin 0 -> 6883 bytes .../graphics/push_clip/push-clip-1-simple.py | 27 +++++++++++++ .../graphics/push_clip/push-clip-1-simple.txt | 3 ++ .../reset_clip/reset-clip-1-simple-oop.cs | 32 +++++++++++++++ .../reset-clip-1-simple-top-level.cs | 28 +++++++++++++ .../reset_clip/reset-clip-1-simple.cpp | 38 ++++++++++++++++++ .../reset_clip/reset-clip-1-simple.png | Bin 0 -> 6792 bytes .../reset_clip/reset-clip-1-simple.py | 37 +++++++++++++++++ .../reset_clip/reset-clip-1-simple.txt | 3 ++ .../set_clip/set-clip-1-simple-oop.cs | 26 ++++++++++++ .../set_clip/set-clip-1-simple-top-level.cs | 22 ++++++++++ .../graphics/set_clip/set-clip-1-simple.cpp | 27 +++++++++++++ .../graphics/set_clip/set-clip-1-simple.png | Bin 0 -> 7109 bytes .../graphics/set_clip/set-clip-1-simple.py | 22 ++++++++++ .../graphics/set_clip/set-clip-1-simple.txt | 3 ++ 30 files changed, 586 insertions(+) create mode 100644 public/usage-examples/graphics/current_clip/current-clip-1-simple-oop.cs create mode 100644 public/usage-examples/graphics/current_clip/current-clip-1-simple-top-level.cs create mode 100644 public/usage-examples/graphics/current_clip/current-clip-1-simple.cpp create mode 100644 public/usage-examples/graphics/current_clip/current-clip-1-simple.png create mode 100644 public/usage-examples/graphics/current_clip/current-clip-1-simple.py create mode 100644 public/usage-examples/graphics/current_clip/current-clip-1-simple.txt create mode 100644 public/usage-examples/graphics/pop_clip/pop-clip-1-simple-oop.cs create mode 100644 public/usage-examples/graphics/pop_clip/pop-clip-1-simple-top-level.cs create mode 100644 public/usage-examples/graphics/pop_clip/pop-clip-1-simple.cpp create mode 100644 public/usage-examples/graphics/pop_clip/pop-clip-1-simple.png create mode 100644 public/usage-examples/graphics/pop_clip/pop-clip-1-simple.py create mode 100644 public/usage-examples/graphics/pop_clip/pop-clip-1-simple.txt create mode 100644 public/usage-examples/graphics/push_clip/push-clip-1-simple-oop.cs create mode 100644 public/usage-examples/graphics/push_clip/push-clip-1-simple-top-level.cs create mode 100644 public/usage-examples/graphics/push_clip/push-clip-1-simple.cpp create mode 100644 public/usage-examples/graphics/push_clip/push-clip-1-simple.png create mode 100644 public/usage-examples/graphics/push_clip/push-clip-1-simple.py create mode 100644 public/usage-examples/graphics/push_clip/push-clip-1-simple.txt create mode 100644 public/usage-examples/graphics/reset_clip/reset-clip-1-simple-oop.cs create mode 100644 public/usage-examples/graphics/reset_clip/reset-clip-1-simple-top-level.cs create mode 100644 public/usage-examples/graphics/reset_clip/reset-clip-1-simple.cpp create mode 100644 public/usage-examples/graphics/reset_clip/reset-clip-1-simple.png create mode 100644 public/usage-examples/graphics/reset_clip/reset-clip-1-simple.py create mode 100644 public/usage-examples/graphics/reset_clip/reset-clip-1-simple.txt create mode 100644 public/usage-examples/graphics/set_clip/set-clip-1-simple-oop.cs create mode 100644 public/usage-examples/graphics/set_clip/set-clip-1-simple-top-level.cs create mode 100644 public/usage-examples/graphics/set_clip/set-clip-1-simple.cpp create mode 100644 public/usage-examples/graphics/set_clip/set-clip-1-simple.png create mode 100644 public/usage-examples/graphics/set_clip/set-clip-1-simple.py create mode 100644 public/usage-examples/graphics/set_clip/set-clip-1-simple.txt diff --git a/public/usage-examples/graphics/current_clip/current-clip-1-simple-oop.cs b/public/usage-examples/graphics/current_clip/current-clip-1-simple-oop.cs new file mode 100644 index 00000000..942c2047 --- /dev/null +++ b/public/usage-examples/graphics/current_clip/current-clip-1-simple-oop.cs @@ -0,0 +1,24 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a window with the title "Current Clip" and dimensions + Window window= SplashKit.OpenWindow("Current Clip", 800, 600); + + // Push a clipping area + Rectangle rectangle = SplashKit.CurrentClip(); + // Display information about the current clipping area (Width and Height) in the window + SplashKit.DrawText($"Current Clip: Width:{rectangle.Width} Height:{rectangle.Height}", Color.Black, "Arial", 24, 100, 100); + + // Refresh the screen to display the text + SplashKit.RefreshScreen(); + + // Wait for 5 seconds to observe the clipping area information + SplashKit.Delay(5000); + + // Close the window + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/current_clip/current-clip-1-simple-top-level.cs b/public/usage-examples/graphics/current_clip/current-clip-1-simple-top-level.cs new file mode 100644 index 00000000..c9b50e0f --- /dev/null +++ b/public/usage-examples/graphics/current_clip/current-clip-1-simple-top-level.cs @@ -0,0 +1,19 @@ +using static SplashKitSDK.SplashKit; +using SplashKitSDK; + // Open a window with the title "Current Clip" and dimensions + Window window= OpenWindow("Current Clip", 800, 600); + + // Push a clipping area + Rectangle rectangle = CurrentClip(); + // Display information about the current clipping area (Width and Height) in the window + DrawText($"Current Clip: Width:{rectangle.Width} Height:{rectangle.Height}", Color.Black, "Arial", 24, 100, 100); + + // Refresh the screen to display the text + RefreshScreen(); + + // Wait for 5 seconds to observe the clipping area information + Delay(5000); + + // Close the window + CloseAllWindows(); + diff --git a/public/usage-examples/graphics/current_clip/current-clip-1-simple.cpp b/public/usage-examples/graphics/current_clip/current-clip-1-simple.cpp new file mode 100644 index 00000000..635f2a2a --- /dev/null +++ b/public/usage-examples/graphics/current_clip/current-clip-1-simple.cpp @@ -0,0 +1,24 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Current Clip" and dimensions + window win = open_window("Current Clip", 800, 600); + + // Define the clipping area + rectangle rect = current_clip(win); + + // Draw the clipping information + draw_text("Current Clip: " + std::to_string(rect.width) + " X " + std::to_string(rect.height), COLOR_BLACK, "Arial", 24, 100, 100); + + // Refresh the screen to display the text + refresh_screen(); + + // Wait for 5 seconds + delay(5000); + + // Close all windows + close_all_windows(); + + return 0; +} diff --git a/public/usage-examples/graphics/current_clip/current-clip-1-simple.png b/public/usage-examples/graphics/current_clip/current-clip-1-simple.png new file mode 100644 index 0000000000000000000000000000000000000000..69b2b75e6ebbf3906d95ed0daa0f5d69fb663e6e GIT binary patch literal 8916 zcmeHMX;f3mwvOG}+A3nVZPS97R{LJ?I-~&^G>|wpdL0m%WK1Ih%3zcLApsH}Nkgh1jUCLzf^-uHgIKkvQ!e!X?q;>W48>eQ)K zYuEn1{q5S7ee9^W)l%D~5D3KT;DLR|A&@Vn;InGUSKyb%*`_FMfnU7 z%K8?*cz4&y6}O(Jy1gIF{^GzO=SAFs6Y!sYUlg-&kMpI1mXH&F*4uwC*EXgp-4vzxe&iR{fKngjI0a`uFIdl}o)ybo9Jvewfhpl7GHRfA?T zA2Bp!VZjlL>Q86Hlp0(EQZ{lmS3`U{MoLoD2Gkt(Nr47mZ_-#&CmqrBWWV61llyf} z;BOu~a=w$w%duyJaf&&oa8z?9zo}_wvbq2KyJyceIq1wsj2SCC&Zb9YZ#_S|!J+O} z^_+!ZfpXYh)2G+iRZcChxrse{DE2Yc5-I&nlY7Ljt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7L<=oImR7e`Rym2A5m^L!sw_h6@@lXh2!`pC3N1cyPsoD;`|&09AkgqqcJuSRYdX zyS(J`(ntJnbkVMhc3rgVqTT;r+Pzt8?p>`6;(~LhRzvUHI_fiQn=)et6a~|q8#hLv PCE(!xL;D)`oVfH4JkZ6& literal 0 HcmV?d00001 diff --git a/public/usage-examples/graphics/reset_clip/reset-clip-1-simple.py b/public/usage-examples/graphics/reset_clip/reset-clip-1-simple.py new file mode 100644 index 00000000..58a3e753 --- /dev/null +++ b/public/usage-examples/graphics/reset_clip/reset-clip-1-simple.py @@ -0,0 +1,37 @@ +from splashkit import * + + +window = open_window("Reset Clip", 800, 600) + +# Define the clipping area +r = rectangle_from(100, 100, 600, 400) + +# Set the clipping area +set_clip(r) + + +# Draw a blue rectangle inside the clipping area +fill_rectangle(color_blue(), 50, 50, 700, 500) +refresh_screen() # Refresh screen to apply the drawing +delay(1000) + +# Draw a red rectangle outside the clipping area (it will not be clipped) +set_clip(r) + +# Draw a red rectangle outside the clipping area +fill_rectangle(color_red(), 100, 100, 200, 200) +refresh_screen() #Refresh screen to show the changes +delay(1000) + +# Remove the clipping area to allow full window drawing +reset_clip() + +# Clear screen and set a new background color (green) +clear_screen(color_green()) + +# Refresh screen to apply the changes +refresh_screen() +delay(5000) + +# Close all windows +close_all_windows() diff --git a/public/usage-examples/graphics/reset_clip/reset-clip-1-simple.txt b/public/usage-examples/graphics/reset_clip/reset-clip-1-simple.txt new file mode 100644 index 00000000..46a28413 --- /dev/null +++ b/public/usage-examples/graphics/reset_clip/reset-clip-1-simple.txt @@ -0,0 +1,3 @@ +#### RESET CLIP + +The following code shows an examples of using [Reset Clip](/api/graphics#reset-clip) to set a clip around a specific rectangle area and draw only within this area to emphasize a region. \ No newline at end of file diff --git a/public/usage-examples/graphics/set_clip/set-clip-1-simple-oop.cs b/public/usage-examples/graphics/set_clip/set-clip-1-simple-oop.cs new file mode 100644 index 00000000..5048acd7 --- /dev/null +++ b/public/usage-examples/graphics/set_clip/set-clip-1-simple-oop.cs @@ -0,0 +1,26 @@ +using SplashKitSDK; + +public class Program +{ + public static void Main() + { + // Open a window with the title "Set Clip" and dimensions 800x600 + Window window = SplashKit.OpenWindow("Set Clip", 800, 600); + + // Define a rectangle that will be used as the clipping area + Rectangle rectangle = SplashKit.RectangleFrom(100, 100, 600, 400); + + // Push a clipping area onto the window + SplashKit.SetClip(window, rectangle); + + // Draw a blue rectangle that will be clipped by the clipping area + SplashKit.FillRectangle(Color.Blue, 50, 50, 700, 500); // This will be clipped + + // Refresh the screen to display the drawing + SplashKit.RefreshScreen(); + SplashKit.Delay(5000); // Wait for 5 seconds to view the result + + // Close the window + SplashKit.CloseAllWindows(); + } +} diff --git a/public/usage-examples/graphics/set_clip/set-clip-1-simple-top-level.cs b/public/usage-examples/graphics/set_clip/set-clip-1-simple-top-level.cs new file mode 100644 index 00000000..12c6a47e --- /dev/null +++ b/public/usage-examples/graphics/set_clip/set-clip-1-simple-top-level.cs @@ -0,0 +1,22 @@ +using static SplashKitSDK.SplashKit; +using SplashKitSDK; + + // Open a window with the title "Set Clip" and dimensions 800x600 + Window window = OpenWindow("Set Clip", 800, 600); + + // Define a rectangle that will be used as the clipping area + Rectangle rectangle = RectangleFrom(100, 100, 600, 400); + + // Push a clipping area onto the window + SetClip(window, rectangle); + + // Draw a blue rectangle that will be clipped by the clipping area + FillRectangle(Color.Blue, 50, 50, 700, 500); // This will be clipped + + // Refresh the screen to display the drawing + RefreshScreen(); + Delay(5000); // Wait for 5 seconds to view the result + + // Close the window + CloseAllWindows(); + diff --git a/public/usage-examples/graphics/set_clip/set-clip-1-simple.cpp b/public/usage-examples/graphics/set_clip/set-clip-1-simple.cpp new file mode 100644 index 00000000..a92efac3 --- /dev/null +++ b/public/usage-examples/graphics/set_clip/set-clip-1-simple.cpp @@ -0,0 +1,27 @@ +#include "splashkit.h" + +int main() +{ + // Open a window with the title "Set Clip" and dimensions of 800x600 pixels + open_window("Set Clip", 800, 600); + + // Define a clipping area with a rectangle (x, y, width, height) + rectangle rect = {100, 100, 600, 400}; + + // Set the clipping area to restrict drawing to the specified rectangle + set_clip(rect); + + // Draw a large rectangle; since it exceeds the clipping area, it will be clipped + fill_rectangle(COLOR_BLUE, 50, 50, 700, 500); + + // Refresh the screen to display the drawing + refresh_screen(); + + // Wait for 5 seconds to observe the effect of the clipping + delay(5000); + + // Close the window + close_all_windows(); + + return 0; +} diff --git a/public/usage-examples/graphics/set_clip/set-clip-1-simple.png b/public/usage-examples/graphics/set_clip/set-clip-1-simple.png new file mode 100644 index 0000000000000000000000000000000000000000..96a385c5b49077c4c4fd89b9189a9e3d52c423d5 GIT binary patch literal 7109 zcmeHLYgAKL7QPM?Xc1_oBMM@4Y|FG&&_O^Fc~mTD6|f4Vg_3|GuK*DtJQ9+qEMXW# zw5`MhL&S#TkDx%Zs4 z_xFA0>{E6kBFy0(*LMH_a5#G8@JRr$ngN@$oeenhH*G*5*lox;8FmO@Jli%48rCVF zg?|PB4=U}AiEn}S+vkpaodW=ya@X4iX)>e$0Ni4a9{wz<0HKsbUfHgT=Pxd(9x2R6 zr#=|pwDZe5lKuNOXCA%ui|Z#RzU+p!e6WM%au;!}BDm-As}biVx{D!|*5kA3FPnbC zjobY8#Wm~q&(Zhiz1Wd@$yvBBV*Y@EM3!$AEBYB+1ysvlRMZ`xCKuLFQ}RYgy5(we zN@_+%#)Fu>#_lrgc-Jw^+Alo8H*Ch-km%tu3H55;4YNj+DVSS3v+kyAGpMk_&dquh z^NayKT+C}}^z8JBr+qUwf(a$OR$$B}XT_r}_f8Fi|XrQ#&~Xe^*$86s0jW*dPbYm&h$MP5EB>5>FziI3Fj5| z2VO0Djbdf~Y>QdD!6tR4=yJRlhTDaa`3fi!+q}IXDI`8an>}sHl3ZU~k>LSsRIfgZprT%OKa-@%WJVB%z%m#~%Y=cvg0 zj>LxUACBlZyXNF9YuH{UylDs$F;cZBPOktbU#PZI^9+2Ug1lh@N_jgr!0Sma2rfv+FfsGXf#2A8FUF}d1U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x(G-%mf~zEQFsf@9GWW)n7&Ayf^?x=v(?` zIZ2{A0*TG=8b=fh%~J(jjcj2g)mh|+s@<$Gj(Tf62JjrnoBT&w+@O={;Kw~1fC~dR zG$k`%B;weqwsG+CVP9Quf+Mzqjy9YB{DSz0H%E)Z62yOBUszCLL5T$=e_VfC_+jCP zg&!7v{1;Dl7Rj(k#{XP0HtzB5;E!2F&={0k+xoy4f#a~esPJ%y=`onKJ|LO!c&?A! zwG9Azh858P#y1JixFNrn@j^>AZ>i@0zpD8s?r@Fy<3*QGn_B<+Bba>P=;slK8HW-s F{Sy|~LO1{b literal 0 HcmV?d00001 diff --git a/public/usage-examples/graphics/set_clip/set-clip-1-simple.py b/public/usage-examples/graphics/set_clip/set-clip-1-simple.py new file mode 100644 index 00000000..e2029312 --- /dev/null +++ b/public/usage-examples/graphics/set_clip/set-clip-1-simple.py @@ -0,0 +1,22 @@ +from splashkit import * + +# Open a window with the title "Set Clip" and dimensions of 800x600 pixels +window = open_window("Set Clip", 800, 600) + +# Define the clipping area with a rectangle (x, y, width, height) +r = rectangle_from(100, 100, 600, 400) + +# Set the clipping area to restrict drawing within the specified rectangle +set_clip(r) + +# Draw a large blue rectangle; it will be clipped to the set area +fill_rectangle(color_blue(), 50, 50, 700, 500) + +# Refresh the screen to display the drawing +refresh_screen() + +# Delay for 5 seconds to observe the effect of the clipping +delay(5000) + +# Close all windows +close_all_windows() diff --git a/public/usage-examples/graphics/set_clip/set-clip-1-simple.txt b/public/usage-examples/graphics/set_clip/set-clip-1-simple.txt new file mode 100644 index 00000000..e9139d76 --- /dev/null +++ b/public/usage-examples/graphics/set_clip/set-clip-1-simple.txt @@ -0,0 +1,3 @@ +#### SET CLIP + +The following code shows an examples of using [Set Clip](/api/graphics#set-clip) to set multiple clip areas, then reset and fill the entire window with a single color to show restoration. \ No newline at end of file