Ver código fonte

Added pattern for gray value transforms to tutorial 02

Clemens-A. Brust 11 anos atrás
pai
commit
4eb27af865
1 arquivos alterados com 19 adições e 0 exclusões
  1. 19 0
      core/tutorial/02_grayscale.md

+ 19 - 0
core/tutorial/02_grayscale.md

@@ -1 +1,20 @@
 # Tutorial 02 - Grayscale Image Operations
+
+## Pattern for gray value transforms
+
+You can use the following pattern for your gray value transforms.
+
+``` c++
+template <class P> void MyTransform(ImageT<P>& image)
+{
+	for(int x = 0; x < image.width(); x++) {
+		for(int y=0; y < image.height(); y++) {
+			P pixel = image.getPixelQuick(x, y);
+			// Insert transform here	
+			image.setPixelQuick(x, y, pixel);
+		}
+	}
+}
+```
+
+Note that the get/setPixelQuick Methods don't perform boundary checks!