// and do some processing void multiThreadProcessImages(OfxRectI procWindow) { PIX color[nComponents]; colorToPIX(_color, color); // push pixels for (int y = procWindow.y1; y < procWindow.y2; y++) { if (_effect.abort()) { break; } PIX *dstPix = (PIX *) _dstImg->getPixelAddress(procWindow.x1, y); for (int x = procWindow.x1; x < procWindow.x2; x++) { for (int c = 0; c < nComponents; ++c) { dstPix[c] = color[c]; } dstPix += nComponents; } } }
// and do some processing void multiThreadProcessImages(OfxRectI procWindow) { PIX color0[nComponents]; PIX color1[nComponents]; PIX color2[nComponents]; PIX color3[nComponents]; PIX lineColor[nComponents]; PIX centerlineColor[nComponents]; colorToPIX(_color0, color0); colorToPIX(_color1, color1); colorToPIX(_color2, color2); colorToPIX(_color3, color3); colorToPIX(_lineColor, lineColor); colorToPIX(_centerlineColor, centerlineColor); OfxPointD center; center.x = (_rod.x1 + _rod.x2) / 2; center.y = (_rod.y1 + _rod.y2) / 2; // push pixels for (int y = procWindow.y1; y < procWindow.y2; y++) { if (_effect.abort()) { break; } PIX *dstPix = (PIX *) _dstImg->getPixelAddress(procWindow.x1, y); // check if we are on the centerline if ((center.y - _centerlineInfY) <= y && y < (center.y + _centerlineSupY)) { for (int x = procWindow.x1; x < procWindow.x2; x++) { for (int c = 0; c < nComponents; ++c) { dstPix[c] = centerlineColor[c]; } dstPix += nComponents; } } else { // the closest line between boxes double yline = center.y + _boxSize.y * std::floor((y - center.y) / _boxSize.y + 0.5); // check if we are on a line if ((yline - _lineInfY) <= y && y < (yline + _lineSupY)) { for (int x = procWindow.x1; x < procWindow.x2; x++) { for (int c = 0; c < nComponents; ++c) { dstPix[c] = lineColor[c]; } dstPix += nComponents; } } else { // draw boxes and vertical lines int ybox = std::floor((y - center.y) / _boxSize.y); PIX *c0 = (ybox & 1) ? color3 : color0; PIX *c1 = (ybox & 1) ? color2 : color1; for (int x = procWindow.x1; x < procWindow.x2; x++) { // check if we are on the centerline if ((center.x - _centerlineInfX) <= x && x < (center.x + _centerlineSupX)) { for (int c = 0; c < nComponents; ++c) { dstPix[c] = centerlineColor[c]; } } else { // the closest line between boxes double xline = center.x + _boxSize.x * std::floor((x - center.x) / _boxSize.x + 0.5); // check if we are on a line if ((xline - _lineInfX) <= x && x < (xline + _lineSupX)) { for (int c = 0; c < nComponents; ++c) { dstPix[c] = lineColor[c]; } } else { // draw box int xbox = std::floor((x - center.x) / _boxSize.x); if (xbox & 1) { for (int c = 0; c < nComponents; ++c) { dstPix[c] = c1[c]; } } else { for (int c = 0; c < nComponents; ++c) { dstPix[c] = c0[c]; } } } } dstPix += nComponents; } // for(y) } } } // for(y) }