1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef IMAGETESTHANDLER_H 18 #define IMAGETESTHANDLER_H 19 20 #include "vec2.h" 21 #include "vec3.h" 22 23 class ImageTestHandler{ 24 public: 25 ImageTestHandler() { 26 initDebugImage(); 27 } 28 ImageTestHandler(int debugHeight, int debugWidth) { 29 initDebugImage(debugHeight, debugWidth); 30 } 31 virtual ~ImageTestHandler() { delete[] mDebugOutput; } 32 33 virtual void processData() {} 34 35 int getDebugWidth() const { return mDebugWidth; } 36 int getDebugHeight() const { return mDebugHeight; } 37 const unsigned char* debug_output() const { return mDebugOutput; } 38 void copyDebugImage(int inputHeight, int inputWidth, 39 const unsigned char* inputImage); 40 41 void drawPoint(const Vec2i &point, const Vec3i &color); 42 void drawPoint(int row, int column, const Vec3i &color); 43 void drawLine(int angle, int radius, const Vec3i &color); 44 45 protected: 46 void clearDebugImage(); 47 48 private: 49 void initDebugImage(); 50 void initDebugImage(int debugHeight, int debugWidth); 51 52 unsigned char* mDebugOutput; 53 int mDebugWidth; 54 int mDebugHeight; 55 }; 56 57 #endif 58