void KisTextBrush::updateBrush() { Q_ASSERT((brushType() == PIPE_MASK) || (brushType() == MASK)); if (brushType() == PIPE_MASK) { m_brushesPipe->setText(m_text, m_font); setBrushTipImage(m_brushesPipe->firstBrush()->brushTipImage()); } else { /* if (brushType() == MASK)*/ setBrushTipImage(KisTextBrushesPipe::renderChar(m_text, m_font)); } resetBoundary(); setValid(true); }
void KisTextBrush::updateBrush() { QFontMetrics metric(m_font); int w = metric.width(m_txt); int h = metric.height(); // don't crash, if there is no text if (w==0) w=1; if (h==0) h=1; QPixmap px(w, h); QPainter p; p.begin(&px); p.setFont(m_font); p.fillRect(0, 0, w, h, Qt::white); p.setPen(Qt::black); p.drawText(0, metric.ascent(), m_txt); p.end(); setImage(px.toImage()); setValid(true); resetBoundary(); }
void Chunk::doWork(){ double maxChange = 0.0; double * temp; iterations++; if((iterations == ITER)&&(CkMyPe()==0)) numFinished++; //if (thisIndex == 0) // CkPrintf("Iteration: %d\n",iterations); for (int i=0; i<WORK; ++i) { resetBoundary(); if((thisIndex !=0)&&(thisIndex != total-1)) for (int i=1; i<myxdim+1; i++) for (int j=1; j<myydim-1; j++) { B[indexof(i,j,myydim)] = (0.2)*(A[indexof(i, j, myydim)] + A[indexof(i, j+1,myydim)] + A[indexof(i, j-1,myydim)] + A[indexof(i+1,j, myydim)] + A[indexof(i-1,j, myydim)]); double change = B[indexof(i,j,myydim)] - A[indexof(i,j,myydim)]; if (change < 0) change = - change; if (change > maxChange) maxChange = change; } if(thisIndex == 0) for (int i=1; i<myxdim; i++) for (int j=1; j<myydim-1; j++) { B[indexof(i,j,myydim)] = (0.2)*(A[indexof(i, j, myydim)] + A[indexof(i, j+1,myydim)] + A[indexof(i, j-1,myydim)] + A[indexof(i+1,j, myydim)] + A[indexof(i-1,j, myydim)]); double change = B[indexof(i,j,myydim)] - A[indexof(i,j,myydim)]; if (change < 0) change = - change; if (change > maxChange) maxChange = change; } if(thisIndex == total-1) { for (int i=1; i<myxdim; i++) for (int j=1; j<myydim-1; j++) { B[indexof(i,j,myydim)] = (0.2)*(A[indexof(i, j, myydim)] + A[indexof(i, j+1,myydim)] + A[indexof(i, j-1,myydim)] + A[indexof(i+1,j, myydim)] + A[indexof(i-1,j, myydim)]); double change = B[indexof(i,j,myydim)] - A[indexof(i,j,myydim)]; if (change < 0) change = - change; if (change > maxChange) maxChange = change; } } temp = A; A =B; B=temp; } }