本文整理汇总了C++中CBitmap::Blur方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitmap::Blur方法的具体用法?C++ CBitmap::Blur怎么用?C++ CBitmap::Blur使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBitmap
的用法示例。
在下文中一共展示了CBitmap::Blur方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTexture
GLuint CFontTextureRenderer::CreateTexture()
{
//FIXME add support to expand the texture size to the right and not only to the bottom
ApproximateTextureWidth(&texWidth,&texHeight);
atlas = new unsigned char[texWidth * texHeight];
memset(atlas,0,texWidth * texHeight);
cur = atlas;
//! sort the glyphs by height to gain a few pixels
sortByHeight.sort(sortByHeightFunc);
//! insert `outlined/shadowed` glyphs
CopyGlyphsIntoBitmapAtlas(true);
//! blur `outlined/shadowed` glyphs
CBitmap blurbmp;
blurbmp.channels = 1;
blurbmp.xsize = texWidth;
blurbmp.ysize = curY+curHeight;
if (blurbmp.mem == NULL) {
blurbmp.mem = atlas;
blurbmp.Blur(outlinewidth,outlineweight);
blurbmp.mem = NULL;
}
//! adjust outline weight
/*for (int y = 0; y < curY+curHeight; y++) {
unsigned char* src = atlas + y * texWidth;
for (int x = 0; x < texWidth; x++) {
unsigned char luminance = src[x];
src[x] = (unsigned char)std::min(0xFF, outlineweight * luminance);
}
}*/
//! insert `normal` glyphs
CopyGlyphsIntoBitmapAtlas();
//! generate the ogl texture
texHeight = curY + curHeight;
if (!GLEW_ARB_texture_non_power_of_two)
texHeight = next_power_of_2(texHeight);
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
<<<<<<< HEAD:rts/Rendering/glFont.cpp
示例2: CreateTexture
GLuint CFontTextureRenderer::CreateTexture()
{
//FIXME add support to expand the texture size to the right and not only to the bottom
ApproximateTextureWidth(&texWidth,&texHeight);
atlas = new unsigned char[texWidth * texHeight];
memset(atlas,0,texWidth * texHeight);
cur = atlas;
//! sort the glyphs by height to gain a few pixels
sortByHeight.sort(sortByHeightFunc);
//! insert `outlined/shadowed` glyphs
CopyGlyphsIntoBitmapAtlas(true);
//! blur `outlined/shadowed` glyphs
CBitmap blurbmp;
blurbmp.channels = 1;
blurbmp.xsize = texWidth;
blurbmp.ysize = curY+curHeight;
if (blurbmp.mem == NULL) {
blurbmp.mem = atlas;
blurbmp.Blur(outlinewidth,outlineweight);
blurbmp.mem = NULL;
}
//! adjust outline weight
/*for (int y = 0; y < curY+curHeight; y++) {
unsigned char* src = atlas + y * texWidth;
for (int x = 0; x < texWidth; x++) {
unsigned char luminance = src[x];
src[x] = (unsigned char)std::min(0xFF, outlineweight * luminance);
}
}*/
//! insert `normal` glyphs
CopyGlyphsIntoBitmapAtlas();
//! generate the ogl texture
texHeight = curY + curHeight;
if (!gu->supportNPOTs)
texHeight = next_power_of_2(texHeight);
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
if (GLEW_ARB_texture_border_clamp) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
static const GLfloat borderColor[4] = {1.0f,1.0f,1.0f,0.0f};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, texWidth, texHeight, 0, GL_ALPHA, GL_UNSIGNED_BYTE, atlas);
delete[] atlas;
return tex;
}