本文整理汇总了C++中PixelBuffer::get_size方法的典型用法代码示例。如果您正苦于以下问题:C++ PixelBuffer::get_size方法的具体用法?C++ PixelBuffer::get_size怎么用?C++ PixelBuffer::get_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PixelBuffer
的用法示例。
在下文中一共展示了PixelBuffer::get_size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: batcher
HSVSprite::HSVSprite(Canvas &canvas, HSVSpriteBatch *batcher, const std::string &image_filename)
: batcher(batcher)
{
PixelBuffer image = ImageProviderFactory::load(image_filename);
Subtexture subtexture = batcher->alloc_sprite(canvas, image.get_size());
geometry = subtexture.get_geometry();
texture = subtexture.get_texture();
texture.set_subimage(canvas, geometry.get_top_left(), image, image.get_size());
}
示例2:
TransferTexture::TransferTexture(GraphicContext &gc, const PixelBuffer &pbuff, PixelBufferDirection direction, BufferUsage usage)
{
GraphicContextProvider *gc_provider = gc.get_provider();
PixelBufferProvider *provider = gc_provider->alloc_pixel_buffer();
*this = TransferTexture(provider);
provider->create(pbuff.get_data(), pbuff.get_size(), direction, pbuff.get_format(), usage);
}
示例3: Point
Texture2D::Texture2D( GraphicContext &context, const std::string &filename, const FileSystem &fs, const ImageImportDescription &import_desc)
{
PixelBuffer pb = ImageProviderFactory::load(filename, fs, std::string());
pb = import_desc.process(pb);
*this = Texture2D(context, pb.get_width(), pb.get_height(), import_desc.is_srgb() ? tf_srgb8_alpha8 : tf_rgba8);
set_subimage(context, Point(0, 0), pb, Rect(pb.get_size()), 0);
impl->provider->set_wrap_mode(impl->wrap_mode_s, impl->wrap_mode_t);
}
示例4:
void Texture2DArray::set_image(GraphicContext &context, int array_index, const PixelBuffer &image, int level)
{
impl->provider->copy_from(context, 0, 0, array_index, level, image, image.get_size());
}
示例5: Exception
//.........这里部分代码省略.........
vertex_data[y*6*2+0].position = Vec3f(0, -0.1f, (float)y);
vertex_data[y*6*2+1].position = Vec3f(0, (float)height1, (float)y);
vertex_data[y*6*2+2].position = Vec3f(0, (float)height2, (float)y+1);
vertex_data[y*6*2+3].position = Vec3f(0, (float)height2, (float)y+1);
vertex_data[y*6*2+4].position = Vec3f(0, -0.1f, (float)y+1);
vertex_data[y*6*2+5].position = Vec3f(0, -0.1f, (float)y);
vertex_data[y*6*2+11].position = Vec3f((float)width+1, -0.1f, (float)y);
vertex_data[y*6*2+10].position = Vec3f((float)width+1, (float)height3, (float)y);
vertex_data[y*6*2+9].position = Vec3f((float)width+1, (float)height4, (float)y+1);
vertex_data[y*6*2+8].position = Vec3f((float)width+1, (float)height4, (float)y+1);
vertex_data[y*6*2+7].position = Vec3f((float)width+1, -0.1f, (float)y+1);
vertex_data[y*6*2+6].position = Vec3f((float)width+1, -0.1f, (float)y);
for (int i = 0; i < 6; i++)
vertex_data[y*6*2+i].normal = Vec3f(-1, 0, 0);
for (int i = 0; i < 6; i++)
vertex_data[y*6*2+6+i].normal = Vec3f(1, 0, 0);
}
vertex_data += height*6*2;
unsigned int *line1 = reinterpret_cast<unsigned int *>(data);
unsigned int *line2 = reinterpret_cast<unsigned int *>(data + height*pitch);
for (int x = 0; x < width; x++)
{
float scale = 0.4f;
float height1 = (line1[x] >> 24)*scale;
float height2 = (line1[x+1] >> 24)*scale;
float height3 = (line2[x] >> 24)*scale;
float height4 = (line2[x+1] >> 24)*scale;
vertex_data[x*6*2+5].position = Vec3f((float)x, -0.1f, 0);
vertex_data[x*6*2+4].position = Vec3f((float)x, (float)height1, 0);
vertex_data[x*6*2+3].position = Vec3f((float)x+1, (float)height2, 0);
vertex_data[x*6*2+2].position = Vec3f((float)x+1, (float)height2, 0);
vertex_data[x*6*2+1].position = Vec3f((float)x+1, -0.1f, 0);
vertex_data[x*6*2+0].position = Vec3f((float)x, -0.1f, 0);
vertex_data[x*6*2+6].position = Vec3f((float)x, -0.1f, (float)height+1);
vertex_data[x*6*2+7].position = Vec3f((float)x, (float)height3, (float)height+1);
vertex_data[x*6*2+8].position = Vec3f((float)x+1, (float)height4, (float)height+1);
vertex_data[x*6*2+9].position = Vec3f((float)x+1, (float)height4, (float)height+1);
vertex_data[x*6*2+10].position = Vec3f((float)x+1, -0.1f, (float)height+1);
vertex_data[x*6*2+11].position = Vec3f((float)x, -0.1f, (float)height+1);
for (int i = 0; i < 6; i++)
vertex_data[x*6*2+i].normal = Vec3f(0, 0, -1);
for (int i = 0; i < 6; i++)
vertex_data[x*6*2+6+i].normal = Vec3f(0, 0, 1);
}
vertex_data += width*6*2;
vertex_data[0].position = Vec3f(0, -0.1f, 0);
vertex_data[1].position = Vec3f((float)width, -0.1f, 0);
vertex_data[2].position = Vec3f((float)width, -0.1f, (float)height);
vertex_data[3].position = Vec3f((float)width, -0.1f, (float)height);
vertex_data[4].position = Vec3f(0, -0.1f, (float)height);
vertex_data[5].position = Vec3f(0, -0.1f, 0);
for (int i = 0; i < 6; i++)
vertex_data[i].normal = Vec3f(0, -1, 0);
*/
vertex_buffer.unlock();
size = Size(width+1, height+1);
this->area_count = area_count;
VirtualDirectory vdir;
shader_program = ProgramObject::load(gc, "Resources/map_vertex.glsl", "Resources/map_fragment.glsl", vdir);
shader_program.bind_attribute_location(0, "in_position");
shader_program.bind_attribute_location(1, "in_normal");
if (!shader_program.link())
throw Exception("Map shader program failed to link: " + shader_program.get_info_log());
texture_base = Texture2D(gc, texture_png);
texture_base.set_min_filter(filter_linear);
texture_base.set_mag_filter(filter_linear);
// Change the values between area colors to avoid GPUs merging them together
PixelBuffer image = ImageProviderFactory::load(areas_png).to_format(tf_rgba8);
unsigned int* image_data = reinterpret_cast<unsigned int*>(image.get_data());
int image_total_pixels = image.get_width()*image.get_height();
for (int i = 0; i < image_total_pixels; i++)
{
unsigned int area_color = (image_data[i]>>24)*255/area_count;
image_data[i] = (area_color<<24)+(area_color<<16)+(area_color<<8)+area_color;
}
texture_areas = Texture2D(gc, image.get_size());
texture_areas.set_image(image);
texture_areas.set_min_filter(filter_nearest);
texture_areas.set_mag_filter(filter_nearest);
texture_borders = Texture2D(gc, borders_png);
texture_borders.set_min_filter(filter_linear);
texture_borders.set_mag_filter(filter_linear);
}
示例6: set_image
void TextureCube::set_image(GraphicContext &context, TextureCubeDirection cube_direction, PixelBuffer &image, int level)
{
int array_index = static_cast<int>(cube_direction);
impl->provider->copy_from(context, 0, 0, array_index, level, image, image.get_size());
}
示例7:
void Texture3D::set_image(GraphicContext &context, PixelBuffer &image, int depth, int level)
{
impl->provider->copy_from(context, 0, 0, depth, level, image, image.get_size());
}
示例8:
Texture2D::Texture2D(GraphicContext &context, const PixelBuffer &image, bool is_srgb)
{
*this = Texture2D(context, image, image.get_size(), is_srgb);
}
示例9: create_ico_helper
DataBuffer CursorProvider_Win32::create_ico_file(const PixelBuffer &image)
{
return create_ico_helper(image, Rectf(image.get_size()), 1, Point(0, 0));
}