Esempio n. 1
0
	void update()
	{
		m_pImage->clear(0xff000000); // a=ff, r=00, g=00, b=00
		HelloModel* pModel = m_pController->model();
		m_pImage->text(g_szMessage, pModel->x(), pModel->y(), TEXT_SIZE, 0xffffff30); // a=ff, r=ff, g=ff, b=30
		m_pCanvas->setImage(m_pImage);
	}
Esempio n. 2
0
// static
void GPlotWindow::stringLabel(GImage* pImage, const char* szText, int x, int y, float size, unsigned int color, double angle)
{
	// Draw the label such that it ends at the center of the temp image
	int width = GImage::measureTextWidth(szText, size);
	int nSize = (int)(std::max((float)width, size * 12) * 2.3);
	GImage tmp;
	tmp.setSize(nSize, nSize);
	tmp.clear(0x0);
	tmp.text(szText, nSize / 2 - width, (int)((nSize - size * 12) / 2), size, color, 1000, 1000);

	// Rotate the label around the center
	GImage tmp2;
	tmp2.rotate(&tmp, nSize / 2, nSize / 2, angle);

	// Blit such that the label ends at the specified point
	GRect r(0, 0, nSize, nSize);
	pImage->blitAlpha(x - nSize / 2, y - nSize / 2, &tmp2, &r);
}