コード例 #1
0
ファイル: screen.cpp プロジェクト: fingolfin/scummvm
void FrotzScreen::loadVersion6Fonts(Common::Archive *archive) {
	// Set the basic font properties
	MonoFontInfo &mi = g_conf->_monoInfo;
	PropFontInfo &pi = g_conf->_propInfo;
	mi._size = pi._size = 7;
	mi._aspect = pi._aspect = 1.0;
	pi._quotes = 0;
	pi._dashes = 0;
	pi._spaces = 0;
	pi._morePrompt = "[MORE]";
	pi._lineSeparation = 0;

	g_vm->_defaultForeground = 0;
	g_vm->_defaultBackground = (int)zcolor_Transparent;
	g_conf->_tMarginX = 3;

	for (uint idx = 0; idx < style_NUMSTYLES; ++idx) {
		g_conf->_tStyles[idx].bg = g_conf->_tStylesDefault[idx].bg = zcolor_Transparent;
		g_conf->_gStyles[idx].bg = g_conf->_gStylesDefault[idx].bg = zcolor_Transparent;
	}

	_fonts.resize(8);

	// Load up the 8x8 Infocom font
	Image::BitmapDecoder decoder;
	Common::File f;
	if (!f.open("infocom6x8.bmp", *archive))
		error("Could not load font");

	Common::Point fontSize(6, 8);
	decoder.loadStream(f);
	f.close();

	// Add normal fonts
	_fonts[MONOR] = new FixedWidthBitmapFont(*decoder.getSurface(), fontSize, 6, 8);
	_fonts[MONOB] = new FixedWidthBitmapFont(*decoder.getSurface(), fontSize, 6, 8);
	_fonts[PROPR] = new VariableWidthBitmapFont(*decoder.getSurface(), fontSize, 6, 8);
	_fonts[PROPB] = new VariableWidthBitmapFont(*decoder.getSurface(), fontSize, 6, 8);

	// Create a new version of the font with every character unlined for the emphasized fonts
	const Graphics::Surface &norm = *decoder.getSurface();
	Graphics::ManagedSurface emph(norm.w, norm.h);
	emph.blitFrom(norm);

	for (int y = 8 - 2; y < emph.h; y += 8) {
		byte *lineP = (byte *)emph.getBasePtr(0, y);
		Common::fill(lineP, lineP + emph.w, 0);
	}

	// Add them to the font list
	_fonts[MONOI] = new FixedWidthBitmapFont(emph, fontSize, 6, 8);
	_fonts[MONOZ] = new FixedWidthBitmapFont(emph, fontSize, 6, 8);
	_fonts[PROPI] = new VariableWidthBitmapFont(emph, fontSize, 6, 8);
	_fonts[PROPZ] = new VariableWidthBitmapFont(emph, fontSize, 6, 8);
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: DuFace/DailyProgrammer
void MainWindow::setEndNodeStyle(NodeItem* node)
{
    // Change the background style
    QLinearGradient bkgnd(-NodeItem::Radius, -NodeItem::Radius,
        NodeItem::Radius / 2, NodeItem::Radius / 2);
    bkgnd.setColorAt(0, QColor(  0, 255,  38));
    bkgnd.setColorAt(1, QColor(255, 255, 255));
    node->setBackground(bkgnd);

    // Change the border pen
    QBrush brdr(QColor(19, 174, 28));
    node->setBorderPen(QPen(brdr, NodeItem::Border));

    // Change the emphasis
    QRadialGradient emph(0, 0, NodeItem::Radius + 2 * NodeItem::EmphWidth);
    emph.setColorAt(0.50f, QColor(109, 255, 116, 192));
    emph.setColorAt(0.75f, QColor(255, 255, 255,   0));
    node->setEmphasisBrush(emph);
}