Beispiel #1
0
// run - paint the QImage
void timeConsumingThread::run()
{
   int i_ctr = 60;
   int j_ctr = 60;
   QImage myQImage(i_ctr, j_ctr, QImage::Format_RGB32);
   QPainter painter(&myQImage);
   for (int nMainCounter = 0; nMainCounter < 1000; nMainCounter++)
   {
    for (int i=0; i<i_ctr; i++)
    {
      for (int j=0; j<j_ctr; j++)
      {
         double hue = (double)(i + j + i*j)/361200.0;
         QColor myColor;
         myColor.setHsvF(hue, 1.0, 1.0, 1.0);
         painter.setPen(myColor);
         painter.drawPoint(i, j);
      }
    }   
    // emit theImage(myQImage);
    int x = GetRNDValue(0, 600);
    int y = GetRNDValue(0, 600);
    emit theImage(QRect(x, y, i_ctr, j_ctr), myQImage);
   }
}
Beispiel #2
0
ImageActorPtr ImageActor::New( Image* anImage )
{
  ImageActorPtr actor( new ImageActor() );
  ImagePtr theImage( anImage );

  // Second-phase construction
  actor->Initialize();
  NinePatchImage* ninePatchImage = NULL;

  // Automatically convert upcasted nine-patch images to cropped bitmap
  ninePatchImage = NinePatchImage::GetNinePatchImage( anImage );

  if( ninePatchImage != NULL )
  {
    theImage = ninePatchImage->CreateCroppedBitmapImage();
  }

  // Create the attachment
  actor->mImageAttachment = ImageAttachment::New( *actor->mNode, theImage.Get() );
  actor->Attach( *actor->mImageAttachment );

  // Adjust the actor's size
  if( theImage )
  {
    actor->mImageNext.Set( theImage.Get(), false );
    actor->OnImageSet( *theImage );
    actor->SetNaturalSize( *theImage );
  }

  if( ninePatchImage != NULL )
  {
    actor->SetStyle( Dali::ImageActor::STYLE_NINE_PATCH );
    Vector4 border = ninePatchImage->GetStretchBorders();
    actor->SetNinePatchBorder( border, true );
  }

  return actor;
}