From fd9ad582983939741a4c4fa5f2707f29365d6c09 Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Fri, 9 May 2008 23:06:28 +0000 Subject: soc-2008-mxcurioni: towards Freestyle compilation, removing Qt's QString and QImage dependencies. Up to this commit, the following directories compile well (and without any warning): system, image, geometry, graph, winged_edge, view_map, stroke. Modified code is commented by //soc and unused variables by //soc unused --- .../freestyle/intern/view_map/SteerableViewMap.cpp | 41 ++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'source/blender/freestyle/intern/view_map/SteerableViewMap.cpp') diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index b2604606aa7..3870edc2b75 100755 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -26,8 +26,12 @@ #include "../geometry/Geom.h" using namespace Geometry; -#include -#include +//soc #include +//soc #include +#include +#include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" +#include "intern/IMB_png.h" SteerableViewMap::SteerableViewMap(unsigned int nbOrientations){ _nbOrientations = nbOrientations; @@ -121,7 +125,7 @@ double * SteerableViewMap::AddFEdge(FEdge *iFEdge){ unsigned SteerableViewMap::getSVMNumber(const Vec2f& orient){ Vec2f dir(orient); - unsigned res = 0; + //soc unsigned res = 0; real norm = dir.norm(); if(norm < 1e-6){ return _nbOrientations+1; @@ -205,20 +209,37 @@ void SteerableViewMap::saveSteerableViewMap() const { } int ow = _imagesPyramids[i]->width(0); int oh = _imagesPyramids[i]->height(0); - QString base("SteerableViewMap"); - for(unsigned j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){ + + //soc QString base("SteerableViewMap"); + string base("SteerableViewMap"); + stringstream filename; + + for(int j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){ //soc float coeff = 1;//1/255.f; //100*255;//*pow(2,j); - QImage qtmp(ow, oh, QImage::Format_RGB32); - for(unsigned y=0;ypixel(x,y,j)); if(c>255) c=255; //int c = (int)(_imagesPyramids[i]->pixel(x,y,j)); - qtmp.setPixel(x,y,qRgb(c,c,c)); + + //soc qtmp.setPixel(x,y,qRgb(c,c,c)); + pix = (char*)ibuf->rect + y*rowbytes + x*4; + pix[0] = pix [1] = pix[2] = c; } } - qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG"); + + //soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG"); + filename << base; + filename << i << "-" << j << ".png"; + + imb_savepng(ibuf, const_cast(filename.str().c_str()), 0); + } // QString base("SteerableViewMap"); // for(unsigned j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){ -- cgit v1.2.3