You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.8 KiB
Plaintext

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fmodern\fcharset0 Courier;}}
{\colortbl ;\red0\green0\blue0;\red0\green0\blue255;\red136\green0\blue0;\red128\green128\blue128;\red0\green128\blue0;\red160\green0\blue160;}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\cf1\lang1033\f0\fs20 void\cf2\par
\cf3 resize\cf1 (\cf4 ppm_t\cf1 *\cf4 p\cf1 , \cf2 int\cf1 \cf4 nx\cf1 , \cf2 int\cf1 \cf4 ny\cf1 )\par
\{\par
\cf2 int\cf1 \cf4 x\cf1 , \cf4 y\cf1 ;\par
\cf2 float\cf1 \cf4 xs\cf1 = \cf4 p\cf1 ->\cf3 width\cf1 / (\cf2 float\cf1 )\cf4 nx\cf1 ;\tab\tab\tab\cf5 // Aufz\'e4hlen oder was\par
\cf1 \cf2 float\cf1 \cf4 ys\cf1 = \cf4 p\cf1 ->\cf4 height\cf1 / (\cf2 float\cf1 )\cf4 ny\cf1 ;\par
\cf2 ppm_t\cf1 \cf4 tmp\cf1 = \{0, 0, \cf6 NULL\cf1\};\par
\par
\cf3 ppm_new\cf1 (&\cf4 tmp\cf1 , \cf4 nx\cf1 , \cf4 ny\cf1 );\par
\cf2 for\cf1 (\cf4 y\cf1 = 0; \cf4 y\cf1 < \cf4 ny\cf1 ; \cf4 y\cf1 ++)\par
\{\par
\cf4 guchar\cf1 *\cf4 row\cf1 = \cf4 tmp\cf1 .\cf4 col\cf1 + \cf4 y\cf1 * \cf4 tmp\cf1 .\cf3 width\cf1 * 3\par
\par
\cf2 for\cf1 (\cf4 x\cf1 = 0; \cf4 x\cf1 < \cf4 nx\cf1 ; \cf4 x\cf1 ++)\par
\{\par
\cf3 get_rgb\cf1 (\cf4 p\cf1 , \cf4 x\cf1 * \cf4 xs\cf1 , \cf4 y\cf1 * \cf4 ys\cf1 , &\cf4 row\cf1 [\cf4 x\cf1 * \par
\}\par
\}\par
\cf3 ppm_kill\cf1 (\cf4 p\cf1 );\par
\cf4 p\cf1 ->\cf3 width\cf1 = \cf4 tmp\cf1 .\cf3 width\cf1 ;\par
\cf4 p\cf1 ->\cf4 height\cf1 = \cf4 tmp\cf1 .\cf4 height\cf1 ;\par
\cf4 p\cf1 ->\cf4 col\cf1 = \cf4 tmp\cf1 .\cf4 col\cf1 ;\par
\}\par
\par
\cf2 void\par
\cf3 rescale\cf1 (\cf4 ppm_t\cf1 *\cf4 p\cf1 , \cf2 double\cf1 \cf4 sc\cf1 )\par
\{\par
\cf3 resize\cf1 (\cf4 p\cf1 , \cf4 p\cf1 ->\cf3 width\cf1 * \cf4 sc\cf1 , \cf4 p\cf1 ->\cf4 height\cf1 * \cf4 sc\cf1 );\par
\}\par
\par
}