// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // This class provides a 2D iterator for an image. #pragma once #include "frantic/graphics2d/strideiterator.hpp" #include namespace frantic { namespace graphics2d { template class framebuffer; template class framebufferiterator : public strideiterator { public: framebufferiterator( framebuffer* img, int borderWidth = 0, int borderHeight = 0 ); void print( std::string header = "framebufferiterator info" ) const; private: framebuffer* _img; }; } // namespace graphics2d } // namespace frantic #include "frantic/graphics2d/framebuffer.hpp" namespace frantic { namespace graphics2d { template framebufferiterator::framebufferiterator( framebuffer* img, int borderWidth, int borderHeight ) : strideiterator( &( img->data() ), img->xsize(), img->ysize(), borderWidth, borderHeight ) { assert( img != NULL ); _img = img; } template void framebufferiterator::print( std::string header ) const { std::cout << header << ":" << std::endl; std::cout << "\tframebuffer addr: " << std::hex << _img << std::dec << std::endl; std::cout << "\t\tDimensions: ( " << _img->width() << ", " << _img->height() << " )" << std::endl; strideiterator::print(); } } // namespace graphics2d } // namespace frantic