pub fn pop_clip()
Expand description
Puts the drawing back
Examples found in repository?
examples/table.rs (line 59)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
fn draw_header(txt: &str, x: i32, y: i32, w: i32, h: i32) {
draw::push_clip(x, y, w, h);
draw::draw_box(
enums::FrameType::ThinUpBox,
x,
y,
w,
h,
enums::Color::FrameDefault,
);
draw::set_draw_color(enums::Color::Black);
draw::set_font(enums::Font::Helvetica, 14);
draw::draw_text2(txt, x, y, w, h, enums::Align::Center);
draw::pop_clip();
}
// The selected flag sets the color of the cell to a grayish color, otherwise white
fn draw_data(txt: &str, x: i32, y: i32, w: i32, h: i32, selected: bool) {
draw::push_clip(x, y, w, h);
if selected {
draw::set_draw_color(enums::Color::from_u32(0x00D3_D3D3));
} else {
draw::set_draw_color(enums::Color::White);
}
draw::draw_rectf(x, y, w, h);
draw::set_draw_color(enums::Color::Gray0);
draw::set_font(enums::Font::Helvetica, 14);
draw::draw_text2(txt, x, y, w, h, enums::Align::Center);
draw::draw_rect(x, y, w, h);
draw::pop_clip();
}
More examples
examples/spreadsheet.rs (line 125)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
fn draw_header(txt: &str, x: i32, y: i32, w: i32, h: i32) {
draw::push_clip(x, y, w, h);
draw::draw_box(
enums::FrameType::ThinUpBox,
x,
y,
w,
h,
enums::Color::FrameDefault,
);
draw::set_draw_color(enums::Color::Black);
draw::set_font(enums::Font::Helvetica, 14);
draw::draw_text2(txt, x, y, w, h, enums::Align::Center);
draw::pop_clip();
}
// The selected flag sets the color of the cell to a grayish color, otherwise white
fn draw_data(txt: &str, x: i32, y: i32, w: i32, h: i32, selected: bool) {
draw::push_clip(x, y, w, h);
if selected {
draw::set_draw_color(enums::Color::from_u32(0x00D3_D3D3));
} else {
draw::set_draw_color(enums::Color::White);
}
draw::draw_rectf(x, y, w, h);
draw::set_draw_color(enums::Color::Gray0);
draw::set_font(enums::Font::Helvetica, 14);
draw::draw_text2(txt, x, y, w, h, enums::Align::Center);
draw::draw_rect(x, y, w, h);
draw::pop_clip();
}