void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p, const QColor &lightColor, const QColor &darkColor) { int currentRow = getCurrentFrame(); TPixel frontPixel, backPixel; bool inksOnly; Preferences::instance()->getOnionData(frontPixel, backPixel, inksOnly); QColor frontColor((int)frontPixel.r, (int)frontPixel.g, (int)frontPixel.b, 128); QColor backColor((int)backPixel.r, (int)backPixel.g, (int)backPixel.b, 128); OnionSkinMask osMask = TApp::instance()->getCurrentOnionSkin()->getOnionSkinMask(); int mosCount = osMask.getMosCount(); int i; //OnionSkinの円の左上座標のy値 int onionDotYPos = m_dy / 2 - 5; p.setPen(Qt::red); //--- OnionSkinが有効なら実線、無効なら点線 if (!osMask.isEnabled()) { QPen currentPen = p.pen(); currentPen.setStyle(Qt::DashLine); currentPen.setColor(QColor(128, 128, 128, 255)); p.setPen(currentPen); } //カレントフレームにOnionSkinを伸ばすハンドルを描画 { int angle180 = 16 * 180; QRectF handleRect(0, 0, 30, 30); //上向きのハンドル:1フレーム目のときは描画しない if (currentRow > 0) { int y0 = index2y(currentRow) - 15; p.setBrush(QBrush(backColor)); p.drawChord(handleRect.translated(0, y0), 0, angle180); } //下向きのハンドル:最終フレームの時は描画しない std::vector<TFrameId> fids; m_filmstrip->getLevel()->getFids(fids); int frameCount = (int)fids.size(); if (currentRow < frameCount - 1) { int y1 = index2y(currentRow + 1) - 15; p.setBrush(QBrush(frontColor)); p.drawChord(handleRect.translated(0, y1), angle180, angle180); } //--- 動く Onion Skinの描画 その1 //先に線を描く //まず OnionSkinの最大/最小値を取得 int minMos = 0; int maxMos = 0; for (i = 0; i < mosCount; i++) { int mos = osMask.getMos(i); if (minMos > mos) minMos = mos; if (maxMos < mos) maxMos = mos; } p.setBrush(Qt::NoBrush); //min/maxが更新されていたら、線を描く if (minMos < 0) //上方向に伸ばす線 { int y0 = index2y(currentRow + minMos) + onionDotYPos + 10; //10は●の直径 int y1 = index2y(currentRow) - 15; p.drawLine(15, y0, 15, y1); } if (maxMos > 0) //下方向に伸ばす線 { int y0 = index2y(currentRow + 1) + 15; int y1 = index2y(currentRow + maxMos) + onionDotYPos; p.drawLine(15, y0, 15, y1); } } //--- Fix Onion Skinの描画 for (i = 0; i < osMask.getFosCount(); i++) { int fos = osMask.getFos(i); //if(fos == currentRow) continue; int y = index2y(fos) + onionDotYPos; p.setPen(Qt::red); //OnionSkinがDisableなら中空にする p.setBrush(osMask.isEnabled() ? QBrush(QColor(0, 255, 255, 128)) : Qt::NoBrush); p.drawEllipse(0, y, 10, 10); } //--- //--- 動く Onion Skinの描画 その2 //続いて、各OnionSkinの●を描く p.setPen(Qt::red); for (i = 0; i < mosCount; i++) { //mosはOnionSkinの描かれるフレームのオフセット値 int mos = osMask.getMos(i); //100312 iwasawa ハイライトする場合は後で描くのでスキップする if (currentRow + mos == m_highlightedMosFrame) continue; int y = index2y(currentRow + mos) + onionDotYPos; p.setBrush(mos < 0 ? backColor : frontColor); p.drawEllipse(10, y, 10, 10); } //Fix Onion Skin ハイライトの描画 FixOnionSkinがマウスが乗ってハイライトされていて、 //かつ 現在のフレームでないときに描画 if (m_highlightedFosFrame >= 0 && m_highlightedFosFrame != currentRow) { p.setPen(QColor(255, 128, 0)); p.setBrush(QBrush(QColor(255, 255, 0, 200))); p.drawEllipse(0, index2y(m_highlightedFosFrame) + onionDotYPos, 10, 10); } //通常のOnion Skin ハイライトの描画 if (m_highlightedMosFrame >= 0 && m_highlightedMosFrame != currentRow) { p.setPen(QColor(255, 128, 0)); p.setBrush(QBrush(QColor(255, 255, 0, 200))); p.drawEllipse(10, index2y(m_highlightedMosFrame) + onionDotYPos, 10, 10); } }
if (!g_consoleFlag) { return; } static bool stringRectSet = false; static CRect stringRect; if (!stringRectSet) { TheFonts->GetStringMetrics(L"a", 16.0f, 1.0f, "Lucida Console", stringRect); } CRect backRect(0.0f, 0.0f, GetScreenResolutionX(), (16.0f * 25) + 16.0f); CRGBA backColor(0, 0x2b, 0x36, 220); CRGBA frontColor(0xee, 0xe8, 0xd5); TheFonts->DrawRectangle(backRect, backColor); backRect.SetRect(backRect.fX1, backRect.fY2, backRect.fX2, backRect.fY2 + 5.0f); backColor.red *= 0.8; backColor.green *= 0.8; backColor.blue *= 0.8; backColor.alpha = 250; TheFonts->DrawRectangle(backRect, backColor); for (int i = 0; i < 25; i++) { wchar_t str[2048]; int strIdx = 0;
void RowArea::drawOnionSkinSelection(QPainter &p) { TApp *app = TApp::instance(); OnionSkinMask osMask = app->getCurrentOnionSkin()->getOnionSkinMask(); TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet(); assert(xsh); int currentRow = m_viewer->getCurrentRow(); // get onion colors TPixel frontPixel, backPixel; bool inksOnly; Preferences::instance()->getOnionData(frontPixel, backPixel, inksOnly); QColor frontColor((int)frontPixel.r, (int)frontPixel.g, (int)frontPixel.b, 128); QColor backColor((int)backPixel.r, (int)backPixel.g, (int)backPixel.b, 128); int onionDotDiam = 8; int onionHandleDiam = RowHeight - 1; int onionDotYPos = (RowHeight - onionDotDiam) / 2; // If the onion skin is disabled, draw dash line instead. if (osMask.isEnabled()) p.setPen(Qt::red); else { QPen currentPen = p.pen(); currentPen.setStyle(Qt::DashLine); currentPen.setColor(QColor(128, 128, 128, 255)); p.setPen(currentPen); } // Draw onion skin extender handles. QRectF handleRect(3, m_viewer->rowToY(currentRow) + 1, onionHandleDiam, onionHandleDiam); int angle180 = 16 * 180; p.setBrush(QBrush(backColor)); p.drawChord(handleRect, 0, angle180); p.setBrush(QBrush(frontColor)); p.drawChord(handleRect, angle180, angle180); //-- draw movable onions // draw line between onion skin range int minMos = 0; int maxMos = 0; int mosCount = osMask.getMosCount(); for (int i = 0; i < mosCount; i++) { int mos = osMask.getMos(i); if (minMos > mos) minMos = mos; if (maxMos < mos) maxMos = mos; } p.setBrush(Qt::NoBrush); if (minMos < 0) // previous frames { int y0 = m_viewer->rowToY(currentRow + minMos) + onionDotYPos + onionDotDiam; int y1 = m_viewer->rowToY(currentRow); p.drawLine(onionDotDiam*1.5, y0, onionDotDiam*1.5, y1); } if (maxMos > 0) // foward frames { int y0 = m_viewer->rowToY(currentRow + 1); int y1 = m_viewer->rowToY(currentRow + maxMos) + onionDotYPos; p.drawLine(onionDotDiam*1.5, y0, onionDotDiam*1.5, y1); } // draw onion skin dots p.setPen(Qt::red); for (int i = 0; i < mosCount; i++) { // mos : frame offset from the current frame int mos = osMask.getMos(i); // skip drawing if the frame is under the mouse cursor if (m_showOnionToSet == Mos && currentRow + mos == m_row) continue; int y = m_viewer->rowToY(currentRow + mos) + onionDotYPos; if (osMask.isEnabled()) p.setBrush(mos < 0 ? backColor : frontColor); else p.setBrush(Qt::NoBrush); p.drawEllipse(onionDotDiam, y, onionDotDiam, onionDotDiam); } //-- draw fixed onions for (int i = 0; i < osMask.getFosCount(); i++) { int fos = osMask.getFos(i); if (fos == currentRow) continue; // skip drawing if the frame is under the mouse cursor if (m_showOnionToSet == Fos && fos == m_row) continue; int y = m_viewer->rowToY(fos) + onionDotYPos; if (osMask.isEnabled()) p.setBrush(QBrush(QColor(0, 255, 255, 128))); else p.setBrush(Qt::NoBrush); p.drawEllipse(0, y, onionDotDiam, onionDotDiam); } //-- draw highlighted onion if (m_showOnionToSet != None) { int y = m_viewer->rowToY(m_row) + onionDotYPos; int xPos = (m_showOnionToSet == Fos) ? 0 : onionDotDiam; p.setPen(QColor(255, 128, 0)); p.setBrush(QBrush(QColor(255, 255, 0, 200))); p.drawEllipse(xPos, y, onionDotDiam, onionDotDiam); } }