本文整理汇总了C++中TVectorImageP类的典型用法代码示例。如果您正苦于以下问题:C++ TVectorImageP类的具体用法?C++ TVectorImageP怎么用?C++ TVectorImageP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TVectorImageP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: norm
TVectorImageP Naa2TlvConverter::vectorize(const TToonzImageP &ti) {
CenterlineConfiguration conf;
if (!ti) return TVectorImageP();
TPalette *palette = ti->getPalette();
VectorizerCore vc;
TAffine dpiAff;
double factor = Stage::inch;
double dpix = factor / 72, dpiy = factor / 72;
ti->getDpi(dpix, dpiy);
TPointD center = ti->getRaster()->getCenterD();
if (dpix != 0.0 && dpiy != 0.0) dpiAff = TScale(factor / dpix, factor / dpiy);
factor = norm(dpiAff * TPointD(1, 0));
conf.m_affine = dpiAff * TTranslation(-center);
conf.m_thickScale = factor;
conf.m_leaveUnpainted = false;
conf.m_makeFrame = true;
conf.m_penalty = 0.0;
conf.m_despeckling = 0;
TImageP img(ti.getPointer());
TVectorImageP vi = vc.vectorize(img, conf, palette);
vi->setPalette(palette);
return vi;
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:29,代码来源:Naa2TlvConverter.cpp
示例2: assert
StrokesData *FullColorImageData::toStrokesData(ToonzScene *scene) const
{
assert(scene);
TRectD rect;
if (!m_rects.empty())
rect = m_rects[0];
else if (!m_strokes.empty())
rect = m_strokes[0].getBBox();
unsigned int i;
for (i = 0; i < m_rects.size(); i++)
rect += m_rects[i];
for (i = 0; i < m_strokes.size(); i++)
rect += m_strokes[i].getBBox();
TRasterImageP image(m_copiedRaster);
image->setPalette(FullColorPalette::instance()->getPalette(scene));
image->setDpi(m_dpiX, m_dpiY);
const VectorizerParameters *vParams = scene->getProperties()->getVectorizerParameters();
assert(vParams);
std::auto_ptr<VectorizerConfiguration> config(vParams->getCurrentConfiguration(0.0));
TVectorImageP vi = vectorize(image, rect, *config, m_transformation);
StrokesData *sd = new StrokesData();
std::set<int> indexes;
for (i = 0; i < vi->getStrokeCount(); i++)
indexes.insert(i);
sd->setImage(vi, indexes);
return sd;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:32,代码来源:rasterimagedata.cpp
示例3: getCurrentImage
void SceneViewerContextMenu::exitVectorImageGroup() {
TVectorImageP vi =
(TVectorImageP)TTool::getImage(false); // getCurrentImage();
if (!vi) return;
vi->exitGroup();
m_viewer->update();
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:7,代码来源:sceneviewercontextmenu.cpp
示例4: draw
void PlaneViewer::draw(TVectorImageP vi) {
TRectD bbox(vi->getBBox());
TRect bboxI(tfloor(bbox.x0), tfloor(bbox.y0), tceil(bbox.x1) - 1,
tceil(bbox.y1) - 1);
TVectorRenderData rd(TAffine(), bboxI, vi->getPalette(), 0, true, true);
tglDraw(rd, vi.getPointer());
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:8,代码来源:planeviewer.cpp
示例5: glDisable
void ImagePainter::paintImage(const TImageP &image, const TDimension &imageSize,
const TDimension &viewerSize, const TAffine &aff,
const VisualSettings &visualSettings,
const CompareSettings &compareSettings,
const TRect &loadbox) {
glDisable(GL_DEPTH_TEST);
if (visualSettings.m_drawExternalBG) {
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
}
GLenum error = glGetError();
// assert(error==GL_NO_ERROR);
if (error != GL_NO_ERROR) {
printf("ImagePainter::paintImage() gl_error:%d\n", error);
}
if (!image) return;
TRasterImageP rimg = (TRasterImageP)image;
TVectorImageP vimg = (TVectorImageP)image;
TToonzImageP timg = (TToonzImageP)image;
TRect clipRect(viewerSize);
clipRect -= TPoint(viewerSize.lx * 0.5, viewerSize.ly * 0.5);
Painter painter(viewerSize, imageSize, aff, image->getPalette(),
visualSettings);
if (rimg)
painter.onRasterImage(rimg.getPointer());
else if (vimg)
painter.onVectorImage(vimg.getPointer());
else if (timg)
painter.onToonzImage(timg.getPointer());
if (visualSettings.m_blankColor != TPixel::Transparent) {
painter.drawBlank();
return;
}
// if I have a color filter applied using a glmask, , drawing of images must
// be done on black bg!
if (!vimg)
painter.flushRasterImages(
loadbox, visualSettings.m_doCompare ? compareSettings.m_compareX
: DefaultCompareValue,
visualSettings.m_doCompare ? compareSettings.m_compareY
: DefaultCompareValue,
compareSettings.m_swapCompared);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
if (visualSettings.m_doCompare)
drawCompareLines(viewerSize, compareSettings.m_compareX,
compareSettings.m_compareY);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:57,代码来源:imagepainter.cpp
示例6: multiApplyAutoclose
void multiApplyAutoclose(TFrameId firstFid, TFrameId lastFid,
TRectD firstRect, TRectD lastRect,
TStroke *firstStroke = 0, TStroke *lastStroke = 0) {
bool backward = false;
if (firstFid > lastFid) {
tswap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
std::vector<TFrameId> allFids;
m_level->getFids(allFids);
std::vector<TFrameId>::iterator i0 = allFids.begin();
while (i0 != allFids.end() && *i0 < firstFid) i0++;
if (i0 == allFids.end()) return;
std::vector<TFrameId>::iterator i1 = i0;
while (i1 != allFids.end() && *i1 <= lastFid) i1++;
assert(i0 < i1);
std::vector<TFrameId> fids(i0, i1);
int m = fids.size();
assert(m > 0);
TVectorImageP firstImage;
TVectorImageP lastImage;
if ((m_closeType.getValue() == FREEHAND_CLOSE ||
m_closeType.getValue() == POLYLINE_CLOSE) &&
firstStroke && lastStroke) {
TStroke *first = new TStroke(*firstStroke);
TStroke *last = new TStroke(*lastStroke);
firstImage = new TVectorImage();
lastImage = new TVectorImage();
firstImage->addStroke(first);
lastImage->addStroke(last);
}
TUndoManager::manager()->beginBlock();
for (int i = 0; i < m; ++i) {
TFrameId fid = fids[i];
TToonzImageP img = (TToonzImageP)m_level->getFrame(fid, true);
if (!img) continue;
double t = m > 1 ? (double)i / (double)(m - 1) : 0.5;
if (m_closeType.getValue() == RECT_CLOSE)
applyAutoclose(img, interpolateRect(firstRect, lastRect, t));
else if ((m_closeType.getValue() == FREEHAND_CLOSE ||
m_closeType.getValue() == POLYLINE_CLOSE) &&
firstStroke && lastStroke)
doClose(t, img, firstImage, lastImage);
m_level->getProperties()->setDirtyFlag(true);
}
TUndoManager::manager()->endBlock();
TTool::getApplication()->getCurrentXsheet()->notifyXsheetChanged();
// TNotifier::instance()->notify(TLevelChange());
// TNotifier::instance()->notify(TStageChange());
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:56,代码来源:rastertapetool.cpp
示例7: updateLevel
void updateLevel()
{
TTool::Application *app = TTool::getApplication();
if (!app->getCurrentLevel()->getLevel())
return;
TXshSimpleLevelP xl = app->getCurrentLevel()->getLevel()->getSimpleLevel();
if (app->getCurrentFrame()->getFrameType() != TFrameHandle::LevelFrame)
return;
TFrameId fid = app->getCurrentFrame()->getFid();
TVectorImageP src = xl->getFrame(fid, true);
int count = src->getStrokeCount();
for (int i = 1; i < 10; i++) {
++fid;
if (!xl->isFid(fid)) {
TVectorImageP vi = new TVectorImage();
xl->setFrame(fid, vi);
}
TVectorImageP vi = xl->getFrame(fid, true);
TVectorImageP dst = src->clone();
deform(dst.getPointer(), src.getPointer(), (double)i / (double)9);
count = dst->getStrokeCount();
vi->mergeImage(dst, TAffine());
app->getCurrentTool()->getTool()->notifyImageChanged(fid);
}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:27,代码来源:morphtool.cpp
示例8: TImageP
TStroke *PinchTool::getClosestStroke(const TPointD &pos, double &w) const
{
TVectorImageP vi = TImageP(getImage(false));
if (!vi)
return 0;
double dist = 0;
UINT index;
if (vi->getNearestStroke(pos, w, index, dist, true))
return vi->getStroke(index);
else
return 0;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:12,代码来源:pinchtool.cpp
示例9: TVectorBrushStyle
TColorStyle *TVectorBrushStyle::clone() const
{
TVectorImageP brush;
if (m_brush) {
//Clone m_brush and its palette
brush = m_brush->clone(); //NOTE: This does NOT clone the palette, too.
brush->setPalette(m_brush->getPalette()->clone());
}
TVectorBrushStyle *theClone = new TVectorBrushStyle(m_brushName, brush);
theClone->assignNames(this);
theClone->setFlags(getFlags());
return theClone;
}
开发者ID:AmEv7Fam,项目名称:opentoonz,代码行数:15,代码来源:tvectorbrushstyle.cpp
示例10: stroke_autofill_learn
void stroke_autofill_learn(const TVectorImageP &imgToLearn, TStroke *stroke) {
if (!imgToLearn || !stroke || stroke->getControlPointCount() == 0) return;
TVectorImage appImg;
TStroke *appStroke = new TStroke(*stroke);
appImg.addStroke(appStroke);
appImg.findRegions();
double pbx, pby;
double totalArea = 0;
pbx = pby = 0;
if (!regionsReference.isEmpty()) regionsReference.clear();
int i, j, index = 0;
for (i = 0; i < (int)imgToLearn->getRegionCount(); i++) {
TRegion *currentRegion = imgToLearn->getRegion(i);
for (j = 0; j < (int)appImg.getRegionCount(); j++) {
TRegion *region = appImg.getRegion(j);
if (contains(region, currentRegion)) {
scanRegion(currentRegion, index, regionsReference, region->getBBox());
index++;
int k, subRegionCount = currentRegion->getSubregionCount();
for (k = 0; k < subRegionCount; k++) {
TRegion *subRegion = currentRegion->getSubregion(k);
if (contains(region, subRegion))
scanSubRegion(subRegion, index, regionsReference,
region->getBBox());
}
}
}
}
QMap<int, Region>::Iterator it;
for (it = regionsReference.begin(); it != regionsReference.end(); it++) {
pbx += it.value().m_barycentre.x;
pby += it.value().m_barycentre.y;
totalArea += it.value().m_area;
}
if (totalArea > 0)
referenceB = TPointD(pbx / totalArea, pby / totalArea);
else
referenceB = TPointD(0.0, 0.0);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:45,代码来源:autofillpli.cpp
示例11: tween
TVectorImageP MyInbetweener::tween(double t)
{
TVectorImageP vi = m_vi0->clone();
int n = tmin(m_vi0->getStrokeCount(), m_vi1->getStrokeCount());
for (int i = 0; i < n; i++) {
TStroke *stroke0 = m_vi0->getStroke(i);
TStroke *stroke1 = m_vi1->getStroke(i);
TStroke *stroke = vi->getStroke(i);
int m = tmin(stroke0->getControlPointCount(), stroke1->getControlPointCount());
for (int j = 0; j < m; j++) {
TThickPoint p0 = stroke0->getControlPoint(j);
TThickPoint p1 = stroke1->getControlPoint(j);
TThickPoint p = (1 - t) * p0 + t * p1;
stroke->setControlPoint(j, p);
}
/*
for(int j=2;j+2<m;j+=2)
{
TThickPoint p0 = stroke0->getControlPoint(j-2);
TThickPoint p1 = stroke0->getControlPoint(j-1);
TThickPoint p2 = stroke0->getControlPoint(j);
TThickPoint p3 = stroke0->getControlPoint(j+1);
TThickPoint p4 = stroke0->getControlPoint(j+2);
if(tdistance2(p0,p1)<0.001 && tdistance2(p3,p4)<0.001)
{
p2 = 0.5*(p1+p2);
stroke->setControlPoint(j,p2);
}
}
*/
}
return vi;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:33,代码来源:inbetweencommand.cpp
示例12: leftButtonDrag
void leftButtonDrag(const TPointD &p, const TMouseEvent &)
{
if (!m_active)
return;
// double dx = p.x - m_pointAtMouseDown.x;
double pixelSize = getPixelSize();
if (tdistance2(p, m_oldPos) < 9.0 * pixelSize * pixelSize)
return;
m_oldPos = p;
m_pointAtMouseDown = p;
//double sc = exp(0.001 * (double)dx);
TVectorImageP vi = TImageP(getImage(true));
if (!vi)
return;
QMutexLocker lock(vi->getMutex());
TPointD
offset = p - m_pointAtMove;
/*
if( tdistance2(m_pointAtMouseDown, p ) > sq(m_pointSize * 0.5) ) // reincremento
{
leftButtonUp(p);
lefrightButtonDown(p);
}
*/
UINT i, j;
for (i = 0; i < m_strokeHit.size(); ++i)
modifyControlPoints(*m_strokeHit[i],
TStrokePointDeformation(offset, m_pointAtMouseDown, m_pointSize * 0.7));
for (i = 0; i < m_strokeToModify.size(); ++i)
for (j = 0; j < m_strokeToModify[i].m_splittedToMove.size(); ++j) {
TStroke *temp = m_strokeToModify[i].m_splittedToMove[j];
modifyControlPoints(*temp, TStrokePointDeformation(offset, m_pointAtMouseDown, m_pointSize * 0.7));
}
m_pointAtMove = p;
invalidate();
};
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:45,代码来源:magnettool.cpp
示例13: vectorToToonzRaster
static TToonzImageP vectorToToonzRaster(const TVectorImageP &vi,
const TDimension &size, const TAffine &aff,
const TPointD &dpi) {
/*
TScale sc(dpi.x/Stage::inch, dpi.y/Stage::inch);
TRectD bbox = sc*vi->getBBox();
bbox.x0 = tfloor(bbox.x0);
bbox.y0 = tfloor(bbox.y0);
bbox.x1 = tceil(bbox.x1);
bbox.y1 = tceil(bbox.y1);
TDimension size(bbox.getLx(), bbox.getLy());
*/
TToonzImageP ti = ToonzImageUtils::vectorToToonzImage(
vi, aff, vi->getPalette(), TPointD(0, 0), size, 0, true);
ti->setPalette(vi->getPalette()); // e' necessario?
return ti;
}
开发者ID:merckhung,项目名称:opentoonz,代码行数:19,代码来源:scriptbinding_rasterizer.cpp
示例14: lock
void StrokeSelection::paste() {
TTool *tool = TTool::getApplication()->getCurrentTool()->getTool();
if (!tool) return;
if (TTool::getApplication()->getCurrentObject()->isSpline()) {
const StrokesData *stData = dynamic_cast<const StrokesData *>(
QApplication::clipboard()->mimeData());
if (!stData) return;
TVectorImageP splineImg = tool->getImage(true);
TVectorImageP img = stData->m_image;
if (!splineImg || !img) return;
QMutexLocker lock(splineImg->getMutex());
TUndo *undo = new ToolUtils::UndoPath(
tool->getXsheet()->getStageObject(tool->getObjectId())->getSpline());
while (splineImg->getStrokeCount() > 0) splineImg->deleteStroke(0);
TStroke *stroke = img->getStroke(0);
splineImg->addStroke(new TStroke(*stroke), false);
TUndoManager::manager()->add(undo);
tool->notifyImageChanged();
tool->invalidate();
return;
}
TVectorImageP tarImg = tool->touchImage();
if (!tarImg) return;
TPaletteP palette = tarImg->getPalette();
TPaletteP oldPalette = new TPalette();
if (palette) oldPalette = palette->clone();
bool isPaste = pasteStrokesWithoutUndo(tarImg, m_indexes, m_sceneHandle);
if (isPaste) {
TXshSimpleLevel *level =
TTool::getApplication()->getCurrentLevel()->getSimpleLevel();
TUndoManager::manager()->add(new PasteStrokesUndo(
level, tool->getCurrentFid(), m_indexes, oldPalette, m_sceneHandle));
m_updateSelectionBBox = isPaste;
}
tool->notifyImageChanged();
tool->getApplication()
->getPaletteController()
->getCurrentLevelPalette()
->notifyPaletteChanged();
m_updateSelectionBBox = false;
tool->invalidate();
}
开发者ID:luc--,项目名称:opentoonz,代码行数:45,代码来源:strokeselection.cpp
示例15: getCurrentColumnMatrix
void SkeletonTool::drawLevelBoundingBox(int frame, int columnIndex)
{
TAffine affine = getCurrentColumnMatrix();
TXshCell cell = getXsheet()->getCell(frame, columnIndex);
TImageP image = cell.getImage(false);
TToonzImageP ti = image;
TVectorImageP vi = image;
glPushMatrix();
if (affine != getMatrix())
tglMultMatrix(getMatrix().inv() * affine);
if (ti) {
TPointD dpiScale = getViewer()->getDpiScale();
glScaled(dpiScale.x, dpiScale.y, 1);
TRectD bbox = ToonzImageUtils::convertRasterToWorld(convert(ti->getBBox()), ti);
ToolUtils::drawRect(bbox * ti->getSubsampling(), TPixel32(200, 200, 200), 0x5555);
}
if (vi) {
TRectD bbox = vi->getBBox();
ToolUtils::drawRect(bbox, TPixel32(200, 200, 200), 0x5555);
}
glPopMatrix();
}
开发者ID:titer1,项目名称:opentoonz,代码行数:22,代码来源:skeletontool.cpp
示例16: addEnterGroupCommands
void SceneViewerContextMenu::addEnterGroupCommands(const TPointD &pos) {
bool ret = true;
TVectorImageP vi = (TVectorImageP)TTool::getImage(false);
if (!vi) return;
if (vi->isInsideGroup() > 0) {
addAction(CommandManager::instance()->getAction(MI_ExitGroup));
}
StrokeSelection *ss =
dynamic_cast<StrokeSelection *>(TSelection::getCurrent());
if (!ss) return;
for (int i = 0; i < vi->getStrokeCount(); i++)
if (ss->isSelected(i) && vi->canEnterGroup(i)) {
m_groupIndexToBeEntered = i;
addAction(CommandManager::instance()->getAction(MI_EnterGroup));
return;
}
assert(ret);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:22,代码来源:sceneviewercontextmenu.cpp
示例17: rect_autofill_learn
void rect_autofill_learn(const TVectorImageP &imgToLearn, const TRectD &rect)
{
if (rect.getLx() * rect.getLy() < MIN_SIZE) return;
double pbx, pby;
double totalArea = 0;
pbx = pby = 0;
if (!regionsReference.isEmpty()) regionsReference.clear();
int i, index = 0, regionCount = imgToLearn->getRegionCount();
for (i = 0; i < regionCount; i++) {
TRegion *region = imgToLearn->getRegion(i);
if (rect.contains(region->getBBox())) {
scanRegion(region, index, regionsReference, rect);
index++;
}
int j, subRegionCount = region->getSubregionCount();
for (j = 0; j < subRegionCount; j++) {
TRegion *subRegion = region->getSubregion(j);
if (rect.contains(subRegion->getBBox()))
scanSubRegion(subRegion, index, regionsReference, rect);
}
}
QMap<int, Region>::Iterator it;
for (it = regionsReference.begin(); it != regionsReference.end(); it++) {
pbx += it.value().m_barycentre.x;
pby += it.value().m_barycentre.y;
totalArea += it.value().m_area;
}
if (totalArea > 0)
referenceB = TPointD(pbx / totalArea, pby / totalArea);
else
referenceB = TPointD(0.0, 0.0);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:38,代码来源:autofillpli.cpp
示例18: getXsheet
void SkeletonTool::getImageBoundingBox(TRectD &bbox, TAffine &aff, int frame, int columnIndex)
{
TAffine columnAff = getXsheet()->getPlacement(TStageObjectId::ColumnId(columnIndex), frame);
// TAffine affine = getColumnMatrix(columnIndex);
TXshCell cell = getXsheet()->getCell(frame, columnIndex);
TImageP image = cell.getImage(false);
TToonzImageP ti = image;
TVectorImageP vi = image;
if (ti) {
TAffine imageDpiAff;
if (cell.m_level->getSimpleLevel())
imageDpiAff = getDpiAffine(cell.m_level->getSimpleLevel(), cell.m_frameId, true);
aff = columnAff * imageDpiAff;
bbox = ToonzImageUtils::convertRasterToWorld(convert(ti->getBBox()), ti) * ti->getSubsampling();
ToolUtils::drawRect(bbox * ti->getSubsampling(), TPixel32(200, 200, 200), 0x5555);
} else if (vi) {
bbox = vi->getBBox();
aff = columnAff;
} else {
bbox = TRectD();
aff = TAffine();
}
}
开发者ID:titer1,项目名称:opentoonz,代码行数:23,代码来源:skeletontool.cpp
示例19: doClose
void doClose(double t, const TImageP &img, const TVectorImageP &firstImage,
const TVectorImageP &lastImage) {
if (t == 0)
applyAutoclose(img, TRectD(), firstImage->getStroke(0));
else if (t == 1)
applyAutoclose(img, TRectD(), lastImage->getStroke(0));
else {
assert(firstImage->getStrokeCount() == 1);
assert(lastImage->getStrokeCount() == 1);
TVectorImageP vi = TInbetween(firstImage, lastImage).tween(t);
assert(vi->getStrokeCount() == 1);
applyAutoclose(img, TRectD(), vi->getStroke(0));
}
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:14,代码来源:rastertapetool.cpp
示例20: vectorToFullColorImage
//!Converts a TVectorImage into a TRasterImage. The input vector image
//!is transformed through the passed affine \b aff, and put into a
//!TRasterImage strictly covering the bounding box of the transformed
//!vector image. The output image has its lower-left position in the
//!world reference specified by the \b pos parameter, which is granted to
//!be an integer displacement of the passed value. Additional parameters
//!include an integer \b enlarge by which the output image is enlarged with
//!respect to the transformed image's bbox, and the bool \b transformThickness
//!to specify whether the transformation should involve strokes' thickensses
//!or not.
TRasterImageP TRasterImageUtils::vectorToFullColorImage(
const TVectorImageP &vimage, const TAffine &aff, TPalette *palette,
const TPointD &outputPos, const TDimension &outputSize,
const std::vector<TRasterFxRenderDataP> *fxs, bool transformThickness)
{
if (!vimage || !palette)
return 0;
//Transform the vector image through aff
TVectorImageP vi = vimage->clone();
vi->transform(aff, transformThickness);
//Allocate the output ToonzImage
TRaster32P raster(outputSize.lx, outputSize.ly);
raster->clear();
TRasterImageP ri(raster);
ri->setPalette(palette->clone());
//Shift outputPos to the origin
vi->transform(TTranslation(-outputPos));
int strokeCount = vi->getStrokeCount();
std::vector<int> strokeIndex(strokeCount);
std::vector<TStroke *> strokes(strokeCount);
int i;
for (i = 0; i < strokeCount; ++i) {
strokeIndex[i] = i;
strokes[i] = vi->getStroke(i);
}
vi->notifyChangedStrokes(strokeIndex, strokes);
int maxStyleId = palette->getStyleCount() - 1;
for (i = 0; i < (int)vi->getRegionCount(); ++i) {
TRegion *region = vi->getRegion(i);
fastAddPaintRegion(ri, region, tmin(maxStyleId, region->getStyle()), maxStyleId);
}
set<int> colors;
if (fxs) {
for (i = 0; i < (int)fxs->size(); i++) {
SandorFxRenderData *sandorData = dynamic_cast<SandorFxRenderData *>((*fxs)[i].getPointer());
if (sandorData && sandorData->m_type == BlendTz) {
std::string indexes = toString(sandorData->m_blendParams.m_colorIndex);
std::vector<std::string> items;
parseIndexes(indexes, items);
PaletteFilterFxRenderData paletteFilterData;
insertIndexes(items, &paletteFilterData);
colors = paletteFilterData.m_colors;
break;
}
}
}
for (i = 0; i < strokeCount; ++i) {
TStroke *stroke = vi->getStroke(i);
bool visible = false;
int styleId = stroke->getStyle();
TColorStyleP style = palette->getStyle(styleId);
assert(style);
int colorCount = style->getColorParamCount();
if (colorCount == 0)
visible = true;
else {
visible = false;
for (int j = 0; j < style->getColorParamCount() && !visible; j++) {
TPixel32 color = style->getColorParamValue(j);
if (color.m != 0)
visible = true;
}
}
if (visible)
fastAddInkStroke(ri, stroke, TRectD(), 1, true);
}
return ri;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:86,代码来源:trasterimageutils.cpp
注:本文中的TVectorImageP类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论