From 62550a9dc5ec519553f58440c272690201440f48 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 20 Aug 2022 22:08:50 +0530 Subject: add all --- flake.nix | 4 +- meta.sty | 20 --- presentation.tex | 467 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 440 insertions(+), 51 deletions(-) delete mode 100644 meta.sty diff --git a/flake.nix b/flake.nix index 74ca45f..b9a0f9e 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ let supportedSystems = [ "x86_64-linux" "x86_64-darwin" ]; forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); - pname = "report"; + pname = "presentation"; version = "0.1.0"; nixpkgsFor = forAllSystems (system: @@ -31,7 +31,7 @@ -pvc \ -outdir="$out" \ -pdf \ - -pdflatex="pdflatex -interaction=nonstopmode" \ + -pdflatex="xelatex -interaction=nonstopmode" \ -use-make ${pname}.tex rm -r "$out" ''; diff --git a/meta.sty b/meta.sty deleted file mode 100644 index 961eb5f..0000000 --- a/meta.sty +++ /dev/null @@ -1,20 +0,0 @@ -\newcommand{\doctitle}{Presentation Title} -\newcommand{\ponename}{Akshay Oppiliappan} -\newcommand{\poneusn}{1RV18CS016} -\newcommand{\ptwoname}{Akshay Oppiliappan} -\newcommand{\ptwousn}{1RV18CS016} - -\newcommand{\semester}{X\textsuperscript{th}} - -\newcommand{\shortdept}{CSE} -\newcommand{\dept}{Computer Science} -\newcommand{\longdept}{Computer Science and Engineering} - -\newcommand{\faculty}{Faculty Name} -\newcommand{\facultypost}{Faculty Post} -\newcommand{\facultydept}{Computer Science and Engineering} -\newcommand{\hod}{Dr.Ramakanth Kumar P} -\newcommand{\principal}{Dr. Subramanya. K. N} -\newcommand{\coursecode}{18XXXX} -\newcommand{\csubject}{Subject Name} -\newcommand{\acyear}{20XX -- XX} diff --git a/presentation.tex b/presentation.tex index 328a2dd..f9b7dbd 100644 --- a/presentation.tex +++ b/presentation.tex @@ -1,47 +1,456 @@ \documentclass{beamer} \usepackage[utf8]{inputenc} -\usepackage{meta} +\usepackage{graphicx} +\usepackage{hyperref} +\usepackage{multirow} +\usepackage{amssymb} +\usepackage{amsmath} +\usepackage{fontspec} +\renewcommand{\thefootnote}{\fnsymbol{footnote}} + +\usefonttheme{professionalfonts} \usefonttheme{serif} -\title{\doctitle} -\author{\ponename{} (\poneusn)} -\institute[R V College of Engineering] -{ - Submitted To: \faculty{}\\ - \facultypost{} - \facultydept{} - \and - Self Study Assignment -} +\setmainfont{garamond-regular.ttf}[ + BoldFont = garamond-bold.ttf, + ItalicFont = garamond-italic.ttf, +] + +\setbeamertemplate{caption}{\insertcaption} -\setbeamerfont{author}{size=\fontsize{10}{10}\normalfont} +\title{Rust in Arts} +\author{Akshay Oppiliappan} +\date{} + +\setbeamerfont{author}{size=\fontsize{10}{10}\rmfamily} \setbeamerfont{institute}{size=\fontsize{10}{10}\itshape} \setbeamerfont{title}{size=\fontsize{25}{25}\bfseries} \setbeamerfont{subtitle}{size=\Large\normalfont\slshape} \setbeamerfont{minititle}{size=\fontsize{7}{7}\normalfont\bfseries} +\setbeamerfont{caption}{size=\scriptsize} -\setbeamertemplate{title page}{% - \usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle\\ - \usebeamerfont{subtitle}\usebeamercolor[fg]{institute}\csubject{} --- \coursecode{}\\ - \vspace{2cm} - \usebeamerfont{minititle}\usebeamercolor[fg]{normal text}SUBMITTED BY:\\ - \usebeamerfont{author}\usebeamercolor[fg]{author}\ponename{} (\poneusn{})\\ - \usebeamerfont{author}\usebeamercolor[fg]{author}\ptwoname{} (\ptwousn{})\\ - - \vspace{1cm} - \usebeamerfont{minititle}\usebeamercolor[fg]{normal text}SUBMITTED TO:\\ - \usebeamerfont{author}\usebeamercolor[fg]{author}\faculty{}\\ - \usebeamerfont{author}\usebeamercolor[fg]{author}\facultypost{}\\ - \usebeamerfont{author}\usebeamercolor[fg]{author}\facultydept{}\\ -} +\definecolor{LionRed}{rgb}{0.565, 0.130, 0.305} +\usecolortheme[named=LionRed]{structure} -\begin{document} +\setbeamertemplate{itemize items}[ball] -\frame{\titlepage} +\begin{document} \begin{frame} - \frametitle{Outline} + \begin{figure}[h] + \includegraphics[scale=0.3,trim={0 3cm 0 0},clip]{assets/ferris} + \end{figure} + \titlepage +\end{frame} + +\begin{frame}{\textbf{Colors and Computers}} + \begin{block}{} + \begin{columns} + \column{0.5\textwidth} + + \begin{itemize} + \item Images $\rightarrow$ Pixels + \item Pixels $\rightarrow$ Color + \item Color $\rightarrow$ RGB (or) CMYK + \item R $\rightarrow$ ???, G $\rightarrow$ ???, B $\rightarrow$ ??? + \end{itemize} + + \column{0.5\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.30,trim={0 0 0 1cm},clip]{assets/locus} + \label{fig:locus} + \caption{\textit{``Locus''}, Akshay, 2021} + \end{figure} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Colors and Computers}} + \begin{block}{} + \begin{columns} + \column{0.6\textwidth} + + \begin{itemize} + \item R $\rightarrow$ 0--255, G $\rightarrow$ 0--255, B $\rightarrow$ 0--255 + \item 8-bits/component, 24-bits/pixel + \item Bit depth: bits per pixel + \end{itemize} + \column{0.4\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.30,trim={0 0 0 1cm},clip]{assets/the_sect} + \label{fig:the_sect} + \caption{\textit{``The Sect''}, Akshay, 2021} + \end{figure} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Colors and Computers}} + \begin{block}{} + + \begin{columns} + \column{0.35\textwidth} + + \begin{itemize} + \item 1-bit/pixel + \item 0, 1 + \item on, off + \item black, white + \item ... + \end{itemize} + + \column{0.65\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.40,trim={0 2cm 0 1cm},clip]{assets/self} + \label{fig:self} + \caption{\textit{``Ceci n'est pas une self-reference''}, Akshay, 2021} + \end{figure} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{File Formats}} + \begin{block}{} + + \begin{columns} + \column{0.65\textwidth} + \begin{itemize} + \item Byte-arrays + \item Structured, for applications to read quickly + \item PNG file format: \texttt{IHDR}, \texttt{IDAT}, \texttt{IEND} + \end{itemize} + + \column{0.35\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.25,trim={10cm 9cm 6cm 9cm},clip]{assets/ramen_noodles} + \label{fig:ramen} + \caption{\textit{``Ramen Noodles''}, Akshay, 2021} + \end{figure} + + \end{columns} + \end{block} + \begin{block}{} + \end{block} +\end{frame} + +\begin{frame}{\textbf{File Formats}} + \begin{block}{} + \begin{center} + \begin{figure}[h] + \begin{tabular}{ r r r r | c c c c | r } + \hline + 0 & 0 & 0 & 0 & \multicolumn{4}{|c|}{\multirow{2}{*}{Image Header}} & \multirow{2}{*}{\texttt{0x05}} \\ + 0 & 1 & 0 & 1 & & & & & \\ \hline \hline + 0 & 0 & 0 & 0 & \square & \square & \square & \square & \multirow{5}{*}{\texttt{0x06 0x9F 0x87}} \\ + 0 & 1 & 1 & 0 & \square & \blacksquare & \blacksquare & \square \\ + 1 & 0 & 0 & 1 & \blacksquare & \square & \square & \blacksquare \\ + 1 & 1 & 1 & 1 & \blacksquare & \blacksquare & \blacksquare & \blacksquare \\ + 1 & 0 & 0 & 0 & \blacksquare & \square & \square & \square \\ + 0 & 1 & 1 & 1 & \square & \blacksquare & \blacksquare & \blacksquare \\ \hline \hline + 0 & 0 & 0 & 0 & \multicolumn{4}{|c|}{\multirow{2}{*}{Image Trailer}} & \multirow{2}{*}{\texttt{0x00}} \\ + 0 & 0 & 0 & 0 & & & & & \\ + \hline + \end{tabular} + \caption{The internals of the \textit{One Bit Image (OBI)} format} + \end{figure} + \end{center} + \end{block} +\end{frame} + +\begin{frame}[fragile]{\textbf{File Formats}} + \begin{block}{} + \begin{columns} + \column{0.65\textwidth} + \begin{itemize} + \item Implementation of the spec: \href{https://git.peppe.rs/graphics/obi/about}{git.peppe.rs/graphics/obi} + \item { + \begin{verbatim} +let mut img = + Image::new(30, 50); +img.set(2, 3, true)?; +img.set(3, 2, true)?; + \end{verbatim} + } + \end{itemize} + + \column{0.35\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.50]{assets/code} + \label{fig:code} + \caption{\textit{``Staple''}, Akshay, 2022} + \end{figure} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Making Pixel Art}} + \begin{block}{} + \begin{itemize} + \item SDL: Simple DirectMedia Layer is a cross-platform software development library designed to provide a hardware abstraction layer for computer multimedia hardware components + \item SDL: draw stuff to the screen, handle mouse/keyboard events + \end{itemize} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Making Pixel Art}} + \begin{figure}[h] + \includegraphics[scale=0.40]{assets/mvc} + \end{figure} +\end{frame} + +\begin{frame}{\textbf{Making Pixel Art}} + \begin{block}{} + \begin{columns} + \column{0.6\textwidth} + \begin{itemize} + \item Model: \\ + \texttt{zoom: u32} + \item View: \\ + Zoomed image + \item Controller: \\ + \texttt{|zoom| zoom + 1} + \end{itemize} + + \column{0.4\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.30]{assets/ivory_tower} + \label{fig:code} + \caption{\textit{``Ivory Tower''}, Akshay, 2022} + \end{figure} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Making Pixel Art}} + \begin{block}{} + \begin{itemize} + \item Model: Needs to be mutated, be static + \item Possible structure: \texttt{static mut STATE: AppState} + \item Possible structure: \texttt{Lazy>} + \end{itemize} + \end{block} +\end{frame} + +\begin{frame}[fragile]{\textbf{Making Pixel Art}} + \begin{verbatim} + fn main() -> Result<()> { + let mut app = AppState::new(); + app.main()?; + Ok(()) + } + + impl AppState { + fn undo(&mut self) { ... } + fn zoom(&mut self) { ... } + fn draw(&mut self) { ... } + ... + fn main(&mut self) { ... } + } + \end{verbatim} +\end{frame} + +\begin{frame}{\textbf{Ctrl-Z}} + \begin{block}{} + \begin{columns} + \column{0.65\textwidth} + \begin{itemize} + \item Mission critical + \item Tricky data-structure to get right + \item Drawing the process can help! + \end{itemize} + + \column{0.35\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.3,trim={1cm 2cm 0 4cm},clip]{assets/ember} + \label{fig:ember} + \caption{\textit{``Ember''}, Akshay, 2022} + \end{figure} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Ctrl-Z}} + \begin{figure}[h] + \includegraphics[scale=0.35]{assets/undo} + \end{figure} +\end{frame} + +\begin{frame}[fragile]{\textbf{Ctrl-Z}} + \begin{itemize} + \item Operations form an undo tree + \item Redos are overwritten by new operations + \item Simplified to a cursor over a timeline (two stacks!) + \item { + \begin{verbatim} +struct UndoStack { + sacred_timeline: Vec, + now: Option, +} + \end{verbatim} + } + \end{itemize} +\end{frame} + +\begin{frame}[fragile]{\textbf{Ctrl-Z}} + \begin{block}{} + \begin{columns} + \begin{column}{0.5\textwidth}{\textbf{Tests}} + + \begin{verbatim} +let ops: UndoStack = + UndoStack::new(); +ops.push(1u32); +ops.push(2u32); +ops.push(3u32); + +ops.undo(); + +assert_eq!(ops, [1, 2]); + \end{verbatim} + \end{column} + + \vrule{} + + \begin{column}{0.5\textwidth}{\textbf{Binary}} + \begin{verbatim} + + +struct AppState { + ... + ops: UndoStack, + ... +} + + + \end{verbatim} + \end{column} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}[fragile]{\textbf{Ctrl-Z}} + \begin{block}{} + \begin{columns} + \begin{column}{0.5\textwidth}{\textbf{Tests}} + \begin{verbatim} +struct UndoStackU32 { + sacred_timeline: + Vec, + now: Option +} + +let ops: UndoStackU32 = + UndoStackU32::new(); + +... + + \end{verbatim} + \end{column} + + \vrule{} + + \begin{column}{0.5\textwidth}{\textbf{Binary}} + \begin{verbatim} +struct UndoStackPaintRec { + sacred_timeline: + Vec, + now: Option +} + +struct AppState { + ... + ops: UndoStackPaintRec, + ... +} + \end{verbatim} + \end{column} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Dithering}} + \begin{block}{} + \begin{columns} + \begin{column}{0.5\textwidth} + \begin{itemize} + \item Stuck with black and white + \item Diffuse to produce shades + \item Ordered dithering + \end{itemize} + \end{column} + + \begin{column}{0.5\textwidth} + \begin{figure}[h] + \includegraphics[scale=0.30]{assets/b8} + \label{fig:b8} + \caption{\textit{``B8''}, Akshay, 2022} + \end{figure} + \end{column} + + \end{columns} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Dithering}} + \begin{block}{} + \begin{center} + \includegraphics[scale=0.30]{assets/memory} + \label{fig:memory} + \\ + \caption{\textit{``Scenes from a Memory''}, Akshay, 2022} + \end{center} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Dithering}} + \begin{block}{} + \begin{center} + \includegraphics[scale=0.75,trim={11cm 5cm 5cm 9cm},clip]{assets/memory} + \label{fig:memory} + \\ + \caption{A closer look at \textit{``Scenes from a Memory''}} + \end{center} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Sixteen Shades}} + \begin{block}{} + \begin{center} + \includegraphics[scale=0.6]{assets/bayer} + \label{fig:bayers} + \\ + \caption{Bayers' matrices} + \end{center} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Sixteen Shades}} + \begin{block}{} + \begin{center} + \includegraphics[scale=0.6]{assets/rylander} + \label{fig:rylander} + \\ + \caption{Rylanders' matrices} + \end{center} + \end{block} +\end{frame} + +\begin{frame}{\textbf{Warm Regards}} + \begin{itemize} + \item Akshay Oppiliappan, Language Engineer (Rust), DeepSource + \item E-mail: \texttt{nerdy@peppe.rs} + \item Made with \LaTeX~and beamer + \item Slides: \url{https://u.peppe.rs/ria.pdf} + \end{itemize} \end{frame} \end{document} -- cgit v1.2.3