本文整理汇总了C++中clan::Canvas::fill_rect方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::fill_rect方法的具体用法?C++ Canvas::fill_rect怎么用?C++ Canvas::fill_rect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clan::Canvas
的用法示例。
在下文中一共展示了Canvas::fill_rect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_render
void GridComponent::on_render(clan::Canvas &canvas, const clan::Rect &update_rect)
{
set_cliprect(canvas, get_size());
clan::Rect g = get_geometry().get_size();
bool tab_parent = (get_parent_component()->get_tag_name() == "tabpage");
if (tab_parent)
{
canvas.fill_rect( g, clan::Colorf::whitesmoke);
}
else
{
//canvas.fill_rect( g, clan::Colorf::darkgray);
canvas.fill_rect( g, clan::Colorf(199/255.0f, 209/255.0f, 224/255.0f));
canvas.fill_rect( boundary, clan::Colorf::lightgrey/*clan::Colorf("E0DFE3")*/);
}
/*
if (!tab_parent)
{
clan::Draw::line(canvas, (float)boundary.left, (float)boundary.bottom, (float)boundary.right, (float)boundary.bottom, clan::Colorf::black);
clan::Draw::line(canvas, (float)boundary.right, (float)boundary.top, (float)boundary.right, (float)boundary.bottom, clan::Colorf::black);
// canvas.fill_rect( get_boundary_grabber_se(), clan::Colorf::darkslategray);
}
*/
clan::Rect framebox = part_windowframe.get_content_box(boundary);
framebox.translate(-framebox.left, -framebox.top);
part_windowframe.render_box(canvas, framebox);
reset_cliprect(canvas);
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:31,代码来源:grid_component.cpp示例2: linec
void why::Application::draw_info_box(clan::Canvas &c)
{
c.fill_rect(m_world_area, clan::Colorf(0.0f, 0.0f, 0.0f, 0.6f));
static clan:: Colorf linec(clan::Colorf::white);
linec.set_alpha(0.3f);
c.draw_box(m_world_area, linec);
}
开发者ID:vdell,项目名称:inertia,代码行数:8,代码来源:why_app.cpp示例3: on_render_overlay
void GridComponent::on_render_overlay(clan::Canvas &canvas, const clan::Rect &update_rect)
{
set_cliprect(canvas, get_size());
std::vector<GridObject *> selection = main_window->get_selection()->get_selection();
for (size_t i = 0; i < selection.size(); i++)
{
clan::Rect grabbers[8] =
{
selection[i]->get_grabber_e(),
selection[i]->get_grabber_se(),
selection[i]->get_grabber_s(),
selection[i]->get_grabber_sw(),
selection[i]->get_grabber_w(),
selection[i]->get_grabber_nw(),
selection[i]->get_grabber_n(),
selection[i]->get_grabber_ne()
};
for (int j=0; j<8; j++)
grabbers[j] = window_to_component_coords(selection[i]->component_to_window_coords(grabbers[j]));
clan::Rect pos = window_to_component_coords(selection[i]->component_to_window_coords(selection[i]->get_size()));
pos.expand(4,4,3,3);
canvas.draw_box( pos, clan::Colorf(100.0f/255.0f, 100.0f/255.0f, 100.0f/255.0f, 0.25f));
for (int j=0; j<8; j++)
{
canvas.fill_rect( grabbers[j], clan::Colorf::white);
canvas.draw_box( grabbers[j], clan::Colorf::black);
}
}
if (netselect_box.get_size() != clan::Size(0,0))
{
clan::Rect box = netselect_box;
box.translate(component_container->get_geometry().left, component_container->get_geometry().top);
clan::Colorf c = clan::Colorf::blue;
c.set_alpha(0.1f);
canvas.fill_rect( box, c);
canvas.draw_box( box, clan::Colorf::blue);
}
reset_cliprect(canvas);
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:45,代码来源:grid_component.cpp示例4: draw_section
void Alpha::draw_section(clan::Canvas &canvas, clan::Font &font, int yoffset, const clan::Colorf &background, const clan::Colorf &vertex_colour, const clan::Colorf &image_colour)
{
// Draw the background without blending to set the specified RGBA
canvas.set_blend_state(blend_disabled);
const int outer_area_size = 32;
const int outer_xoffset = 8;
canvas.fill_rect( outer_xoffset, yoffset, outer_xoffset + outer_area_size, yoffset + outer_area_size, background);
canvas.set_blend_state(blend_enabled);
// Create the image
clan::Image image = create_block(canvas, image_colour);
// Draw the image
image.set_color(vertex_colour);
image.draw(canvas, outer_xoffset + (outer_area_size - image.get_width())/2, yoffset + (outer_area_size - image.get_height())/2);
// Get the composited pixel buffer
clan::Rect rect(outer_xoffset + outer_area_size / 2, (yoffset + outer_area_size / 2), clan::Size(64,64));
clan::PixelBuffer pbuff = canvas.get_pixeldata(rect, clan::tf_rgba8);
pbuff.lock(canvas, clan::access_read_only);
clan::ImageProviderFactory::save(pbuff, "test.png");
clan::Colorf output = pbuff.get_pixel(0,0);
pbuff.unlock();
// Create the information string
std::string info(clan::string_format("Initial Destination Colour: RGBA = %1, %2, %3, %4", background.r , background.g, background.b, background.a));
int xpos = outer_xoffset + outer_area_size + 8;
int ypos = yoffset - 4;
font.draw_text(canvas, xpos, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Vertex Colour: RGBA = %1, %2, %3, %4", vertex_colour.r , vertex_colour.g, vertex_colour.b, vertex_colour.a));
ypos += 16;
font.draw_text(canvas, xpos, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Image Colour: RGBA = %1, %2, %3, %4", image_colour.r , image_colour.g, image_colour.b, image_colour.a));
ypos += 16;
font.draw_text(canvas, xpos, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Destination Colour: RGBA = %1, %2, %3, %4", output.r , output.g, output.b, output.a));
ypos += 16;
font.draw_text(canvas, xpos, ypos, info, clan::Colorf::black);
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:48,代码来源:alpha.cpp示例5: render
void Note_Single::render(UI::Tracker const &tracker, clan::Canvas &canvas) const
{
if (this->getScore().rank != EJRank::NONE) return;
rectf p = tracker.getNoteRect(this->getKey(), this->getTick());
if (p.left > tracker.get_width () || p.right < 0)
return;
if (p.top > tracker.get_height())
return;
p.top = tracker.get_height() - p.top;
p.bottom = tracker.get_height() - p.bottom;
// Clip note to edge of tracker
if (p.bottom > tracker.get_height()) {
p.top = tracker.get_height() - std::abs(p.bottom - p.top);
p.bottom = tracker.get_height();
}
clan::Colorf color;
switch (getKey())
{
case ENKey::NOTE_P1_1:
case ENKey::NOTE_P1_3:
case ENKey::NOTE_P1_5:
case ENKey::NOTE_P1_7:
color = clan::Colorf::white;
break;
case ENKey::NOTE_P1_2:
case ENKey::NOTE_P1_6:
color = clan::Colorf::cyan;
break;
case ENKey::NOTE_P1_4:
color = clan::Colorf::gold;
break;
default:
color = clan::Colorf::white;
}
canvas.fill_rect(p, color);
}
开发者ID:keigen-shu,项目名称:LostWave,代码行数:43,代码来源:Note.cpp示例6: on_render
void Options::on_render(clan::Canvas &canvas, const clan::Rect &update_rect)
{
clan::Rect rect = get_geometry();
canvas.fill_rect(update_rect, clan::Colorf(0.6f, 0.6f, 0.2f, 1.0f));
}
开发者ID:punkkeks,项目名称:ClanLib,代码行数:5,代码来源:options.cpp示例7: draw_section
void Alpha::draw_section(clan::Canvas &canvas, clan::Font &font, int yoffset, const clan::Colorf &background, const clan::Colorf &vertex_colour, const clan::Colorf &image_colour)
{
// Draw the background without blending to set the specified RGBA
canvas.set_blend_state(blend_disabled);
const int outer_area_size = 32;
const int outer_xoffset = 8;
canvas.fill_rect( outer_xoffset, yoffset, outer_xoffset + outer_area_size, yoffset + outer_area_size, background);
canvas.set_blend_state(blend_enabled);
// Create the image
clan::Image image = create_block(canvas, image_colour);
// Draw the image
image.set_color(vertex_colour);
image.draw(canvas, outer_xoffset + (outer_area_size - image.get_width())/2, yoffset + (outer_area_size - image.get_height())/2);
clan::Colorf output;
// Get the composited pixel buffer
clan::Rectf rect(outer_xoffset + outer_area_size / 2, (yoffset + outer_area_size / 2), clan::Sizef(64,64));
if (rect.is_inside(canvas.get_size()))
{
clan::PixelBuffer pbuff = canvas.get_pixeldata(rect, clan::tf_rgba8);
pbuff.lock(canvas, clan::access_read_only);
//clan::ImageProviderFactory::save(pbuff, "test.png");
clan::Colorf output = pbuff.get_pixel(0, 0);
pbuff.unlock();
}
// Create the information string
std::string info(clan::string_format("Background = %1, %2, %3, %4", get_text(background.r), get_text(background.g), get_text(background.b), get_text(background.a)));
int xpos = outer_xoffset + outer_area_size + 8;
int ypos = yoffset + 12;
font.draw_text(canvas, xpos, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Vertex = %1, %2, %3, %4", get_text(vertex_colour.r), get_text(vertex_colour.g), get_text(vertex_colour.b), get_text(vertex_colour.a)));
font.draw_text(canvas, xpos + 250, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Image = %1, %2, %3, %4", get_text(image_colour.r), get_text(image_colour.g), get_text(image_colour.b), get_text(image_colour.a)));
font.draw_text(canvas, xpos + 500, ypos, info, clan::Colorf::black);
ypos += 20;
clan::Colorf source(vertex_colour * image_colour);
clan::Colorf calculated;
calculated.r = source.a * source.r + (1.0f - source.a) * background.r;
calculated.g = source.a * source.g + (1.0f - source.a) * background.g;
calculated.b = source.a * source.b + (1.0f - source.a) * background.b;
calculated.a = source.a + (1.0f - source.a) * background.a;
info = std::string(clan::string_format("Source = %1, %2, %3, %4", get_text(source.r), get_text(source.g), get_text(source.b), get_text(source.a)));
font.draw_text(canvas, xpos, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Calculated = %1, %2, %3, %4", get_text(calculated.r), get_text(calculated.g), get_text(calculated.b), get_text(calculated.a)));
font.draw_text(canvas, xpos + 250, ypos, info, clan::Colorf::black);
info = std::string(clan::string_format("Actual = %1, %2, %3, %4", get_text(output.r), get_text(output.g), get_text(output.b), get_text(output.a)));
font.draw_text(canvas, xpos + 500, ypos, info, clan::Colorf::black);
}
开发者ID:doughdemon,项目名称:ClanLib,代码行数:62,代码来源:alpha.cpp本文标签属性:
示例:示例的拼音
代码:代码转换器