本文整理汇总了C++中TRasterCM32P类的典型用法代码示例。如果您正苦于以下问题:C++ TRasterCM32P类的具体用法?C++ TRasterCM32P怎么用?C++ TRasterCM32P使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TRasterCM32P类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inkFill
void inkFill(const TRasterCM32P &r, const TPoint &pin, int ink, int searchRay,
TTileSaverCM32 *saver, TRect *insideRect)
{
r->lock();
TPixelCM32 *pixels = (TPixelCM32 *)r->getRawData();
int oldInk;
TPoint p = pin;
if ((pixels + p.y * r->getWrap() + p.x)->isPurePaint() && (searchRay == 0 ||
(p = nearestInk(r, p, searchRay)) == TPoint(-1, -1))) {
r->unlock();
return;
}
TPixelCM32 *pix = pixels + (p.y * r->getWrap() + p.x);
if (pix->getInk() == ink) {
r->unlock();
return;
}
oldInk = pix->getInk();
std::stack<TPoint> seeds;
seeds.push(p);
while (!seeds.empty()) {
p = seeds.top();
seeds.pop();
if (!r->getBounds().contains(p))
continue;
if (insideRect && !insideRect->contains(p))
continue;
TPixelCM32 *pix = pixels + (p.y * r->getWrap() + p.x);
if (pix->isPurePaint() || pix->getInk() != oldInk)
continue;
if (saver)
saver->save(p);
pix->setInk(ink);
seeds.push(TPoint(p.x - 1, p.y - 1));
seeds.push(TPoint(p.x - 1, p.y));
seeds.push(TPoint(p.x - 1, p.y + 1));
seeds.push(TPoint(p.x, p.y - 1));
seeds.push(TPoint(p.x, p.y + 1));
seeds.push(TPoint(p.x + 1, p.y - 1));
seeds.push(TPoint(p.x + 1, p.y));
seeds.push(TPoint(p.x + 1, p.y + 1));
}
r->unlock();
}
示例2: checkSegments
//! Elimina i segmenti che non sono contenuti all'interno dello stroke!!!
void checkSegments(std::vector<TAutocloser::Segment> &segments,
TStroke *stroke, const TRasterCM32P &ras,
const TPoint &delta) {
TVectorImage vi;
TStroke *app = new TStroke();
*app = *stroke;
app->transform(TTranslation(convert(ras->getCenter())));
vi.addStroke(app);
vi.findRegions();
std::vector<TAutocloser::Segment>::iterator it = segments.begin();
for (; it < segments.end(); it++) {
if (it == segments.end()) break;
int i;
bool isContained = false;
for (i = 0; i < (int)vi.getRegionCount(); i++) {
TRegion *reg = vi.getRegion(i);
if (reg->contains(convert(it->first + delta)) &&
reg->contains(convert(it->second + delta))) {
isContained = true;
break;
}
}
if (!isContained) {
it = segments.erase(it);
if (it != segments.end() && it != segments.begin())
it--;
else if (it == segments.end())
break;
}
}
}
示例3: InkSegmenter
InkSegmenter(const TRasterCM32P &r, float growFactor, TTileSaverCM32 *saver)
: m_r(r)
, m_lx(r->getLx())
, m_ly(r->getLy())
, m_wrap(r->getWrap())
, m_buf((TPixelCM32 *)r->getRawData())
, m_bBox(r->getBounds())
, m_saver(saver)
, m_growFactor(growFactor) {
m_displaceVector[0] = -m_wrap - 1;
m_displaceVector[1] = -m_wrap;
m_displaceVector[2] = -m_wrap + 1;
m_displaceVector[3] = -1;
m_displaceVector[4] = +1;
m_displaceVector[5] = m_wrap - 1;
m_displaceVector[6] = m_wrap;
m_displaceVector[7] = m_wrap + 1;
}
示例4:
void Convert2Tlv::buildInksFromGrayTones(TRasterCM32P &rout, const TRasterP &rin)
{
int i, j;
TRasterGR8P r8 = (TRasterGR8P)rin;
TRaster32P r32 = (TRaster32P)rin;
if (r8)
for (i = 0; i < rin->getLy(); i++) {
TPixelGR8 *pixin = r8->pixels(i);
TPixelCM32 *pixout = rout->pixels(i);
for (j = 0; j < rin->getLx(); j++, pixin++, pixout++)
*pixout = TPixelCM32(1, 0, pixin->value);
}
else
for (i = 0; i < rin->getLy(); i++) {
TPixel *pixin = r32->pixels(i);
TPixelCM32 *pixout = rout->pixels(i);
for (j = 0; j < rin->getLx(); j++, pixin++, pixout++)
*pixout = TPixelCM32(1, 0, TPixelGR8::from(*pixin).value);
}
}
示例5: buildLayers
// Copies the cmIn paint and ink colors to the output rasters.
void buildLayers(const TRasterCM32P &cmIn,
const std::vector<TPixel32> &palColors, TRaster32P &inkRaster,
TRaster32P &paintRaster) {
// Separate cmIn by copying the ink & paint colors directly to the layer
// rasters.
TPixelCM32 *cmPix, *cmBegin = (TPixelCM32 *)cmIn->getRawData();
TPixel32 *inkPix = (TPixel32 *)inkRaster->getRawData();
TPixel32 *paintPix = (TPixel32 *)paintRaster->getRawData();
unsigned int i, j, lx = cmIn->getLx(), ly = cmIn->getLy(),
wrap = cmIn->getWrap();
for (i = 0; i < ly; ++i) {
cmPix = cmBegin + i * wrap;
for (j = 0; j < lx; ++j, ++cmPix, ++inkPix, ++paintPix) {
*inkPix = palColors[cmPix->getInk()];
*paintPix = palColors[cmPix->getPaint()];
// Should pure colors be checked...?
}
}
}
示例6: isFlatNeighbourhood
// Returns true or false whether the selectedColor is the only selectable color
// in the neighbourhood. If so, the blend copies it to the output layer pixel
// directly.
inline bool isFlatNeighbourhood(int selectedColor, const TRasterCM32P &cmIn,
const TPoint &pos,
const SelectionRaster &selRas,
const BlurPattern &blurPattern) {
TPixelCM32 &pix = cmIn->pixels(pos.y)[pos.x];
int lx = cmIn->getLx(), ly = cmIn->getLy();
unsigned int xy;
TPoint samplePix;
const TPoint *samplePoint =
blurPattern.m_samples.empty() ? 0 : &blurPattern.m_samples[0];
// Read the samples to determine if they only have posSelectedColor
unsigned int i, samplesCount = blurPattern.m_samples.size();
for (i = 0; i < samplesCount; ++i, ++samplePoint) {
// Make sure the sample is inside the image
samplePix.x = pos.x + samplePoint->x;
samplePix.y = pos.y + samplePoint->y;
xy = samplePix.x + lx * samplePix.y;
if (samplePix.x < 0 || samplePix.y < 0 || samplePix.x >= lx ||
samplePix.y >= ly)
continue;
if (!selRas.isPurePaint(xy) && selRas.isSelectedInk(xy))
if (cmIn->pixels(samplePix.y)[samplePix.x].getInk() != selectedColor)
return false;
if (!selRas.isPureInk(xy) && selRas.isSelectedPaint(xy))
if (cmIn->pixels(samplePix.y)[samplePix.x].getPaint() != selectedColor)
return false;
}
return true;
}
示例7: fillautoInks
//-----------------------------------------------------------------------------
// questa funzione viene chiamata dopo il fill rect delle aree, e colora gli
// inchiostri di tipo "autoink"
// che confinano con le aree appena fillate con il rect. rbefore e' il rect del
// raster prima del rectfill.
void fillautoInks(TRasterCM32P &rin, TRect &rect, const TRasterCM32P &rbefore,
TPalette *plt) {
assert(plt);
TRasterCM32P r = rin->extract(rect);
assert(r->getSize() == rbefore->getSize());
int i, j;
for (i = 0; i < r->getLy(); i++) {
TPixelCM32 *pix = r->pixels(i);
TPixelCM32 *pixb = rbefore->pixels(i);
for (j = 0; j < r->getLx(); j++, pix++, pixb++) {
int paint = pix->getPaint();
int tone = pix->getTone();
int ink = pix->getInk();
if (paint != pixb->getPaint() && tone > 0 && tone < 255 && ink != paint &&
plt->getStyle(ink)->getFlags() != 0)
inkFill(rin, TPoint(j, i) + rect.getP00(), paint, 0, NULL, &rect);
}
}
}
示例8: updateSelection
void SelectionRaster::updateSelection(TRasterCM32P cm,
const BlendParam ¶m) {
// Make a hard copy of color indexes. We do so since we absolutely prefer
// having them SORTED!
std::vector<int> cIndexes = param.colorsIndexes;
std::sort(cIndexes.begin(), cIndexes.end());
unsigned int lx = cm->getLx(), ly = cm->getLy(), wrap = cm->getWrap();
// Scan each cm pixel, looking if its ink or paint is in param's colorIndexes.
cm->lock();
TPixelCM32 *pix, *pixBegin = (TPixelCM32 *)cm->getRawData();
SelectionData *selData = data();
const int *v =
&cIndexes[0]; // NOTE: cIndexes.size() > 0 due to external check.
unsigned int vSize = cIndexes.size();
unsigned int i, j;
// NOTE: It seems that linear searches are definitely best for small color
// indexes.
if (vSize > 50) {
for (i = 0; i < ly; ++i) {
pix = pixBegin + i * wrap;
for (j = 0; j < lx; ++j, ++pix, ++selData) {
selData->m_selectedInk = binarySearch(v, vSize, pix->getInk());
selData->m_selectedPaint = binarySearch(v, vSize, pix->getPaint());
}
}
} else {
for (i = 0; i < ly; ++i) {
pix = pixBegin + i * wrap;
for (j = 0; j < lx; ++j, ++pix, ++selData) {
selData->m_selectedInk = linearSearch(v, vSize, pix->getInk());
selData->m_selectedPaint = linearSearch(v, vSize, pix->getPaint());
}
}
}
cm->unlock();
}
示例9: data
SelectionRaster::SelectionRaster(TRasterCM32P cm) {
unsigned int lx = cm->getLx(), ly = cm->getLy(), wrap = cm->getWrap();
unsigned int size = lx * ly;
m_wrap = lx;
m_selection.allocate(size);
cm->lock();
TPixelCM32 *pix, *pixBegin = (TPixelCM32 *)cm->getRawData();
SelectionData *selData = data();
unsigned int i, j;
for (i = 0; i < ly; ++i) {
pix = pixBegin + i * wrap;
for (j = 0; j < lx; ++j, ++pix, ++selData) {
selData->m_pureInk = pix->getTone() == 0;
selData->m_purePaint = pix->getTone() == 255;
}
}
cm->unlock();
}
示例10: TVectorImage
void OutlineVectorizer::makeDataRaster(const TRasterP &src)
{
m_vimage = new TVectorImage();
if (!src)
return;
m_src = src;
clearNodes();
clearJunctions();
int x, y, ii = 0;
TRaster32P srcRGBM = (TRaster32P)m_src;
TRasterCM32P srcCM = (TRasterCM32P)m_src;
TRasterGR8P srcGR = (TRasterGR8P)m_src;
// Inizializzo DataRasterP per i casi in cui si ha un TRaster32P, un TRasterGR8P o un TRasterCM32P molto grande
DataRasterP dataRaster(m_src->getSize().lx + 2, m_src->getSize().ly + 2);
if (srcRGBM || srcGR || (srcCM && srcCM->getLx() * srcCM->getLy() > 5000000)) {
int ly = dataRaster->getLy();
int lx = dataRaster->getLx();
int wrap = dataRaster->getWrap();
DataPixel *dataPix0 = dataRaster->pixels(0);
DataPixel *dataPix1 = dataRaster->pixels(0) + m_src->getLx() + 1;
for (y = 0; y < ly; y++, dataPix0 += wrap, dataPix1 += wrap) {
dataPix0->m_pos.x = 0;
dataPix1->m_pos.x = lx - 1;
dataPix0->m_pos.y = dataPix1->m_pos.y = y;
dataPix0->m_value = dataPix1->m_value = 0;
dataPix0->m_ink = dataPix1->m_ink = false;
dataPix0->m_node = dataPix1->m_node = 0;
}
dataPix0 = dataRaster->pixels(0);
dataPix1 = dataRaster->pixels(ly - 1);
for (x = 0; x < lx; x++, dataPix0++, dataPix1++) {
dataPix0->m_pos.x = dataPix1->m_pos.x = x;
dataPix0->m_pos.y = 0;
dataPix1->m_pos.y = ly - 1;
dataPix0->m_value = dataPix1->m_value = 0;
dataPix0->m_ink = dataPix1->m_ink = false;
dataPix0->m_node = dataPix1->m_node = 0;
}
}
if (srcRGBM) {
assert(m_palette);
int inkId = m_palette->getClosestStyle(m_configuration.m_inkColor);
if (!inkId || m_configuration.m_inkColor != m_palette->getStyle(inkId)->getMainColor()) {
inkId = m_palette->getStyleCount();
m_palette->getStylePage(1)->insertStyle(1, m_configuration.m_inkColor);
m_palette->setStyle(inkId, m_configuration.m_inkColor);
}
assert(inkId);
m_dataRasterArray.push_back(std::pair<int, DataRasterP>(inkId, dataRaster));
int maxDistance2 = m_configuration.m_threshold * m_configuration.m_threshold;
for (y = 0; y < m_src->getLy(); y++) {
TPixel32 *inPix = srcRGBM->pixels(y);
TPixel32 *inEndPix = inPix + srcRGBM->getLx();
DataPixel *dataPix = dataRaster->pixels(y + 1) + 1;
x = 0;
while (inPix < inEndPix) {
*dataPix = DataPixel();
int distance2 = colorDistance2(m_configuration.m_inkColor, *inPix);
if (y == 0 || y == m_src->getLy() - 1 || x == 0 || x == m_src->getLx() - 1 || inPix->m == 0) {
dataPix->m_value = 255;
dataPix->m_ink = false;
} else {
dataPix->m_value = (inPix->r + 2 * inPix->g + inPix->b) >> 2;
dataPix->m_ink = (distance2 < maxDistance2);
}
dataPix->m_pos.x = x++;
dataPix->m_pos.y = y;
dataPix->m_node = 0;
inPix++;
dataPix++;
}
}
} else if (srcGR) {
示例11: doBlend
// Performs a single color blending. This function can be repeatedly invoked to
// perform multiple color blending.
inline void doBlend(const TRasterCM32P &cmIn, RGBMRasterPair &inkLayer,
RGBMRasterPair &paintLayer, const SelectionRaster &selRas,
const std::vector<BlurPattern> &blurPatterns) {
// Declare some vars
unsigned int blurPatternsCount = blurPatterns.size();
int lx = cmIn->getLx(), ly = cmIn->getLy();
double totalFactor;
TPixelCM32 *cmPix, *cmBegin = (TPixelCM32 *)cmIn->getRawData();
TPixel32 *inkIn = (TPixel32 *)inkLayer.first->getRawData(),
*inkOut = (TPixel32 *)inkLayer.second->getRawData(),
*paintIn = (TPixel32 *)paintLayer.first->getRawData(),
*paintOut = (TPixel32 *)paintLayer.second->getRawData();
const BlurPattern *blurPattern, *blurPatternsBegin = &blurPatterns[0];
bool builtSamples = false;
DoubleRGBMPixel samplesSum;
// For every cmIn pixel
TPoint pos;
SelectionData *selData = selRas.data();
cmPix = cmBegin;
for (pos.y = 0; pos.y < ly;
++pos.y, cmPix = cmBegin + pos.y * cmIn->getWrap())
for (pos.x = 0; pos.x < lx; ++pos.x, ++inkIn, ++inkOut, ++paintIn,
++paintOut, ++selData, ++cmPix) {
blurPattern = blurPatternsBegin + (rand() % blurPatternsCount);
// Build the ink blend color
if (!selData->m_purePaint && selData->m_selectedInk) {
if (!builtSamples) {
// Build samples contributes
totalFactor = 1.0;
samplesSum.r = samplesSum.g = samplesSum.b = samplesSum.m = 0.0;
if (!isFlatNeighbourhood(cmPix->getInk(), cmIn, pos, selRas,
*blurPattern))
addSamples(cmIn, pos, inkLayer.first, paintLayer.first, selRas,
*blurPattern, samplesSum, totalFactor);
builtSamples = true;
}
// Output the blended pixel
inkOut->r = (samplesSum.r + inkIn->r) / totalFactor;
inkOut->g = (samplesSum.g + inkIn->g) / totalFactor;
inkOut->b = (samplesSum.b + inkIn->b) / totalFactor;
inkOut->m = (samplesSum.m + inkIn->m) / totalFactor;
} else {
// If the color is not blended, then just copy the old layer pixel
*inkOut = *inkIn;
}
// Build the paint blend color
if (!selData->m_pureInk && selData->m_selectedPaint) {
if (!builtSamples) {
// Build samples contributes
totalFactor = 1.0;
samplesSum.r = samplesSum.g = samplesSum.b = samplesSum.m = 0.0;
if (!isFlatNeighbourhood(cmPix->getPaint(), cmIn, pos, selRas,
*blurPattern))
addSamples(cmIn, pos, inkLayer.first, paintLayer.first, selRas,
*blurPattern, samplesSum, totalFactor);
builtSamples = true;
}
// Output the blended pixel
paintOut->r = (samplesSum.r + paintIn->r) / totalFactor;
paintOut->g = (samplesSum.g + paintIn->g) / totalFactor;
paintOut->b = (samplesSum.b + paintIn->b) / totalFactor;
paintOut->m = (samplesSum.m + paintIn->m) / totalFactor;
} else {
// If the color is not blended, then just copy the old layer pixel
*paintOut = *paintIn;
}
builtSamples = false;
}
}
示例12: addSamples
// Calculates the estimate of blend selection in the neighbourhood specified by
// blurPattern.
inline void addSamples(const TRasterCM32P &cmIn, const TPoint &pos,
const TRaster32P &inkRas, const TRaster32P &paintRas,
const SelectionRaster &selRas,
const BlurPattern &blurPattern, DoubleRGBMPixel &pixSum,
double &factorsSum) {
double inkFactor, paintFactor;
unsigned int xy, j, l;
int lx = cmIn->getLx(), ly = cmIn->getLy();
TPixel32 *color;
TPoint samplePos, pathPos;
const TPoint *samplePoint =
blurPattern.m_samples.empty() ? 0 : &blurPattern.m_samples[0];
const TPoint *pathPoint;
unsigned int i, blurSamplesCount = blurPattern.m_samples.size();
for (i = 0; i < blurSamplesCount; ++i, ++samplePoint) {
// Add each samples contribute to the sum
samplePos.x = pos.x + samplePoint->x;
samplePos.y = pos.y + samplePoint->y;
if (samplePos.x < 0 || samplePos.y < 0 || samplePos.x >= lx ||
samplePos.y >= ly)
continue;
// Ensure that each pixel on the sample's path (if any) is selected
l = blurPattern.m_samplePaths[i].size();
pathPoint = blurPattern.m_samplePaths[i].empty()
? 0
: &blurPattern.m_samplePaths[i][0];
for (j = 0; j < l; ++j, ++pathPoint) {
pathPos.x = pos.x + pathPoint->x;
pathPos.y = pos.y + pathPoint->y;
xy = pathPos.x + lx * pathPos.y;
if (!(selRas.isPurePaint(xy) || selRas.isSelectedInk(xy))) break;
if (!(selRas.isPureInk(xy) || selRas.isSelectedPaint(xy))) break;
}
if (j < l) continue;
xy = samplePos.x + lx * samplePos.y;
if (selRas.isSelectedInk(xy) && !selRas.isPurePaint(xy)) {
getFactors(cmIn->pixels(samplePos.y)[samplePos.x].getTone(), inkFactor,
paintFactor);
color = &inkRas->pixels(samplePos.y)[samplePos.x];
pixSum.r += inkFactor * color->r;
pixSum.g += inkFactor * color->g;
pixSum.b += inkFactor * color->b;
pixSum.m += inkFactor * color->m;
factorsSum += inkFactor;
}
if (selRas.isSelectedPaint(xy) && !selRas.isPureInk(xy)) {
getFactors(cmIn->pixels(samplePos.y)[samplePos.x].getTone(), inkFactor,
paintFactor);
color = &paintRas->pixels(samplePos.y)[samplePos.x];
pixSum.r += paintFactor * color->r;
pixSum.g += paintFactor * color->g;
pixSum.b += paintFactor * color->b;
pixSum.m += paintFactor * color->m;
factorsSum += paintFactor;
}
}
}
示例13: over
void TRop::over(TRasterP rout, const TRasterCM32P &rup, TPalette *palette, const TPoint &point, const TAffine &aff)
{
TRaster32P app(rup->getSize());
TRop::convert(app, rup, palette);
TRop::over(rout, app, point, aff);
}
示例14: assert
void Convert2Tlv::buildToonzRaster(TRasterCM32P &rout, const TRasterP &rin1, const TRasterP &rin2)
{
if (rin2)
assert(rin1->getSize() == rin2->getSize());
rout->clear();
std::cout << " computing inks...\n";
TRaster32P r1 = (TRaster32P)rin1;
TRasterGR8P r1gr = (TRasterGR8P)rin1;
TRaster32P r2 = (TRaster32P)rin2;
TRasterGR8P r2gr = (TRasterGR8P)rin2;
TRasterP rU, rP;
if (r1gr) {
rU = r1gr;
rP = r2;
} else if (r2gr) {
rU = r2gr;
rP = r1;
} else if (!r1)
rU = r2;
else if (!r2)
rU = r1;
else if (firstIsUnpainted(r1, r2)) {
rU = r1;
rP = r2;
} else {
rU = r2;
rP = r1;
}
TRasterCM32P r;
if (rout->getSize() != rU->getSize()) {
int dx = rout->getLx() - rU->getLx();
int dy = rout->getLy() - rU->getLy();
assert(dx >= 0 && dy >= 0);
r = rout->extract(dx / 2, dy / 2, dx / 2 + rU->getLx() - 1, dy / 2 + rU->getLy() - 1);
} else
r = rout;
if ((TRasterGR8P)rU)
buildInksFromGrayTones(r, rU);
else if (m_isUnpaintedFromNAA)
buildInksForNAAImage(r, (TRaster32P)rU);
else {
int maxMatte = getMaxMatte((TRaster32P)rU);
if (maxMatte == -1)
buildInksFromGrayTones(r, rU);
else {
if (maxMatte < 255)
normalize(rU, maxMatte);
buildInks(r, (TRaster32P)rU /*rP,*/);
}
}
if (m_autoclose)
TAutocloser(r, AutocloseDistance, AutocloseAngle, 1, AutocloseOpacity).exec();
if (rP) {
std::cout << " computing paints...\n";
doFill(r, rP);
}
if (m_antialiasType == 2) //remove antialias
removeAntialias(r);
else if (m_antialiasType == 1) //add antialias
{
TRasterCM32P raux(r->getSize());
TRop::antialias(r, raux, 10, m_antialiasValue);
rout = raux;
}
}
示例15: findNearestColor
void Convert2Tlv::doFill(TRasterCM32P &rout, const TRaster32P &rin)
{
//prima passata: si filla solo partendo da pixel senza inchiostro, senza antialiasing(tone==255)
for (int i = 0; i < rin->getLy(); i++) {
TPixel *pixin = rin->pixels(i);
TPixelCM32 *pixout = rout->pixels(i);
for (int j = 0; j < rin->getLx(); j++, pixin++, pixout++) {
if (!(pixout->getTone() == 255 && pixout->getPaint() == 0 && pixin->m == 255))
continue;
std::map<TPixel, int>::const_iterator it;
int paintIndex;
if ((it = m_colorMap.find(*pixin)) == m_colorMap.end()) {
if (m_colorTolerance > 0)
it = findNearestColor(*pixin);
// if (it==colorMap.end() && (int)colorMap.size()>origColorCount) //se non l'ho trovato tra i colori origari, lo cerco in quelli nuovi, ma in questo caso deve essere esattamente uguale(tolerance = 0)
// it = findNearestColor(*pixin, colorMap, colorTolerance, origColorCount, colorMap.size()-1);
if (it == m_colorMap.end() && m_lastIndex < 4096) {
m_colorMap[*pixin] = ++m_lastIndex;
paintIndex = m_lastIndex;
} else if (it != m_colorMap.end()) {
m_colorMap[*pixin] = it->second;
paintIndex = it->second;
}
} else
paintIndex = it->second;
FillParameters params;
params.m_p = TPoint(j, i);
params.m_styleId = paintIndex;
params.m_emptyOnly = true;
fill(rout, params);
//if (*((ULONG *)rout->getRawData())!=0xff)
// {
// int cavolo=0;
// }
}
}
//seconda passata: se son rimasti pixel antialiasati non fillati, si fillano, cercando nelle vicinanze un pixel di paint puro per capire il colore da usare
for (int i = 0; i < rin->getLy(); i++) {
TPixel *pixin = rin->pixels(i);
TPixelCM32 *pixout = rout->pixels(i);
for (int j = 0; j < rin->getLx(); j++, pixin++, pixout++) {
if (!(pixout->getTone() > 0 && pixout->getTone() < 255 && pixout->getPaint() == 0 && pixin->m == 255))
continue;
TPoint p = getClosestPurePaint(rout, i, j);
if (p.x == -1)
continue;
//pixout->setPaint( paintIndex);
FillParameters params;
params.m_p = TPoint(j, i);
params.m_styleId = (rout->pixels(p.y) + p.x)->getPaint();
params.m_emptyOnly = true;
fill(rout, params);
}
}
//infine, si filla di trasparente lo sfondo, percorrendo il bordo, nel caso di trasbordamenti di colore
TPixelCM32 *pixCm;
TPixel *pix;
pixCm = rout->pixels(0);
pix = rin->pixels(0);
FillParameters params;
params.m_styleId = 0;
for (int i = 0; i < rout->getLx(); i++, pixCm++, pix++)
if (pixCm->getTone() == 255 && pixCm->getPaint() != 0 && pix->m == 0) {
params.m_p = TPoint(i, 0);
fill(rout, params);
}
pixCm = rout->pixels(rout->getLy() - 1);
pix = rin->pixels(rout->getLy() - 1);
for (int i = 0; i < rout->getLx(); i++, pixCm++, pix++)
if (pixCm->getTone() == 255 && pixCm->getPaint() != 0 && pix->m == 0) {
params.m_p = TPoint(i, rout->getLy() - 1);
fill(rout, params);
}
int wrapCM = rout->getWrap();
int wrap = rin->getWrap();
pixCm = rout->pixels(0);
pix = rin->pixels(0);
for (int i = 0; i < rin->getLy(); i++, pixCm += wrapCM, pix += wrap)
if (pixCm->getTone() == 255 && pixCm->getPaint() != 0 && pix->m == 0) {
params.m_p = TPoint(0, i);
fill(rout, params);
}
pixCm = rout->pixels(0) + rout->getLx() - 1;
pix = rin->pixels(0) + rin->getLx() - 1;
for (int i = 0; i < rin->getLy(); i++, pixCm += wrapCM, pix += wrap)
if (pixCm->getTone() == 255 && pixCm->getPaint() != 0 && pix->m == 0) {
params.m_p = TPoint(rout->getLx() - 1, i);
fill(rout, params);
}
//.........这里部分代码省略.........