PlaneViewer::PlaneViewer(QWidget *parent) : QOpenGLWidget(parent) , m_firstResize(true) , m_xpos(0) , m_ypos(0) , m_aff() // initialized at the first resize , m_chessSize(40.0) { m_zoomRange[0] = 1e-3, m_zoomRange[1] = 1024.0; setBgColor(TPixel32(235, 235, 235), TPixel32(235, 235, 235)); }
void ShiftTraceTool::drawControlRect() { if (m_ghostIndex < 0 || m_ghostIndex > 1) return; int row = m_row[m_ghostIndex]; if (row < 0) return; int col = TApp::instance()->getCurrentColumn()->getColumnIndex(); TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); TXshCell cell = xsh->getCell(row, col); if (cell.isEmpty()) return; TImageP img = cell.getImage(false); if (!img) return; TRectD box; if (TRasterImageP ri = img) { TRasterP ras = ri->getRaster(); box = (convert(ras->getBounds()) - ras->getCenterD()) * ri->getSubsampling(); } else if (TToonzImageP ti = img) { TRasterP ras = ti->getRaster(); box = (convert(ras->getBounds()) - ras->getCenterD()) * ti->getSubsampling(); } else if (TVectorImageP vi = img) { box = vi->getBBox(); } else { return; } glPushMatrix(); tglMultMatrix(getGhostAff()); TPixel32 color; color = m_highlightedGadget == TranslateGadget ? TPixel32(200, 100, 100) : TPixel32(120, 120, 120); tglColor(color); glBegin(GL_LINE_STRIP); glVertex2d(box.x0, box.y0); glVertex2d(box.x1, box.y0); glVertex2d(box.x1, box.y1); glVertex2d(box.x0, box.y1); glVertex2d(box.x0, box.y0); glEnd(); color = m_highlightedGadget == 2000 ? TPixel32(200, 100, 100) : TPixel32::White; double r = 4 * sqrt(tglGetPixelSize2()); drawDot(box.getP00(), r, color); drawDot(box.getP01(), r, color); drawDot(box.getP10(), r, color); drawDot(box.getP11(), r, color); if (m_curveStatus == NoCurve) { color = m_highlightedGadget == 2001 ? TPixel32(200, 100, 100) : TPixel32::White; TPointD c = m_center[m_ghostIndex]; drawDot(c, r, color); } glPopMatrix(); }
TPixel32 TGenericColorFunction::operator()(const TPixel32 &color) const { return TPixel32(tcrop(m_m[0] * color.r + m_c[0], 0.0, 255.0), tcrop(m_m[1] * color.g + m_c[1], 0.0, 255.0), tcrop(m_m[2] * color.b + m_c[2], 0.0, 255.0), tcrop(m_m[3] * color.m + m_c[3], 0.0, 255.0)); }
void ShiftTraceTool::drawCurve() { if (m_curveStatus == NoCurve) return; double r = 4 * sqrt(tglGetPixelSize2()); double u = getPixelSize(); if (m_curveStatus == TwoPointsCurve) { TPixel32 color = m_highlightedGadget == 1000 ? TPixel32(200, 100, 100) : TPixel32::White; drawDot(m_p0, r, color); glColor3d(0.2, 0.2, 0.2); tglDrawSegment(m_p0, m_p1); drawDot(m_p1, r, TPixel32::Red); } else if (m_curveStatus == ThreePointsCurve) { TPixel32 color = m_highlightedGadget == 1000 ? TPixel32(200, 100, 100) : TPixel32::White; drawDot(m_p0, r, color); color = m_highlightedGadget == 1001 ? TPixel32(200, 100, 100) : TPixel32::White; drawDot(m_p1, r, color); glColor3d(0.2, 0.2, 0.2); TPointD center; if (circumCenter(center, m_p0, m_p1, m_p2)) { double radius = norm(center - m_p1); glBegin(GL_LINE_STRIP); int n = 100; for (int i = 0; i < n; i++) { double t = (double)i / n; TPointD p = (1 - t) * m_p0 + t * m_p2; p = center + radius * normalize(p - center); tglVertex(p); } for (int i = 0; i < n; i++) { double t = (double)i / n; TPointD p = (1 - t) * m_p2 + t * m_p1; p = center + radius * normalize(p - center); tglVertex(p); } glEnd(); } else { tglDrawSegment(m_p0, m_p1); } color = m_highlightedGadget == 1002 ? TPixel32(200, 100, 100) : TPixel32::White; drawDot(m_p2, r, color); } }
void Naa2TlvConverter::addBorderInks() // add syntethic inks: lines between two // adjacent fill-regions { int lx = m_regionRas->getLx(); int ly = m_regionRas->getLy(); static const int dd[][2] = {{0, -1}, {-1, 0}, {1, 0}, {0, 1}, {1, 1}, {-1, -1}, {-1, 1}, {1, -1}}; m_syntheticInkRas = new WorkRaster<unsigned char>(lx, ly); for (int i = 0; i < lx * ly; i++) m_syntheticInkRas->pixels(0)[i] = 0; int borderInkColorIndex = m_colors.count(); m_colors.append(TPixel32(255, 0, 0)); RegionInfo borderInkRegion; borderInkRegion.type = RegionInfo::SyntheticInk; borderInkRegion.colorIndex = borderInkColorIndex; int borderInkRegionIndex = m_regions.count(); m_regions.append(borderInkRegion); for (int y = 0; y < ly; y++) { unsigned short *workScanLine = m_regionRas->pixels(y); unsigned char *borderScanLine = m_borderRas->pixels(y); for (int x = 0; x < lx; x++) { int c = workScanLine[x]; if (borderScanLine[x] != 1) continue; // consider border pixel only if (0 == (m_regions[c].type & RegionInfo::Paint) && m_regions[c].type != RegionInfo::Unknown) continue; // consider paint pixels only // is touching a different no-ink pixel? bool touchesOtherRegion = false; for (int j = 0; j < 8; j++) { int x1 = x + dd[j][0], y1 = y + dd[j][1]; if (0 <= x1 && x1 < lx && 0 <= y1 && y1 < ly) { int c1 = m_regionRas->pixels(y1)[x1]; if (m_regions[c1].type == RegionInfo::Background) { touchesOtherRegion = true; break; } else if (m_regions[c1].type == RegionInfo::Unknown || (m_regions[c1].type & RegionInfo::Paint) != 0) { // OLD: note: we consider only regions with a lower index, to avoid // to create double border strokes // NEW: we put syntetic ink pixels in larger regions if (m_regions[c1].pixelCount < m_regions[c].pixelCount) { touchesOtherRegion = true; break; } } } } if (touchesOtherRegion) { m_syntheticInkRas->pixels(y)[x] = 1; } } } }
TPalette::TPalette() : m_version(0) , m_isCleanupPalette(false) , m_currentFrame(-1) , m_dirtyFlag(false) , m_mutex(QMutex::Recursive) , m_isLocked(false) , m_askOverwriteFlag(false) , m_shortcutScopeIndex(0) { QString tempName(QObject::tr("colors")); std::wstring pageName = tempName.toStdWString(); Page *page = addPage(pageName); page->addStyle(TPixel32(255, 255, 255, 0)); page->addStyle(TPixel32(0, 0, 0, 255)); getStyle(0)->setName(L"color_0"); getStyle(1)->setName(L"color_1"); for (int i = 0; i < 10; i++) m_shortcuts['0' + i] = i; }
TSceneProperties::TSceneProperties() : m_cleanupParameters(new CleanupParameters()), m_scanParameters(new TScannerParameters()), m_vectorizerParameters(new VectorizerParameters()), m_captureParameters(new CaptureParameters()), m_outputProp(new TOutputProperties()), m_previewProp(new TOutputProperties()), m_bgColor(255, 255, 255, 0), m_markerDistance(6), m_markerOffset(0), m_fullcolorSubsampling(1), m_tlvSubsampling(1), m_fieldGuideSize(12), m_fieldGuideAspectRatio(1.38) { //Default color m_notesColor.push_back(TPixel32(255, 235, 140)); m_notesColor.push_back(TPixel32(255, 160, 120)); m_notesColor.push_back(TPixel32(255, 180, 190)); m_notesColor.push_back(TPixel32(135, 205, 250)); m_notesColor.push_back(TPixel32(145, 240, 145)); m_notesColor.push_back(TPixel32(130, 255, 210)); m_notesColor.push_back(TPixel32(150, 245, 255)); }
TImageP ImageFiller::build(int imFlags, void *extData) { assert(imFlags == ImageManager::none); // Fetch image assert(extData); ImageLoader::BuildExtData *data = (ImageLoader::BuildExtData *)extData; assert(data->m_subs == 0); const std::string &srcImgId = data->m_sl->getImageId(data->m_fid); TImageP img = ImageManager::instance()->getImage(srcImgId, imFlags, extData); if (img) { TRasterImageP ri = img; if (ri) { TRaster32P ras = ri->getRaster(); if (ras) { TRaster32P newRas = ras->clone(); FullColorAreaFiller filler(newRas); TPaletteP palette = new TPalette(); int styleId = palette->getPage(0)->addStyle(TPixel32::White); FillParameters params; params.m_palette = palette.getPointer(); params.m_styleId = styleId; params.m_minFillDepth = 0; params.m_maxFillDepth = 15; filler.rectFill(newRas->getBounds(), params, false); TRasterImageP ri = TRasterImageP(newRas); return ri; } } } // Error case: return a dummy image (is it really required?) TRaster32P ras(10, 10); ras->fill(TPixel32(127, 0, 127, 127)); return TRasterImageP(ras); }
RasterMovieGenerator(const TFilePath &fp, const TDimension cameraSize, TOutputProperties &properties) : Imp(fp, cameraSize, properties.getFrameRate()) , m_frameIndex(1) , m_started(false) , m_offlineGlContext(*TOfflineGL::getStock(cameraSize)) , m_st(0) , m_whiteSample(0) , m_fileOptions(0) , m_alphaEnabled(false) , m_alphaNeeded(false) , m_status(0) { m_bgColor = TPixel32(255, 255, 255, 0); TPointD center(0.5 * cameraSize.lx, 0.5 * cameraSize.ly); m_viewAff = TTranslation(center); std::string ext = fp.getType(); m_isFrames = ext != "avi" && ext != "mov" && ext != "3gp"; m_fileOptions = properties.getFileFormatProperties(ext); }
TPixel32 TColorValue::getPixel() const { int r, g, b; getRgb(r, g, b); return TPixel32(r, g, b, (int)(m_m * 255.0 + 0.5)); }
void Naa2TlvConverter::findSuspectInks() { QMultiMap<TUINT32, int> paintColorTable; for (int i = 0; i < m_regions.count(); i++) { RegionInfo ®ion = m_regions[i]; if (0 == (region.type & RegionInfo::Paint)) continue; TPixel32 color = m_colors[region.colorIndex]; if (color == TPixel32(0, 0, 0)) { int x = 1234; continue; } TUINT32 rawColor = *(TUINT32 *)&color; paintColorTable.insert(rawColor, i); } int count = 0; for (int i = 0; i < m_regions.count(); i++) { RegionInfo ®ion = m_regions[i]; if (region.isInk() && region.links.size() == 2) { int ra = region.links.keys().at(0), rb = region.links.keys().at(1); if (ra >= 0 && rb >= 0) { if (!m_regions[ra].isInk()) qSwap(ra, rb); if (m_regions[ra].isInk() && !m_regions[rb].isInk()) { int sa = region.links[ra]; int sb = region.links[rb]; if (sa > sb) { region.type = RegionInfo::Paint; count++; continue; } } } } if (region.type != RegionInfo::ThinInk) continue; TUINT32 rawColor = *(TUINT32 *)&m_colors[region.colorIndex]; if (paintColorTable.contains(rawColor)) { region.type = RegionInfo::Unknown; count++; } } for (int i = 0; i < m_regions.count(); i++) { RegionInfo ®ion = m_regions[i]; if (region.isInk() && 10 <= region.pixelCount && region.pixelCount < 100) { int lx = region.x1 - region.x0 + 1; int ly = region.y1 - region.y0 + 1; int d = qMax(lx, ly); if (qMin(lx, ly) * 2 > qMax(lx, ly) && region.pixelCount > d * d / 2) { region.type = RegionInfo::Paint; } } if (region.type == RegionInfo::Paint || region.type == RegionInfo::Unknown) { bool isInk = false; if (region.boundaries.at(0) == 0) { if (region.boundaries.count() == 2) isInk = true; else if (region.boundaries.count() == 3) { int b1 = region.boundaries.at(1); int b2 = region.boundaries.at(2); if (b1 * 2 < b2) isInk = true; } } if (isInk) region.type = RegionInfo::Ink; } } }
void tglDraw(const TRectD &rect, const TRaster32P &tex, bool blending) { CHECK_ERRORS_BY_GL; glPushAttrib(GL_ALL_ATTRIB_BITS); if (blending) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } unsigned int texWidth = 1; unsigned int texHeight = 1; while (texWidth < (unsigned int)tex->getLx()) texWidth = texWidth << 1; while (texHeight < (unsigned int)tex->getLy()) texHeight = texHeight << 1; double lwTex = 1.0; double lhTex = 1.0; TRaster32P texture; unsigned int texLx = (unsigned int)tex->getLx(); unsigned int texLy = (unsigned int)tex->getLy(); if (texWidth != texLx || texHeight != texLy) { texture = TRaster32P(texWidth, texHeight); texture->fill(TPixel32(0, 0, 0, 0)); texture->copy(tex); lwTex = (texLx) / (double)(texWidth); lhTex = (texLy) / (double)(texHeight); if (lwTex > 1.0) lwTex = 1.0; if (lhTex > 1.0) lhTex = 1.0; } else texture = tex; GLenum fmt = #ifdef TNZ_MACHINE_CHANNEL_ORDER_BGRM GL_BGRA_EXT; #elif TNZ_MACHINE_CHANNEL_ORDER_MBGR GL_ABGR_EXT; #elif TNZ_MACHINE_CHANNEL_ORDER_RGBM GL_RGBA; #elif TNZ_MACHINE_CHANNEL_ORDER_MRGB GL_BGRA; #else // Error PLATFORM NOT SUPPORTED #error "unknown channel order!" #endif // Generate a texture id and bind it. GLuint texId; glGenTextures(1, &texId); glBindTexture(GL_TEXTURE_2D, texId); glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->getWrap()); texture->lock(); glTexImage2D(GL_TEXTURE_2D, 0, 4, texWidth, texHeight, 0, fmt, #ifdef TNZ_MACHINE_CHANNEL_ORDER_MRGB GL_UNSIGNED_INT_8_8_8_8_REV, #else GL_UNSIGNED_BYTE, #endif texture->getRawData()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glEnable(GL_TEXTURE_2D); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); double rectLx = rect.getLx(); double rectLy = rect.getLy(); tglColor(TPixel32(0, 0, 0, 0)); glPushMatrix(); glTranslated(rect.x0, rect.y0, 0.0); glBegin(GL_POLYGON); glTexCoord2d(0, 0); tglVertex(TPointD(0.0, 0.0)); glTexCoord2d(lwTex, 0); tglVertex(TPointD(rectLx, 0.0)); glTexCoord2d(lwTex, lhTex); tglVertex(TPointD(rectLx, rectLy)); glTexCoord2d(0, lhTex); tglVertex(TPointD(0.0, rectLy)); glEnd(); glDisable(GL_TEXTURE_2D); glPopMatrix(); glPopAttrib(); // Delete texture glDeleteTextures(1, &texId); texture->unlock(); }
TImageP ImageRasterizer::build(int imFlags, void *extData) { assert(!(imFlags & ~(ImageManager::dontPutInCache | ImageManager::forceRebuild))); TDimension d(10, 10); TPoint off(0, 0); // Fetch image assert(extData); ImageLoader::BuildExtData *data = (ImageLoader::BuildExtData *)extData; const std::string &srcImgId = data->m_sl->getImageId(data->m_fid); TImageP img = ImageManager::instance()->getImage(srcImgId, imFlags, extData); if (img) { TVectorImageP vi = img; if (vi) { TRectD bbox = vi->getBBox(); d = TDimension(tceil(bbox.getLx()) + 1, tceil(bbox.getLy()) + 1); off = TPoint((int)bbox.x0, (int)bbox.y0); TPalette *vpalette = vi->getPalette(); TVectorRenderData rd(TTranslation(-off.x, -off.y), TRect(TPoint(0, 0), d), vpalette, 0, true, true); TGlContext oldContext = tglGetCurrentContext(); // this is too slow. { QSurfaceFormat format; format.setProfile(QSurfaceFormat::CompatibilityProfile); TRaster32P ras(d); glPushAttrib(GL_ALL_ATTRIB_BITS); glMatrixMode(GL_MODELVIEW), glPushMatrix(); glMatrixMode(GL_PROJECTION), glPushMatrix(); { std::unique_ptr<QOpenGLFramebufferObject> fb(new QOpenGLFramebufferObject(d.lx, d.ly)); fb->bind(); assert(glGetError() == 0); glViewport(0, 0, d.lx, d.ly); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, d.lx, 0, d.ly); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.375, 0.375, 0.0); assert(glGetError() == 0); tglDraw(rd, vi.getPointer()); assert(glGetError() == 0); assert(glGetError() == 0); glFlush(); assert(glGetError() == 0); QImage img = fb->toImage().scaled(QSize(d.lx, d.ly), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); int wrap = ras->getLx() * sizeof(TPixel32); uchar *srcPix = img.bits(); uchar *dstPix = ras->getRawData() + wrap * (d.ly - 1); for (int y = 0; y < d.ly; y++) { memcpy(dstPix, srcPix, wrap); dstPix -= wrap; srcPix += wrap; } fb->release(); } glMatrixMode(GL_MODELVIEW), glPopMatrix(); glMatrixMode(GL_PROJECTION), glPopMatrix(); glPopAttrib(); tglMakeCurrent(oldContext); TRasterImageP ri = TRasterImageP(ras); ri->setOffset(off + ras->getCenter()); return ri; } } } // Error case: return a dummy image (is it really required?) TRaster32P ras(d); ras->fill(TPixel32(127, 0, 127, 127)); return TRasterImageP(ras); }
void Iwa_TiledParticlesFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri) { std::vector<int> lastframe; std::vector<TLevelP> partLevel; TPointD p_offset; TDimension p_size(0, 0); /*- 参照画像ポートの取得 -*/ std::vector<TRasterFxPort *> part_ports; /*- テクスチャ素材画像のポート -*/ std::map<int, TRasterFxPort *> ctrl_ports; /*- コントロール画像のポート番号/ポート -*/ int portsCount = this->getInputPortCount(); for (int i = 0; i < portsCount; ++i) { std::string tmpName = this->getInputPortName(i); QString portName = QString::fromStdString(tmpName); if (portName.startsWith("T")) { TRasterFxPort *tmpPart = (TRasterFxPort *)this->getInputPort(tmpName); if (tmpPart->isConnected()) part_ports.push_back((TRasterFxPort *)this->getInputPort(tmpName)); } else { portName.replace(QString("Control"), QString("")); TRasterFxPort *tmpCtrl = (TRasterFxPort *)this->getInputPort(tmpName); if (tmpCtrl->isConnected()) ctrl_ports[portName.toInt()] = (TRasterFxPort *)this->getInputPort(tmpName); } } /*- テクスチャ素材のバウンディングボックスを足し合わせる ←この工程、いらないかも?-*/ if (!part_ports.empty()) { TRectD outTileBBox(tile.m_pos, TDimensionD(tile.getRaster()->getLx(), tile.getRaster()->getLy())); TRectD bbox; for (unsigned int i = 0; i < (int)part_ports.size(); ++i) { const TFxTimeRegion &tr = (*part_ports[i])->getTimeRegion(); lastframe.push_back(tr.getLastFrame() + 1); partLevel.push_back(new TLevel()); partLevel[i]->setName((*part_ports[i])->getAlias(0, ri)); // The particles offset must be calculated without considering the affine's translational // component TRenderSettings riZero(ri); riZero.m_affine.a13 = riZero.m_affine.a23 = 0; // Calculate the bboxes union for (int t = 0; t <= tr.getLastFrame(); ++t) { TRectD inputBox; (*part_ports[i])->getBBox(t, inputBox, riZero); bbox += inputBox; } } if (bbox == TConsts::infiniteRectD) bbox *= outTileBBox; p_size.lx = (int)bbox.getLx() + 1; p_size.ly = (int)bbox.getLy() + 1; p_offset = TPointD(0.5 * (bbox.x0 + bbox.x1), 0.5 * (bbox.y0 + bbox.y1)); } else { partLevel.push_back(new TLevel()); partLevel[0]->setName("particles"); TDimension vecsize(10, 10); TOfflineGL *offlineGlContext = new TOfflineGL(vecsize); offlineGlContext->clear(TPixel32(0, 0, 0, 0)); TStroke *stroke; stroke = makeEllipticStroke(0.07, TPointD((vecsize.lx - 1) * .5, (vecsize.ly - 1) * .5), 2.0, 2.0); TVectorImageP vectmp = new TVectorImage(); TPalette *plt = new TPalette(); vectmp->setPalette(plt); vectmp->addStroke(stroke); TVectorRenderData rd(AffI, TRect(vecsize), plt, 0, true, true); offlineGlContext->makeCurrent(); offlineGlContext->draw(vectmp, rd); partLevel[0]->setFrame(0, TRasterImageP(offlineGlContext->getRaster()->clone())); p_size.lx = vecsize.lx + 1; p_size.ly = vecsize.ly + 1; lastframe.push_back(1); delete offlineGlContext; } Iwa_Particles_Engine myEngine(this, frame); // Retrieving the dpi multiplier from the accumulated affine (which is isotropic). That is, // the affine will be applied *before* this effect - and we'll multiply geometrical parameters // by this dpi mult. in order to compensate. float dpi = sqrt(fabs(ri.m_affine.det())) * 100; TTile tileIn; if (TRaster32P raster32 = tile.getRaster()) { TFlash *flash = 0; myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset, ctrl_ports, partLevel, 1, (int)frame, 1, 0, 0, 0, 0, lastframe, getIdentifier()); } else if (TRaster64P raster64 = tile.getRaster()) { TFlash *flash = 0; myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset, ctrl_ports, partLevel, 1, (int)frame, 1, 0, 0, 0, 0, lastframe, getIdentifier()); } else throw TException("ParticlesFx: unsupported Pixel Type"); }
TPixel32 TTranspFader::operator()(const TPixel32 &color) const { return TPixel32(color.r, color.g, color.b, m_transp * color.m); }
Preferences::Preferences() : m_units("mm"), m_cameraUnits("inch"), m_scanLevelType("tif"), m_defLevelWidth(0.0), m_defLevelHeight(0.0), m_defLevelDpi(0.0), m_iconSize(160, 120), m_blankColor(TPixel32::White), m_frontOnionColor(TPixel::Black), m_backOnionColor(TPixel::Black), m_transpCheckBg(TPixel::White), m_transpCheckInk(TPixel::Black), m_transpCheckPaint(TPixel(127, 127, 127)), m_autosavePeriod(15), m_chunkSize(10), m_rasterOptimizedMemory(0), m_shrink(1), m_step(1), m_blanksCount(0), m_keyframeType(3), m_animationStep(1), m_textureSize(0), m_xsheetStep(10), m_shmmax(-1), m_shmseg(-1), m_shmall(-1), m_shmmni(-1), m_onionPaperThickness(50), m_currentLanguage(0), m_currentStyleSheet(0), m_undoMemorySize(100), m_dragCellsBehaviour(0), m_lineTestFpsCapture(25), m_defLevelType(0), m_autocreationType(1), m_autoExposeEnabled(true), m_autoCreateEnabled(true), m_subsceneFolderEnabled(true), m_generatedMovieViewEnabled(true), m_xsheetAutopanEnabled(true), m_ignoreAlphaonColumn1Enabled(false), m_rewindAfterPlaybackEnabled(true), m_fitToFlipbookEnabled(false), m_previewAlwaysOpenNewFlipEnabled(false), m_autosaveEnabled(false), m_defaultViewerEnabled(false), m_saveUnpaintedInCleanup(true), m_askForOverrideRender(true), m_automaticSVNFolderRefreshEnabled(true), m_SVNEnabled(false), m_minimizeSaveboxAfterEditing(true), m_levelsBackupEnabled(false), m_sceneNumberingEnabled(false), m_animationSheetEnabled(false), m_inksOnly(false), m_fillOnlySavebox(false), m_show0ThickLines(true), m_regionAntialias(false), m_viewerBGColor(128, 128, 128, 255), m_previewBGColor(64, 64, 64, 255), m_chessboardColor1(180, 180, 180), m_chessboardColor2(230, 230, 230), m_showRasterImagesDarkenBlendedInViewer(false), m_actualPixelViewOnSceneEditingMode(false), m_viewerZoomCenter(0), m_initialLoadTlvCachingBehavior(0), m_removeSceneNumberFromLoadedLevelName(false), m_replaceAfterSaveLevelAs(true), m_showFrameNumberWithLetters(false), m_levelNameOnEachMarker(false), m_columnIconLoadingPolicy((int)LoadAtOnce), m_moveCurrentFrameByClickCellArea(true), m_onionSkinEnabled(false), m_multiLayerStylePickerEnabled(false), m_paletteTypeOnLoadRasterImageAsColorModel(0), m_showKeyframesOnXsheetCellArea(true) { TCamera camera; m_defLevelType = PLI_XSHLEVEL; m_defLevelWidth = camera.getSize().lx; m_defLevelHeight = camera.getSize().ly; m_defLevelDpi = camera.getDpi().x; TFilePath layoutDir = ToonzFolder::getMyModuleDir(); TFilePath savePath = layoutDir + TFilePath("preferences.ini"); m_settings.reset(new QSettings(QString::fromStdWString(savePath.getWideString()), QSettings::IniFormat)); getValue(*m_settings, "autoExposeEnabled", m_autoExposeEnabled); getValue(*m_settings, "autoCreateEnabled", m_autoCreateEnabled); getValue(*m_settings, "subsceneFolderEnabled", m_subsceneFolderEnabled); getValue(*m_settings, "generatedMovieViewEnabled", m_generatedMovieViewEnabled); getValue(*m_settings, "xsheetAutopanEnabled", m_xsheetAutopanEnabled); getValue(*m_settings, "ignoreAlphaonColumn1Enabled", m_ignoreAlphaonColumn1Enabled); getValue(*m_settings, "rewindAfterPlayback", m_rewindAfterPlaybackEnabled); getValue(*m_settings, "previewAlwaysOpenNewFlip", m_previewAlwaysOpenNewFlipEnabled); getValue(*m_settings, "fitToFlipbook", m_fitToFlipbookEnabled); getValue(*m_settings, "automaticSVNFolderRefreshEnabled", m_automaticSVNFolderRefreshEnabled); getValue(*m_settings, "SVNEnabled", m_SVNEnabled); getValue(*m_settings, "minimizeSaveboxAfterEditing", m_minimizeSaveboxAfterEditing); getValue(*m_settings, "levelsBackupEnabled", m_levelsBackupEnabled); getValue(*m_settings, "sceneNumberingEnabled", m_sceneNumberingEnabled); getValue(*m_settings, "animationSheetEnabled", m_animationSheetEnabled); getValue(*m_settings, "autosaveEnabled", m_autosaveEnabled); getValue(*m_settings, "defaultViewerEnabled", m_defaultViewerEnabled); getValue(*m_settings, "rasterOptimizedMemory", m_rasterOptimizedMemory); getValue(*m_settings, "saveUnpaintedInCleanup", m_saveUnpaintedInCleanup); getValue(*m_settings, "autosavePeriod", m_autosavePeriod); getValue(*m_settings, "taskchunksize", m_chunkSize); getValue(*m_settings, "xsheetStep", m_xsheetStep); int r = 0, g = 0, b = 0; getValue(*m_settings, "frontOnionColor.r", r); getValue(*m_settings, "frontOnionColor.g", g); getValue(*m_settings, "frontOnionColor.b", b); m_frontOnionColor = TPixel32(r, g, b); getValue(*m_settings, "onionPaperThickness", m_onionPaperThickness); r = 0, g = 0, b = 0; getValue(*m_settings, "backOnionColor.r", r); getValue(*m_settings, "backOnionColor.g", g); getValue(*m_settings, "backOnionColor.b", b); m_backOnionColor = TPixel32(r, g, b); r = m_transpCheckBg.r, g = m_transpCheckBg.g, b = m_transpCheckBg.b; getValue(*m_settings, "transpCheckInkOnBlack.r", r); getValue(*m_settings, "transpCheckInkOnBlack.g", g); getValue(*m_settings, "transpCheckInkOnBlack.b", b); m_transpCheckBg = TPixel32(r, g, b); r = m_transpCheckInk.r, g = m_transpCheckInk.g, b = m_transpCheckInk.b; getValue(*m_settings, "transpCheckInkOnWhite.r", r); getValue(*m_settings, "transpCheckInkOnWhite.g", g); getValue(*m_settings, "transpCheckInkOnWhite.b", b); m_transpCheckInk = TPixel32(r, g, b); r = m_transpCheckPaint.r, g = m_transpCheckPaint.g, b = m_transpCheckPaint.b; getValue(*m_settings, "transpCheckPaint.r", r); getValue(*m_settings, "transpCheckPaint.g", g); getValue(*m_settings, "transpCheckPaint.b", b); m_transpCheckPaint = TPixel32(r, g, b); getValue(*m_settings, "onionInksOnly", m_inksOnly); getValue(*m_settings, "iconSizeX", m_iconSize.lx); getValue(*m_settings, "iconSizeY", m_iconSize.ly); getValue(*m_settings, s_show0ThickLines, m_show0ThickLines); getValue(*m_settings, s_regionAntialias, m_regionAntialias); getValue(*m_settings, "viewShrink", m_shrink); getValue(*m_settings, "viewStep", m_step); getValue(*m_settings, "blanksCount", m_blanksCount); getValue(*m_settings, "askForOverrideRender", m_askForOverrideRender); r = 255, g = 255, b = 255; getValue(*m_settings, "blankColor.r", r); getValue(*m_settings, "blankColor.g", g); getValue(*m_settings, "blankColor.b", b); getValue(*m_settings, "undoMemorySize", m_undoMemorySize); setUndoMemorySize(m_undoMemorySize); m_blankColor = TPixel32(r, g, b); QString units; units = m_settings->value("linearUnits").toString(); if (units != "") m_units = units; setUnits(m_units.toStdString()); units = m_settings->value("cameraUnits").toString(); if (units != "") m_cameraUnits = units; setCameraUnits(m_cameraUnits.toStdString()); getValue(*m_settings, "keyframeType", m_keyframeType); getValue(*m_settings, "animationStep", m_animationStep); getValue(*m_settings, "textureSize", m_textureSize); QString scanLevelType; scanLevelType = m_settings->value("scanLevelType").toString(); if (scanLevelType != "") m_scanLevelType = scanLevelType; setScanLevelType(m_scanLevelType.toStdString()); getValue(*m_settings, "shmmax", m_shmmax); getValue(*m_settings, "shmseg", m_shmseg); getValue(*m_settings, "shmall", m_shmall); getValue(*m_settings, "shmmni", m_shmmni); // Load level formats getDefaultLevelFormats(m_levelFormats); getValue(*m_settings, m_levelFormats); std::sort(m_levelFormats.begin(), m_levelFormats.end(), // Format sorting must be formatLess); // enforced TFilePath lang_path = TEnv::getConfigDir() + "loc"; TFilePathSet lang_fpset; m_languageMaps[0] = "english"; //m_currentLanguage=0; try { TFileStatus langPathFs(lang_path); if (langPathFs.doesExist() && langPathFs.isDirectory()) { TSystem::readDirectory(lang_fpset, lang_path, true, false); } else { } TFilePathSet::iterator it = lang_fpset.begin(); int i = 1; for (it; it != lang_fpset.end(); it++, i++) { TFilePath newPath = *it; if (newPath == lang_path) continue; if (TFileStatus(newPath).isDirectory()) { QString string = QString::fromStdWString(newPath.getWideName()); m_languageMaps[i] = string; } } } catch (...) { } TFilePath path(TEnv::getConfigDir() + "qss"); TFilePathSet fpset; try { TSystem::readDirectory(fpset, path, true, false); TFilePathSet::iterator it = fpset.begin(); int i = 0; for (it; it != fpset.end(); it++, i++) { TFilePath newPath = *it; if (newPath == path) continue; QString fpName = QString::fromStdWString(newPath.getWideName()); #ifdef MACOSX QString string = fpName + QString("/") + fpName + QString("_mac.qss"); #else QString string = fpName + QString("/") + fpName + QString(".qss"); #endif if (fpName == QString("standard")) m_currentStyleSheet = i; m_styleSheetMaps[i] = "file:///" + path.getQString() + "/" + string; } } catch (...) { } getValue(*m_settings, "CurrentLanguage", m_currentLanguage); getValue(*m_settings, "CurrentStyleSheet", m_currentStyleSheet); getValue(*m_settings, "DragCellsBehaviour", m_dragCellsBehaviour); getValue(*m_settings, "LineTestFpsCapture", m_lineTestFpsCapture); getValue(*m_settings, "FillOnlysavebox", m_fillOnlySavebox); getValue(*m_settings, "AutocreationType", m_autocreationType); getValue(*m_settings, "DefLevelType", m_defLevelType); getValue(*m_settings, "DefLevelWidth", m_defLevelWidth); getValue(*m_settings, "DefLevelHeight", m_defLevelHeight); getValue(*m_settings, "DefLevelDpi", m_defLevelDpi); getValue(*m_settings, "viewerBGColor", m_viewerBGColor); getValue(*m_settings, "previewBGColor", m_previewBGColor); getValue(*m_settings, "chessboardColor1", m_chessboardColor1); getValue(*m_settings, "chessboardColor2", m_chessboardColor2); getValue(*m_settings, "showRasterImagesDarkenBlendedInViewer", m_showRasterImagesDarkenBlendedInViewer); getValue(*m_settings, "actualPixelViewOnSceneEditingMode", m_actualPixelViewOnSceneEditingMode); getValue(*m_settings, "viewerZoomCenter", m_viewerZoomCenter); getValue(*m_settings, "initialLoadTlvCachingBehavior", m_initialLoadTlvCachingBehavior); getValue(*m_settings, "removeSceneNumberFromLoadedLevelName", m_removeSceneNumberFromLoadedLevelName); getValue(*m_settings, "replaceAfterSaveLevelAs", m_replaceAfterSaveLevelAs); getValue(*m_settings, "showFrameNumberWithLetters", m_showFrameNumberWithLetters); getValue(*m_settings, "levelNameOnEachMarkerEnabled", m_levelNameOnEachMarker); getValue(*m_settings, "columnIconLoadingPolicy", m_columnIconLoadingPolicy); getValue(*m_settings, "moveCurrentFrameByClickCellArea", m_moveCurrentFrameByClickCellArea); getValue(*m_settings, "onionSkinEnabled", m_onionSkinEnabled); getValue(*m_settings, "multiLayerStylePickerEnabled", m_multiLayerStylePickerEnabled); getValue(*m_settings, "paletteTypeOnLoadRasterImageAsColorModel", m_paletteTypeOnLoadRasterImageAsColorModel); getValue(*m_settings, "showKeyframesOnXsheetCellArea", m_showKeyframesOnXsheetCellArea); }
void initColorFx() { //add(new TFriezeStrokeStyle); add(new TRopeStrokeStyle); add(new TChainStrokeStyle); add(new TFurStrokeStyle); //add(new TChalkStrokeStyle); //add(new TBumpStrokeStyle); //add(new TBlendStrokeStyle); add(new TDottedLineStrokeStyle); add(new TBraidStrokeStyle); add(new TSketchStrokeStyle); add(new TBubbleStrokeStyle); add(new TGraphicPenStrokeStyle); add(new TCrystallizeStrokeStyle); add(new TSprayStrokeStyle); add(new TTissueStrokeStyle); //add(new TMultiLineStrokeStyle); add(new TBiColorStrokeStyle); add(new TNormal2StrokeStyle); //add(new TNormalStrokeStyle); //add(new TLongBlendStrokeStyle); add(new TChalkStrokeStyle2); //add(new TDualColorStrokeStyle); add(new TBlendStrokeStyle2); add(new TTwirlStrokeStyle); add(new TMultiLineStrokeStyle2); add(new TZigzagStrokeStyle); //non funziona su linux, rivedere add(new TSinStrokeStyle); add(new TFriezeStrokeStyle2); add(new TDualColorStrokeStyle2()); // non funziona (massimo) su linux, rivedere add(new TLongBlendStrokeStyle2()); add(new TMatrioskaStrokeStyle()); #ifdef _DEBUG add(new OutlineViewerStyle()); #endif add(new MovingSolidColor(TPixel32::Blue, TPointD(10, 10))); //ok //add(new MovingTexture(readTexture("chessboard.bmp"),TTextureStyle::NONE,TPointD(10,10) )); add(new ShadowStyle(TPixel32::White, TPixel32::Black)); add(new ShadowStyle2(TPixel32::Yellow, TPixel32::Magenta)); add(new TRubberFillStyle(TPixel32(255, 0, 255, 127), 25.0)); add(new TPointShadowFillStyle(TPixel32(255, 255, 200), TPixel32(215, 0, 0))); add(new TDottedFillStyle(TPixel32::Green)); add(new TCheckedFillStyle(TPixel32(255, 0, 0, 128))); add(new ArtisticSolidColor(TPixel32(0, 130, 255), TPointD(10, 10), 100)); add(new TChalkFillStyle(TPixel32::White, TPixel32::Black)); //non funziona add(new TChessFillStyle(TPixel32::Red)); add(new TSawToothStrokeStyle); add(new TStripeFillStyle(TPixel32::Green)); add(new TLinGradFillStyle(TPixel32::Green)); add(new TRadGradFillStyle(TPixel32::Green)); add(new TCircleStripeFillStyle(TPixel32::Green)); add(new TMosaicFillStyle(TPixel32::Red)); add(new TPatchFillStyle(TPixel32::Blue)); #ifndef BRAVO add(new TAirbrushRasterStyle(TPixel32::Black, 10)); add(new TBlendRasterStyle(TPixel32::Black, 10)); add(new TNoColorRasterStyle()); #endif }