eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // ImageRasterizationImpl.h Image.Component package 00003 //============================================================================ 00004 // Usage : interface for image rasterization primitives implementation 00005 //---------------------------------------------------------------------------- 00006 // Copyright (C) 2007 by eLynx project 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 // See the GNU Library General Public License for more details. 00017 //---------------------------------------------------------------------------- 00018 #ifndef __ImageRasterizationImpl_h__ 00019 #define __ImageRasterizationImpl_h__ 00020 00021 #include <elx/image/IImageRasterization.h> 00022 #include <elx/math/Bezier.h> 00023 00024 namespace eLynx { 00025 namespace Image { 00026 00030 00031 template <class Pixel> 00032 class ExportedByImage ImageRasterizationImpl : public IImageRasterization 00033 { 00034 public: 00035 virtual bool Clear(AbstractImage& ioImage, 00036 uint32 iChannelMask) const; 00037 00038 virtual bool Plot(AbstractImage& ioImage, 00039 int32 iX, int32 iY, uint32 iChannelMask) const; 00040 00041 virtual bool DrawHLine(AbstractImage& ioImage, 00042 int32 iY, int32 iX1, int32 iX2, uint32 iChannelMask) const; 00043 00044 virtual bool DrawLine(AbstractImage& ioImage, 00045 int32 iX1, int32 iY1, int32 iX2, int32 iY2, 00046 bool ibAntialiasing, uint32 iChannelMask) const; 00047 00048 virtual bool DrawRectangle(AbstractImage& ioImage, 00049 int32 iX1, int32 iY1, int32 iX2, int32 iY2, 00050 bool ibSolid, uint32 iChannelMask) const; 00051 00052 virtual bool DrawEllipse(AbstractImage& ioImage, 00053 int32 iX, int32 iY, uint32 iRadiusX, uint32 iRadiusY, 00054 bool ibSolid, uint32 iChannelMask) const; 00055 00056 virtual bool DrawCircle(AbstractImage& ioImage, 00057 int32 iX, int32 iY, uint32 iRadius, 00058 bool ibSolid, uint32 iChannelMask) const; 00059 00060 virtual bool DrawTriangle(AbstractImage& ioImage, 00061 int32 iX0, int32 iY0, int32 iX1, int32 iY1, int32 iX2, int32 iY2, 00062 bool ibSolid, uint32 iChannelMask) const; 00063 00064 virtual bool Fill(AbstractImage& ioImage, 00065 int32 iX, int32 iY, uint32 iChannelMask) const; 00066 00067 virtual bool GetFilledBBox(const AbstractImage& iImage, 00068 int32 iX, int32 iY, Math::AOBBox2i& oBBox) const; 00069 00072 static bool Clear(ImageImpl<Pixel>& ioImage, 00073 const Pixel& iPixel, uint32 iChannelMask=CM_All); 00074 00075 static bool Plot(ImageImpl<Pixel>& ioImage, 00076 int32 iX, int32 iY, const Pixel& iPixel, uint32 iChannelMask=CM_All); 00077 00078 static bool DrawHLine(ImageImpl<Pixel>& ioImage, 00079 int32 iY, int32 iX1, int32 iX2, const Pixel& iPixel, uint32 iChannelMask=CM_All); 00080 00081 static bool DrawLine(ImageImpl<Pixel>& ioImage, 00082 int32 iX1, int32 iY1, int32 iX2, int32 iY2, const Pixel& iPixel, 00083 bool ibAntialiasing=false, uint32 iChannelMask=CM_All); 00084 00085 static bool DrawSpot(ImageImpl<Pixel>& ioImage, 00086 int32 iX, int32 iY, const Pixel& iPixel, int32 iSize=1, uint32 iChannelMask=CM_All); 00087 00088 static bool DrawRectangle(ImageImpl<Pixel>& ioImage, 00089 int32 iX1, int32 iY1, int32 iX2, int32 iY2, const Pixel& iPixel, 00090 bool ibSolid=false, uint32 iChannelMask=CM_All); 00091 00092 static bool DrawEllipse(ImageImpl<Pixel>& ioImage, 00093 int32 iX, int32 iY, uint32 iRadiusX, uint32 iRadiusY, const Pixel& iPixel, 00094 bool ibSolid=false, uint32 iChannelMask=CM_All); 00095 00096 static bool DrawCircle(ImageImpl<Pixel>& ioImage, 00097 int32 iX, int32 iY, uint32 iRadius, const Pixel& iPixel, 00098 bool ibSolid=false, uint32 iChannelMask=CM_All); 00099 00100 // Flat 00101 static bool DrawTriangle(ImageImpl<Pixel>& ioImage, 00102 int32 iX0, int32 iY0, int32 iX1, int32 iY1, int32 iX2, int32 iY2, 00103 const Pixel& iPixel, 00104 bool ibSolid=false, uint32 iChannelMask=CM_All); 00105 00106 // Flat textured 00107 static bool DrawTriangle(ImageImpl<Pixel>& ioImage, 00108 int32 iX0, int32 iY0, int32 iU0, int32 iV0, 00109 int32 iX1, int32 iY1, int32 iU1, int32 iV1, 00110 int32 iX2, int32 iY2, int32 iU2, int32 iV2, 00111 const ImageImpl<Pixel>& iTexture, uint32 iChannelMask=CM_All); 00112 00113 // Gouraud 00114 static bool DrawTriangle(ImageImpl<Pixel>& ioImage, 00115 int32 iX0, int32 iY0, const Pixel& iPixel0, 00116 int32 iX1, int32 iY1, const Pixel& iPixel1, 00117 int32 iX2, int32 iY2, const Pixel& iPixel2, 00118 uint32 iChannelMask=CM_All); 00119 00120 // Gouraud textured 00121 static bool DrawTriangle(ImageImpl<Pixel>& ioImage, 00122 int32 iX0, int32 iY0, int32 iU0, int32 iV0, const Pixel& iPixel0, 00123 int32 iX1, int32 iY1, int32 iU1, int32 iV1, const Pixel& iPixel1, 00124 int32 iX2, int32 iY2, int32 iU2, int32 iV2, const Pixel& iPixel2, 00125 const ImageImpl<Pixel>& iTexture, uint32 iChannelMask=CM_All); 00126 /* 00127 // Cubic Bezier 00128 static bool DrawTriangle(ImageImpl<Pixel>& ioImage, 00129 int32 iX0, int32 iY0, int32 iX1, int32 iY1, int32 iX2, int32 iY2, 00130 Math::BezierTriangle3<typename ResolutionTypeTraits<typename Pixel::type>::Floating_type, typename Pixel::FloatingPixel>& iBezier, 00131 uint32 iChannelMask=CM_All); 00132 */ 00133 static bool Fill(ImageImpl<Pixel>& ioImage, 00134 int32 iX, int32 iY, const Pixel& iPixel, uint32 iChannelMask=CM_All); 00135 00136 static bool GetFilledBBox(const ImageImpl<Pixel>& iImage, 00137 int32 iX, int32 iY, Math::AOBBox2i& oBBox); 00139 }; 00140 00141 } // namespace Image 00142 } // namespace eLynx 00143 00144 #endif // __ImageRasterizationImpl_h__