%\iffalse meta-comment
%
% na-tikzornament.dtx
% Version: 1.0 (Initial Release)
% Date: 2026/05/14
%
% --- LICENSE / الترخيص ---
% English:
% This work (the na-tikzornament package) is licensed under the 
% LaTeX Project Public License (LPPL), version 1.3c or later.
%
% Arabic:
% هذا العمل (حزمة na-tikzornament) مرخص تحت شروط رخصة مشروع لاتيك 
% العامة (LPPL)، الإصدار 1.3c أو أي إصدار لاحق.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{na-tikzornament.dtx}
\documentclass{ltxdoc}
\usepackage[x11names,svgnames]{xcolor}
\usepackage{na-tikzornament}
\usepackage[explicit]{titlesec}
\usepackage{etoolbox}
\usepackage{contour}
\usepackage{array}
\usepackage{verbatim}
\usepackage{tikz,geometry,eso-pic,polyglossia}
\usetikzlibrary{shapes.geometric, calc}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{calc,backgrounds,positioning,decorations.markings,shapes.geometric}
\geometry{left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm}
\setmainlanguage[numerals=maghrib,locale=algeria]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Amiri} 
\newfontfamily\na[Script=Arabic,Scale=1.2]{Amiri} 
\newfontfamily\arabicfontsf[Script=Arabic,Scale=1.2]{Amiri}
\AtBeginEnvironment{verbatim}{%
  \selectlanguage{english}%
  \setLTR%
}
\renewcommand{\thesection}{\arabic{section}}
\titleformat{\section}
{\bf\Large\sffamily}
{\begin{tikzpicture}[baseline=(a.base)]
\node[text=white,scale=1,anchor=east,draw=blue!50!black,
fill=red!50!black,rounded corners=1pt] (a) {\thesection};
\node [text=black,anchor=east] at (a.west) (2){\large\textarabic{\bf\sffamily #1}};
\end{tikzpicture}}
{0pt}{}
\titleformat{\subsection}
{\bf}
{\begin{tikzpicture}[baseline=(a.base)]
\node[text=white,scale=1,anchor=east,draw=blue!50!black,
fill=blue!50!black,rounded corners=1pt] (a) {\thesubsection};
\node [text=black,anchor=east] at (a.west) (2){\large\textarabic{\bf\sffamily #1}};
\end{tikzpicture}}
{0pt}{}
\setnonlatin
\definecolor{Navy}{RGB}{0,0,128}
\definecolor{DeepBlue}{HTML}{0A192F}
\definecolor{SoftSlate}{HTML}{2C3E50} 
\definecolor{coverfgcolor}{RGB}{20, 60, 100}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\AddToShipoutPictureBG*{\begin{tikzpicture}[remember picture,overlay]
\natikzornament{7}{coverfgcolor}{0.7}
\draw[fill=coverfgcolor!40, tile fill] (current page.north west) rectangle(current page.south east);
\end{tikzpicture}}
 \tikzset{ render blur shadow/.prefix code={
\colorlet{black}{black}}}
\newcommand\boxtitle[1]{%
\begin{tikzpicture}
\natikzornament{1}{Navy}{0.2}
\node[text width=\textwidth-1cm, rectangle,draw,line width=1pt,minimum width=\textwidth ,inner ysep=1cm,fill=Navy!10,tile fill,blur shadow]{%
\huge
\begin{RTL}
\begin{center}
#1
\end{center}
\end{RTL}};
\end{tikzpicture}}
\begin{document}
\OnlyDescription  % <--- هذا السطر هو التعديل الوحيد: يمنع ظهور صفحة الأكواد الأخيرة
\DocInput{na-tikzornament.dtx}
\end{document}
%</driver>
% \fi
%
%\title{\boxtitle{\fontsize{1.4cm}{1cm}\color{orange}\bf na-tikzornament\\[0.4cm]\fontsize{1.4cm}{1cm}\color{Navy}\bf\textarabic{ حزمة الزخارف الهندسية - الإصدار 1.0}}}
%\author{} \date{}
%\maketitle
%\newpage
%
%\section{مقدمة وتوافقية المعالجة}
%\selectlanguage{arabic}
% نضع بين أيدي الأساتذة الكرام هذه الحزمة لإنشاء خلفيات وزخارف هندسية معقدة بلمسة واحدة.\\
%\textbf{ملاحظة هامة:}\\
%تعمل الحزمة بكفاءة مع المعالجات التالية  \texttt{pdfLaTeX}, \texttt{XeLaTeX}, و \texttt{LuaLaTeX}.
%
%\section{نماذج من  زخارف}
% سنعرض هنا أول خمس زخارف، حيث تظهر كل واحدة منها مطبقة داخل حيز مستطيل أبعاده $4 \times 3$ سم لبيان كيفية تكرار النمط آلياً.
%
% \subsection*{الزخرفة الأولى: النمط الكلاسيكي}
% لاستخدام الزخرفة رقم 1 باللون الأزرق:
% \begin{verbatim}
% \begin{tikzpicture}
%    \natikzornament{1}{blue}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{verbatim}
% \begin{center}
% \begin{tikzpicture}
%    \natikzornament{1}{blue}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{center}
% \hrulefill
%
% \subsection*{الزخرفة الثانية: نمط المربعات المتقاطعة}
% \begin{verbatim}
% \begin{tikzpicture}
%    \natikzornament{2}{Red2}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{verbatim}
% \begin{center}
% \begin{tikzpicture}
%    \natikzornament{2}{Red2}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{center}
% \hrulefill
%
% \subsection*{الزخرفة الثالثة: النمط الانسيابي}
% \begin{verbatim}
% \begin{tikzpicture}
%    \natikzornament{3}{Green4}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{verbatim}
% \begin{center}
% \begin{tikzpicture}
%    \natikzornament{3}{Green4}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{center}
% \hrulefill
%
% \subsection*{الزخرفة الرابعة: النمط الهندسي المركب}
% \begin{verbatim}
% \begin{tikzpicture}
%    \natikzornament{4}{orange}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{verbatim}
% \begin{center}
% \begin{tikzpicture}
%    \natikzornament{4}{orange}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{center}
% \hrulefill
%
% \subsection*{الزخرفة الخامسة: نمط النجمة المركزية}
% \begin{verbatim}
% \begin{tikzpicture}
%    \natikzornament{5}{purple}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{verbatim}
% \begin{center}
% \begin{tikzpicture}
%    \natikzornament{5}{purple}{0.6}
%    \draw[tile fill] (0,0) rectangle (4,3);
% \end{tikzpicture}
% \end{center}
% \section{شرح الأوامر والمحرك البرمجي}
% تتكون الحزمة من جزأين أساسيين: تحديد "بصمة" الزخرفة، ثم "تعبئة" الحيز بها.
%
% \subsection{الأمر \texttt{\textbackslash natikzornament}}
% يستخدم هذا الأمر لتحديد هوية الزخرفة التي ترغب في استخدامها، ويتطلب ثلاثة معاملات إجبارية:
% \begin{quote}
% \texttt{\textbackslash natikzornament\{#1\}\{#2\}\{#3\}}
% \end{quote}
% \begin{itemize}
%    \item \textbf{\texttt{#1} (رقم الزخرفة):} عدد صحيح من 1 إلى 34 يحدد شكل النمط.
%    \item \textbf{\texttt{#2} (اللون):} اسم اللون (مثل \texttt{blue}, \texttt{Red2}, \texttt{Gold1}). تدعم الحزمة ألوان \texttt{x11names}.
%    \item \textbf{\texttt{#3} (الشفافية):} قيمة عشرية من 0 إلى 1 (مثلاً 0.5 تعني شفافية بنسبة 50\%).
% \end{itemize}
% \textbf{ملاحظة:} هذا الأمر لا يرسم شيئاً بمفرده، بل يجهز "القالب" للخطوة التالية.
%
% \subsection{الخيار \texttt{tile fill}}
% هذا هو المحرك السحري الذي يقوم برصف القالب المختار داخل أي شكل هندسي في بيئة \texttt{tikzpicture}. 
% عند إضافة هذا الخيار لأي مسار (\texttt{path} أو \texttt{draw})، تقوم الحزمة بحساب أبعاد الشكل وتكرار الزخرفة داخله آلياً.
%
% \subsubsection*{مثال توضيحي:}
% \begin{verbatim}
% \begin{tikzpicture}
%    % 1. نجهز القالب (الزخرفة 11، لون أخضر، شفافية كاملة)
%    \natikzornament{11}{SpringGreen4}{1}
%    
%    % 2. نرسم الشكل ونطلب ملأه بالتبليط
%    \draw[tile fill, rounded corners=10pt] (0,0) rectangle (4,2);
% \end{tikzpicture}
% \end{verbatim}
%
% \subsection{تخصيص المظهر (اللون والثخانة)}
% \begin{itemize}
%    \item \textbf{تغيير اللون:} يتم مباشرة عبر المعامل الثاني كما سبق ذكره.
%    \item \textbf{التحكم في الثخانة:} الزخارف مصممة بثخانة افتراضية تناسب التبليط. إذا أردت تقليل الثخانة (جعل الخطوط أنحف)، يمكنك تغليف الرسم داخل بيئة \texttt{scope} وتمرير خيار \texttt{thin} أو \texttt{very thin}، مثال:
% \end{itemize}
% \begin{verbatim}
% \begin{scope}[very thin]
%    \natikzornament{1}{black}{0.4}
%    \filldraw[tile fill] (0,0) circle (1.5);
% \end{scope}
% \end{verbatim}
% \section{استخدام الزخارف كخلفية كاملة للورقة}
% يمكنك استخدام الحزمة لتزيين خلفية الصفحة بالكامل، وهذا مفيد جداً عند تصميم أغلفة المجلات أو أوراق العمل.
% يتم ذلك باستخدام حزمة \texttt{eso-pic} وربطها بأمر التبليط الخاص بحزمتنا.
%
% \subsection*{كود وضع زخرفة في كامل الخلفية:}
% ضع الكود التالي في الديباجة (Preamble) قبل \texttt{\textbackslash begin\{document\}}:
% 
% \begin{verbatim}
% \AddToShipoutPictureBG{%
%   \begin{tikzpicture}[remember picture, overlay]
%     % 1. نختار الزخرفة (مثلاً رقم 7) واللون والشفافية
%     \natikzornament{7}{blue!20}{0.5}
%     
%     % 2. نرسم مستطيلاً يغطي كامل أبعاد الصفحة ويملؤه التبليط
%     \draw[tile fill] (current page.north west) rectangle (current page.south east);
%   \end{tikzpicture}
% }
% \end{verbatim}
% 
% \textbf{توضيح الكود:}
% \begin{itemize}
%    \item \texttt{AddToShipoutPictureBG}: يضمن ظهور الزخرفة في خلفية جميع صفحات الملف.
%    \item \texttt{current page}: تجعل التيكنز يدرك حدود الورقة أياً كان حجمها (A4, A5, إلخ).
%    \item \texttt{tile fill}: هو المحرك الذي يكرر الزخرفة المختارة لتملأ كامل مساحة الورقة.
% \end{itemize}
%
% \StopEventually{\PrintIndex \PrintChanges}
%
% \iffalse
%<*package>
% \fi
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{na-tikzornament}[2026/05/14 v1.0 Na TikZ Ornaments with Tiling]
\RequirePackage[x11names,svgnames]{xcolor}
\RequirePackage{tikz}
\usetikzlibrary{shapes.geometric, calc}
\newcommand{\dicedotsNa}[1]{%
    \ifnum#1=1 \fill[black] (0.5,0.5) circle (0.11); \fi
    \ifnum#1=2 \fill[black] (0.2,0.2) circle (0.11) (0.8,0.8) circle (0.11); \fi
    \ifnum#1=3 \fill[black] (0.2,0.2) circle (0.11) (0.5,0.5) circle (0.11) (0.8,0.8) circle (0.11); \fi
    \ifnum#1=4 \fill[black] (0.2,0.2) circle (0.11) (0.2,0.8) circle (0.11) (0.8,0.2) circle (0.11) (0.8,0.8) circle (0.11); \fi
    \ifnum#1=5 \fill[black] (0.2,0.2) circle (0.11) (0.2,0.8) circle (0.11) (0.5,0.5) circle (0.11) (0.8,0.2) circle (0.11) (0.8,0.8) circle (0.11); \fi
    \ifnum#1=6 \fill[black] (0.2,0.2) circle (0.11) (0.2,0.5) circle (0.11) (0.2,0.8) circle (0.11) (0.8,0.2) circle (0.11) (0.8,0.5) circle (0.11) (0.8,0.8) circle (0.11); \fi
}

% --- مجموعة الزخارف (1-10) ---
\newcommand{\NaOrnaOne}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0, 60, ..., 300} { \begin{scope}[rotate=\a] \draw[line width=1.1pt, #3] (0.2,0) -- (0.8,0.3) -- (1.4,0) -- (0.8,-0.3) -- cycle; \draw[line width=0.5pt, #3, opacity=0.6] (0.2,0) -- (1.4,0); \fill[#3] (1.4,0) circle (1.5pt); \end{scope} } \foreach \r in {0.2, 0.35} { \draw[line width=1pt, #3, opacity=0.8] (0,0) circle (\r); } \fill[white] (0,0) circle (0.15); \draw[line width=1.2pt, #3] (0,0) circle (0.15); \end{scope}}
\newcommand{\NaOrnaTwo}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \r in {0, 45} { \draw[line width=1.3pt, #3, rotate=\r] (-1,-1) rectangle (1,1); } \draw[line width=1pt, #3] (0,0) circle (0.4); \foreach \x in {-1, 1} \foreach \y in {-1, 1} { \fill[#3] (\x,\y) circle (2.5pt); } \end{scope}}
\newcommand{\NaOrnaThree}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \r in {0, 45, ..., 315} { \begin{scope}[rotate=\r] \draw[line width=1.1pt, #3] (0.1,0) .. controls (0.5,0.6) and (1.2,0.6) .. (1.4,0); \draw[line width=1.1pt, #3] (0.1,0) .. controls (0.5,-0.6) and (1.2,-0.6) .. (1.4,0); \end{scope} } \end{scope}}
\newcommand{\NaOrnaFour}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \r in {0, 45} { \draw[line width=1.2pt, #3, rotate=\r] (-1,-1) rectangle (1,1); } \draw[line width=1pt, #3] (0,0) circle (0.7); \foreach \a in {0, 45, ..., 315} { \fill[#3] (\a:1.414) circle (2pt); } \end{scope}}
\newcommand{\NaOrnaFive}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \r in {0, 45} { \draw[line width=1.2pt, #3, rotate=\r] (-1,-1) rectangle (1,1); } \draw[line width=1.5pt, #3] (0,0) circle (0.5); \fill[#3] (0,0) circle (0.15); \end{scope}}
\newcommand{\NaOrnaSix}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0, 60, ..., 300} { \draw[line width=1.2pt, #3, rotate=\a] (0.2,0) -- (1.5,0.4) -- (1.1,0) -- (1.5,-0.4) -- cycle; } \fill[#3] (0,0) circle (1.5pt); \end{scope}}
\newcommand{\NaOrnaSeven}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0, 30, ..., 330} { \draw[line width=1pt, #3, rotate=\a] (0.3,0) .. controls (0.8,0.5) .. (1.4,0); \draw[line width=1pt, #3, rotate=\a] (0.3,0) .. controls (0.8,-0.5) .. (1.4,0); } \draw[line width=1.2pt, #3, double] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaEight}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0, 60, ..., 300} { \draw[line width=1.1pt, #3, rotate=\a] (0.2,0) -- (1.2,0.6) -- (1.2,-0.6) -- cycle; } \draw[line width=1pt, #3] (0,0) circle (0.4); \end{scope}}
\newcommand{\NaOrnaNine}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0, 45, ..., 315} { \draw[line width=1pt, #3, rotate=\a] (0.2,0) -- (1.5,0.2) -- (1.5,-0.2) -- cycle; } \draw[line width=1.2pt, #3, double] (0,0) circle (0.25); \end{scope}}
\newcommand{\NaOrnaTen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0, 60, ..., 300} { \draw[line width=1.2pt, #3, rotate=\a] (0.1,0) -- (1.3,0.5) -- (0.8,0.8) -- cycle; } \draw[line width=1pt, #3, fill=white] (0,0) circle (0.4); \end{scope}}

% --- 11. النرد الملون ---
\newcommand{\NaOrnaEleven}[3]{ \begin{scope}[shift={#1}, scale={#2*0.8}, rotate=25] \fill[#3] (0,0) rectangle (1,1); \dicedotsNa{5} \fill[#3!80!black] (0,1) -- (0.35,1.35) -- (1.35,1.35) -- (1,1) -- cycle; \begin{scope}[shift={(0,1)}, x={(0.35cm,0.35cm)}, y={(1cm,0cm)}] \dicedotsNa{6} \end{scope} \fill[#3!60!black] (1,0) -- (1.35,0.35) -- (1.35,1.35) -- (1,1) -- cycle; \begin{scope}[shift={(1,0)}, x={(0.35cm,0.35cm)}, y={(0cm,1cm)}] \dicedotsNa{3} \end{scope} \draw[black!40, thin] (0,0) rectangle (1,1) (0,1)--(0.35,1.35)--(1.35,1.35)--(1,1) (1,0)--(1.35,0.35)--(1.35,1.35); \end{scope} }

% --- الزخارف (12-20) ---
\newcommand{\NaOrnaTwelve}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,45,...,315} { \draw[#3, line width=1pt, rotate=\a] (0.2,0) -- (1.2,0) (1.2,0) circle (2pt); } \draw[#3, line width=1.2pt] (0,0) circle (0.2); \end{scope}}
\newcommand{\NaOrnaThirteen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1pt, rotate=\a] (0.3,0) -- (1,0.5) -- (1,-0.5) -- cycle; } \fill[#3] (0,0) circle (2pt); \end{scope}}
\newcommand{\NaOrnaFourteen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,90,...,270} { \draw[#3, line width=1.2pt, rotate=\a] (0.5,0.5) circle (0.4); } \draw[#3, fill=white] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaFifteen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,30,...,330} { \draw[#3, line width=0.8pt, rotate=\a] (0.4,0) -- (1.2,0.2); \draw[#3, line width=0.8pt, rotate=\a] (0.4,0) -- (1.2,-0.2); } \draw[#3, double] (0,0) circle (0.4); \end{scope}}
\newcommand{\NaOrnaSixteen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1pt, rotate=\a] (0.2,-0.2) rectangle (1.2,0.2); } \fill[#3] (0,0) circle (0.25); \end{scope}}
\newcommand{\NaOrnaSeventeen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,45,...,315} { \draw[#3, line width=1.1pt, rotate=\a] (0.3,0) .. controls (0.6,0.8) .. (1.2,0); } \draw[#3] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaEighteen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,120,240} { \draw[#3, line width=1.5pt, rotate=\a] (0,0.2) -- (1,1.2) -- (1,-1.2) -- cycle; } \draw[#3, fill=white] (0,0) circle (0.35); \end{scope}}
\newcommand{\NaOrnaNineteen}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1pt, rotate=\a] (0.2,0) -- (1.4,0) arc (0:180:0.2); } \fill[#3] (0,0) circle (0.2); \end{scope}}
\newcommand{\NaOrnaTwenty}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,45,...,315} { \draw[#3, line width=1pt, rotate=\a] (0.2,0) -- (1.3,0.4); \draw[#3, line width=1pt, rotate=\a] (0.2,0) -- (1.3,-0.4); } \draw[#3, fill=white, double] (0,0) circle (0.3); \end{scope}}

% --- الزخارف (21-29) ---
\newcommand{\NaOrnaTwentyOne}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1pt, rotate=\a] (0.3,0) -- (1.2,0); \draw[#3, line width=1pt, rotate=\a] (1.2,0) circle (3pt); \fill[#3, rotate=\a] (1.2,0) circle (1pt); } \end{scope}}
\newcommand{\NaOrnaTwentyTwo}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,90,...,270} { \draw[#3, line width=1.2pt, rotate=\a] (0.2,0.2) -- (1,0.2) -- (1,1) -- cycle; } \fill[#3] (0,0) circle (2.5pt); \end{scope}}
\newcommand{\NaOrnaTwentyThree}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,45,...,315} { \draw[#3, line width=1pt, rotate=\a] (0.4,0) arc (0:120:0.5); } \draw[#3, double] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaTwentyFour}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,72,...,288} { \draw[#3, line width=1pt, rotate=\a] (0,0.3) -- (0.8,1.2) -- (1.2,0.4) -- cycle; } \end{scope}}
\newcommand{\NaOrnaTwentyFive}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1pt, rotate=\a] (0.2,0) -- (1.4,0.6); \fill[#3, rotate=\a] (1.4,0.6) circle (2pt); } \draw[#3, fill=white] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaTwentySix}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,45,...,315} { \draw[#3, thin, rotate=\a] (0.2,0) -- (1.5,0); \draw[#3, line width=1.2pt, rotate=\a] (0.8,0) circle (4pt); } \end{scope}}
\newcommand{\NaOrnaTwentySeven}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,120,240} { \draw[#3, line width=2pt, rotate=\a] (0.3,0) -- (1.5,0); \draw[#3, line width=1pt, rotate=\a] (1.5,0) circle (5pt); } \end{scope}}
\newcommand{\NaOrnaTwentyEight}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1pt, rotate=\a] (0.2,0) .. controls (0.5,0.5) .. (1,0) .. controls (0.5,-0.5) .. (0.2,0); } \end{scope}}
\newcommand{\NaOrnaTwentyNine}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,90,...,270} { \draw[#3, line width=1.2pt, rotate=\a] (0.3,0) -- (1.2,0.8); \draw[#3, line width=1.2pt, rotate=\a] (0.3,0) -- (1.2,-0.8); } \end{scope}}

% --- الزخارف الإسلامية الجديدة (30-34) ---
\newcommand{\NaOrnaThirty}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,45,...,315} { \draw[#3, line width=1.2pt, rotate=\a] (0.2,0) -- (1.2,0.5) -- (1.2,-0.5) -- cycle; } \draw[#3, line width=1pt, double] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaThirtyOne}[3]{\begin{scope}[shift={#1}, scale=#2] \draw[#3, line width=1.3pt] (0:1) -- (90:1) -- (180:1) -- (270:1) -- cycle; \draw[#3, line width=1.3pt, rotate=45] (0:1) -- (90:1) -- (180:1) -- (270:1) -- cycle; \foreach \a in {0,45,...,315} { \fill[#3] (\a:1.1) circle (2pt); } \end{scope}}
\newcommand{\NaOrnaThirtyTwo}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,30,...,330} { \draw[#3, line width=1pt, rotate=\a] (0.2,0) .. controls (0.7,0.5) and (1.2,0.5) .. (1.5,0); \draw[#3, line width=1pt, rotate=\a] (0.2,0) .. controls (0.7,-0.5) and (1.2,-0.5) .. (1.5,0); } \fill[white, draw=#3] (0,0) circle (0.3); \end{scope}}
\newcommand{\NaOrnaThirtyThree}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,60,...,300} { \draw[#3, line width=1.2pt, rotate=\a] (0.3,0) -- (1.4,0.4) -- (1.4,-0.4) -- cycle; } \draw[#3, double] (0,0) circle (0.4); \end{scope}}
\newcommand{\NaOrnaThirtyFour}[3]{\begin{scope}[shift={#1}, scale=#2] \foreach \a in {0,90,180,270} { \draw[#3, line width=1.2pt, rotate=\a] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle; \draw[#3, line width=1pt, rotate=\a] (0.5,0.5) circle (0.4); } \end{scope}}

% --- محرك makeTile ---
\makeatletter
\newcommand{\natikzornament}[3]{%
  \sbox{\tilenaam}{%
    \begin{tikzpicture}[x=1cm,y=1cm]
      \clip (0,0) rectangle (2,2);
      \begin{scope}[opacity=#3]
          \foreach \x in {0,1} \foreach \y in {0,1} {
              \ifnum#1=1 \NaOrnaOne{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaOne{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=2 \NaOrnaTwo{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaTwo{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=3 \NaOrnaThree{(2*\x, 2*\y)}{0.45}{#2} \NaOrnaThree{(2*\x+1, 2*\y+1)}{0.45}{#2} \fi
              \ifnum#1=4 \NaOrnaFour{(2*\x, 2*\y)}{0.45}{#2} \NaOrnaFour{(2*\x+1, 2*\y+1)}{0.45}{#2} \fi
              \ifnum#1=5 \NaOrnaFive{(2*\x, 2*\y)}{0.45}{#2} \NaOrnaFive{(2*\x+1, 2*\y+1)}{0.45}{#2} \fi
              \ifnum#1=6 \NaOrnaSix{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaSix{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=7 \NaOrnaSeven{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaSeven{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=8 \NaOrnaEight{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaEight{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=9 \NaOrnaNine{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaNine{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=10 \NaOrnaTen{(2*\x, 2*\y)}{0.4}{#2} \NaOrnaTen{(2*\x+1, 2*\y+1)}{0.4}{#2} \fi
              \ifnum#1=11 \NaOrnaEleven{(2*\x-0.2, 2*\y-0.2)}{0.5}{Red2} \NaOrnaEleven{(2*\x+0.8, 2*\y+0.8)}{0.5}{Gold1} 
                          \NaOrnaEleven{(2*\x+0.8, 2*\y-0.2)}{0.5}{RoyalBlue1} \NaOrnaEleven{(2*\x-0.2, 2*\y+0.8)}{0.5}{SpringGreen3} \fi
              \ifnum#1=12 \NaOrnaTwelve{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwelve{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=13 \NaOrnaThirteen{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaThirteen{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=14 \NaOrnaFourteen{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaFourteen{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=15 \NaOrnaFifteen{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaFifteen{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=16 \NaOrnaSixteen{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaSixteen{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=17 \NaOrnaSeventeen{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaSeventeen{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=18 \NaOrnaEighteen{(2*\x, 2*\y)}{0.5}{#2} \NaOrnaEighteen{(2*\x+1, 2*\y+1)}{0.5}{#2} \fi
              \ifnum#1=19 \NaOrnaNineteen{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaNineteen{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=20 \NaOrnaTwenty{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwenty{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=21 \NaOrnaTwentyOne{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyOne{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=22 \NaOrnaTwentyTwo{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyTwo{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=23 \NaOrnaTwentyThree{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyThree{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=24 \NaOrnaTwentyFour{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyFour{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=25 \NaOrnaTwentyFive{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyFive{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=26 \NaOrnaTwentySix{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentySix{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=27 \NaOrnaTwentySeven{(2*\x, 2*\y)}{0.5}{#2} \NaOrnaTwentySeven{(2*\x+1, 2*\y+1)}{0.5}{#2} \fi
              \ifnum#1=28 \NaOrnaTwentyEight{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyEight{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=29 \NaOrnaTwentyNine{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaTwentyNine{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=30 \NaOrnaThirty{(2*\x, 2*\y)}{0.5}{#2} \NaOrnaThirty{(2*\x+1, 2*\y+1)}{0.5}{#2} \fi
              \ifnum#1=31 \NaOrnaThirtyOne{(2*\x, 2*\y)}{0.6}{#2} \NaOrnaThirtyOne{(2*\x+1, 2*\y+1)}{0.6}{#2} \fi
              \ifnum#1=32 \NaOrnaThirtyTwo{(2*\x, 2*\y)}{0.5}{#2} \NaOrnaThirtyTwo{(2*\x+1, 2*\y+1)}{0.5}{#2} \fi
              \ifnum#1=33 \NaOrnaThirtyThree{(2*\x, 2*\y)}{0.5}{#2} \NaOrnaThirtyThree{(2*\x+1, 2*\y+1)}{0.5}{#2} \fi
              \ifnum#1=34 \NaOrnaThirtyFour{(2*\x, 2*\y)}{0.5}{#2} \NaOrnaThirtyFour{(2*\x+1, 2*\y+1)}{0.5}{#2} \fi
          } 
      \end{scope}
    \end{tikzpicture}%
  }%
}
\@ifundefined{tilenaam}{\newsavebox{\tilenaam}}{}
% --- إضافة محرك الرصف لحزمة na-tikzornament ---
\newcommand{\naFillTile}{%
    % استخراج أبعاد المنطقة المراد ملؤها
    \pgfextractx{\pgf@x}{\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}{\pgfpointanchor{path picture bounding box}{north east}}}%
    \edef\pw{\the\pgf@x}%
    \pgfextracty{\pgf@y}{\pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}{\pgfpointanchor{path picture bounding box}{north east}}}%
    \edef\ph{\the\pgf@y}%
    % قياس أبعاد الزخرفة الخاصة بك (يفترض أن \tilenaam معرف في الحزمة)
    \pgfmathsetmacro{\tw}{\wd\tilenaam}%
    \pgfmathsetmacro{\th}{\ht\tilenaam + \dp\tilenaam}%
    % حساب التكرار
    \pgfmathsetmacro{\nx}{ceil(\pw/\tw)}%
    \pgfmathsetmacro{\ny}{ceil(\ph/\th)}%
    % تنفيذ التكرار
    \foreach \i in {0,...,\nx} {%
        \foreach \j in {0,...,\ny} {%
            \node[anchor=south west, inner sep=0pt] 
            at ([shift={(\i*\tw pt, \j*\th pt)}]path picture bounding box.south west) {\usebox{\tilenaam}};%
        }%
    }%
}

% تعريف الستايل داخل TikZ
\tikzset{
    tile fill/.style={
        path picture={\naFillTile}
    }
}
\makeatother
%    \end{macrocode}
% \iffalse
%</package>
% \fi
% \Finale
\endinput