Ejemplo n.º 1
0
BadaBitmap::BadaBitmap(const std::string& fileName) :
		m_pixels(null),
		m_width(0),
		m_height(0)
{
	if(s_image == null)
	{
		s_image = new Osp::Media::Image();
		if(s_image->Construct() != E_SUCCESS)
		{
			AppAssertf(0, "BadaBitmap::BadaBitmap - could not construct image object.");
		}
	}
	Osp::Base::String badaFile(fileName.c_str());
	std::auto_ptr<Osp::Graphics::Bitmap> bitmap(s_image->DecodeN(badaFile, Osp::Graphics::BITMAP_PIXEL_FORMAT_ARGB8888));

	AppAssertf(bitmap.get() != null, "BadaBitmap::BadaBitmap - could not load image %s", fileName.c_str());

	m_width = bitmap->GetWidth();
	m_height = bitmap->GetHeight();

	copyBitmap(bitmap.get());

	fixColors();
}
void AdjMatrix::loadMatrix()
{
    int color = 1;

    for(int i = 0, posRow = 0; i < nr; i++)
    {
        for(int j = 0, posCol = 0; j < nr; j++)
        {
            if(i%r == 0 && j == 0)
            {
                cycleN[i].setCyclePosRow(j,++posRow);
            }
            else
            {
                cycleN[i].setCyclePosRow(j,posRow);
            }

            if(j%r == 0)
            {
                cycleN[i].setCyclePosCol(j,++posCol);
            }
            else
            {
                cycleN[i].setCyclePosCol(j,posCol);
            }

            if(j < i && cycleN[i].getCyclePosRow(j)-cycleN[i].getCyclePosCol(j) == 0)
            {
                cycleN[i].setR(j);
                numOfEdges++;
            }
            else if(j == i)
            {
                if(color > 2*r)
                    color = 1;
                cycleN[i].setColor(j,color++);
                cycleN[i].setVertexNum(j,vertex++);
            }
            else if(cycleN[i].getCyclePosRow(j)-cycleN[i].getCyclePosCol(j) == 1 ||
                    n-cycleN[i].getCyclePosRow(j) == 0 && n-cycleN[i].getCyclePosCol(j) == 4)
            {
                cycleN[i].setR(j);
            }
        }
    }
    if(n%2)
    {
        fixColors();
    }

    makePlanes();
}
Ejemplo n.º 3
0
QTextDocument *TalkablePainter::getDescriptionDocument(int width)
{
    if (DescriptionDocument)
        return DescriptionDocument;

    fixColors();

    const QColor &color = drawSelected() || drawDisabled() || !Configuration->useConfigurationColors()
                              ? textColor()
                              : Configuration->descriptionColor();
    DescriptionDocument = createDescriptionDocument(Index.data(DescriptionRole).toString(), width, color);
    return DescriptionDocument;
}
Ejemplo n.º 4
0
void TalkablePainter::paint(QPainter *painter)
{
    ItemRect = Option.rect;
    ItemRect.adjust(HFrameMargin, VFrameMargin, -HFrameMargin, -VFrameMargin);

    computeLayout();

    fixColors();

    // some bit of broken logic
    if (drawSelected() || drawDisabled() || !Configuration->useConfigurationColors())
        painter->setPen(textColor());
    else
    {
        Buddy buddy = Index.data(BuddyRole).value<Buddy>();
        Contact contact = Index.data(ContactRole).value<Contact>();
        if (buddy.isBlocked() || contact.isBlocking())
            painter->setPen(QColor(255, 0, 0));
        else
            painter->setPen(Configuration->fontColor());
    }

    paintCheckbox(painter);
    paintIcon(painter);
    paintAvatar(painter);
    paintIdentityName(painter);
    paintName(painter);
    paintDescription(painter);

    /*
    paintDebugRect(painter, ItemRect, QColor(255, 0, 0));
    paintDebugRect(painter, CheckboxRect, QColor(255, 255, 0));
    paintDebugRect(painter, IconRect, QColor(0, 255, 0));
    paintDebugRect(painter, AvatarRect, QColor(0, 0, 255));
    paintDebugRect(painter, IdentityNameRect, QColor(255, 0, 255));
    paintDebugRect(painter, NameRect, QColor(0, 255, 255));
    paintDebugRect(painter, DescriptionRect, QColor(0, 0, 0));
    */
}