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