Exemple #1
0
static void fontPrintTextImpl(FT_Bitmap* bitmap, int xofs, int yofs, u32 text_color, u32* framebuffer, int width, int height, int lineSize){
	int x, y;
	
	u8* line = bitmap->buffer;
	u32* fbLine = framebuffer + xofs + yofs * lineSize;
	for (y = 0; y < bitmap->rows; y++) {
		u8* column = line;
		u32* fbColumn = fbLine;
		for (x = 0; x < bitmap->width; x++) {
			if (x + xofs < width && x + xofs >= 0 && y + yofs < height && y + yofs >= 0) {
				u8 val = *column;
				u32 color = *fbColumn;

				float f_val = ((float)val) / 255.0;
				f_val *= Af(text_color);

				float r = min(1.0, Rf(text_color) * f_val + Rf(color) * (1.0 - f_val));
				float g = min(1.0, Gf(text_color) * f_val + Gf(color) * (1.0 - f_val));
				float b = min(1.0, Bf(text_color) * f_val + Bf(color) * (1.0 - f_val));
				float a = min(1.0, Af(color) + f_val);

				*fbColumn = RGBAf(r, g, b, a);
			}
			column++;
			fbColumn++;
		}
		line += bitmap->pitch;
		fbLine += lineSize;
	}

//	gePrintDebug(0x100, "fontPrintTextImpl(bitmap, %d, %d, 0x%8.8X, framebuffer, %d, %d, %d)\n", xofs, yofs, color, width, height, lineSize);
	/*
	u8* line = bitmap->buffer;
	u32* fbLine = framebuffer + xofs + yofs * lineSize;
	for (y = 0; y < bitmap->rows; y++) {
		u8* column = line;
		u32* fbColumn = fbLine;
		for (x = 0; x < bitmap->width; x++) {
			if (x + xofs < width && x + xofs >= 0 && y + yofs < height && y + yofs >= 0) {
				u8 val = *column;
				color = *fbColumn;
				u8 r = color & 0xff;
				u8 g = (color >> 8) & 0xff;
				u8 b = (color >> 16) & 0xff;
				u8 a = (color >> 24) & 0xff;
				r = rf * val / 255 + (255 - val) * r / 255;
				g = gf * val / 255 + (255 - val) * g / 255;
				b = bf * val / 255 + (255 - val) * b / 255;
				a = af * val / 255 + (255 - val) * a / 255;
				*fbColumn = RGBA(r, g, b, a);
			//	*fbColumn = RGBA(255, 255, 255, val);
			}
			column++;
			fbColumn++;
		}
		line += bitmap->pitch;
		fbLine += lineSize;
	}
	*/
}
/*! Creates the individual force matrices for all contacts in the list using
	frictionConstraintMatrix() then assembles them in block diagonal form.
*/
Matrix
Contact::frictionForceBlockMatrix(const std::list<Contact*> &contacts)
{
	if (contacts.empty()) {
		return Matrix(0,0);
	}
	std::list<Matrix*> blocks;
	std::list<Contact*>::const_iterator it;
	for (it=contacts.begin(); it!=contacts.end(); it++) {
		blocks.push_back( new Matrix((*it)->frictionForceMatrix()) );
	}
	Matrix Rf(Matrix::BLOCKDIAG<Matrix>(&blocks));
	while (!blocks.empty()) {
		delete blocks.back();
		blocks.pop_back();
	}
	return Rf;
}
Exemple #3
0
void geClearColor(u32 color){
	libge_context->clear_color = color;
	glClearColor(Rf(libge_context->clear_color), Gf(libge_context->clear_color), Bf(libge_context->clear_color), Af(libge_context->clear_color));
}