本文整理汇总了C++中draw_rectangle函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_rectangle函数的具体用法?C++ draw_rectangle怎么用?C++ draw_rectangle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_rectangle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: size
void add_noise_dialog::preview_window::paint (sxsdk::graphic_context_interface &gc, const sx::rectangle_class *visible_rectangle, void *) {
if(!preview_image) return;
if(dirty) {
const sx::vec<int,2> size(preview_image->get_size());
boost::scoped_array<sxsdk::rgb_class> buffer_rgb(new sxsdk::rgb_class[size.x * size.y]); // cut alpha channel.
preview_image->get_real_colors(0, 0, size.x, size.y, buffer_rgb.get());
preview_image->set_real_colors(0, 0, size.x, size.y, buffer_rgb.get());
dirty = false;
}
// 画像の縦横比に合わせて、余白部分を塗りつぶし
const sx::vec<int,2> preview_size = stored_image->uniscale_rectangle(get_client_rectangle(false), sx::rectangle_class(sx::vec<int,2>(0,0), stored_image->get_size())).size();
const sx::vec<int,2> background_size = get_client_rectangle(false).size();
sx::rectangle_class draw_rectangle(sx::vec<int, 2>(0, 0), preview_size);
const sx::vec<int,2> margin = (background_size - draw_rectangle.size()) / 2;
// draw_rectangle.offset(margin);
draw_rectangle += margin;
gc.set_color(sxsdk::rgb_class(0.2f, 0.2f, 0.2f));
if(margin.x > 0) {
sx::rectangle_class mask({ 0, 0 }, { margin.x, background_size.y });
gc.paint_rectangle(mask);
gc.paint_rectangle(mask + sx::vec<int,2>(draw_rectangle.max.x, 0));
}
if(margin.y > 0) {
sx::rectangle_class mask({ 0, 0 }, { background_size.x, margin.y });
gc.paint_rectangle(mask);
gc.paint_rectangle(mask + sx::vec<int,2>(0, draw_rectangle.max.y));
}
gc.restore_color(); // set_color() に対応して必ず呼び出す
// プレビューイメージを描画
gc.draw_image(preview_image, draw_rectangle);
}
开发者ID:shadedev,项目名称:pluginsdk,代码行数:35,代码来源:add_noise.cpp
示例2: calculate_clipping_rectangle
void
twidget::draw_debug_border(surface& frame_buffer, int x_offset, int y_offset)
{
SDL_Rect r = redraw_action_ == tredraw_action::partly
? calculate_clipping_rectangle(x_offset, y_offset)
: calculate_blitting_rectangle(x_offset, y_offset);
switch(debug_border_mode_) {
case 0:
/* DO NOTHING */
break;
case 1:
draw_rectangle(
r.x, r.y, r.w, r.h, debug_border_colour_, frame_buffer);
break;
case 2:
sdl_fill_rect(frame_buffer, &r, debug_border_colour_);
break;
default:
assert(false);
}
}
开发者ID:AI0867,项目名称:wesnoth,代码行数:25,代码来源:widget.cpp
示例3: decode_and_draw
static void decode_and_draw(rectangle_t* obj, const area_t * limiting_canvas_area)
{
area_t canvas_area = widget_compute_canvas_area(obj->glyph, limiting_canvas_area);
canvas_t *canv = canvas_new(&canvas_area);
if (obj->corner_radius)
{
if (obj->is_filled) {
draw_solid_round_rectangle(canv, color_to_pixel(obj->fill_color), obj->corner_radius);
}
if (obj->has_border) {
draw_round_rectangle(canv, color_to_pixel(obj->border_color), obj->border_tickness, obj->corner_radius);
}
}
else
{
if (obj->is_filled) {
draw_solid_rectangle(canv, color_to_pixel(obj->fill_color));
}
if (obj->has_border) {
draw_rectangle(canv, color_to_pixel(obj->border_color), obj->border_tickness);
}
}
canvas_delete(canv);
}
开发者ID:felipe-lavratti,项目名称:marsh,代码行数:26,代码来源:rectangle.c
示例4: i_mousemove
static void i_mousemove(void* widget, GdkEventButton *event, gpointer data) {
int x = event->x;
int y = event->y;
revert_pixbuf();
draw_rectangle(sx,sy,x,y);
/*printf("mouse move %d %d \n",x,y);*/
}
开发者ID:shitpoet,项目名称:scrscr,代码行数:7,代码来源:scrscr.c
示例5: draw
void draw() const // draw the rectangle
{
shape:: draw();
draw_rectangle(xCo, yCo, xCo + width, yCo + height);
set_color(cWHITE); // draw diagonal
draw_line(xCo, yCo, xCo + width, yCo + height);
}
开发者ID:clarktheshark,项目名称:oopicpp,代码行数:7,代码来源:multshap.cpp
示例6: pika_p
//----------------------------------------------------
//pravokotna pika
void pika_p(float *sl, int w, int h, float size, float amp)
{
int i;
for (i=0;i<w*h;i++) sl[i]=0.5-amp/2.0; //background
draw_rectangle(sl, w, h, w/2-size/2, h/2-size/2, size, size, 0.5+amp/2.0);
}
开发者ID:joshdoe,项目名称:frei0r,代码行数:10,代码来源:test_pat_I.c
示例7: consume_power_task
void consume_power_task(void *pvParam)
{
prepare_mobile(false);
power_screen(true);
LED_Light(led_white, true);
draw_rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
while(1);
}
开发者ID:xiaoyeqiannian,项目名称:SWITCH433,代码行数:8,代码来源:test.c
示例8: grid
//----------------------------------------------------------
//draws a transparent mesurement grid
//*a = alpha channel
void grid(unsigned char *sl, int w, int h, unsigned char *a)
{
int i,j;
unsigned char black,white,tr;
black=0;
white=255;
tr=200; //how opaque are the marks
for (i=0;i<(w*h);i++) sl[i]=black; //black background
for (i=0;i<(w*h);i++) a[i]=0; //transparent
for (i=0;i<h;i=i+2)
for (j=0;j<w;j=j+10)
{
sl[i*w+j]=white;
a[i*w+j]=tr;
}
for (i=0;i<h;i=i+10)
for (j=0;j<w;j=j+2)
{
sl[i*w+j]=white;
a[i*w+j]=tr;
}
for (i=0;i<h;i=i+50)
for (j=0;j<w;j=j+50)
{
draw_rectangle(sl,w,h,i,j-1,1,3,white);
draw_rectangle(sl,w,h,i-1,j,3,1,white);
draw_rectangle(a,w,h,i,j-1,1,3,tr);
draw_rectangle(a,w,h,i-1,j,3,1,tr);
}
for (i=0;i<h;i=i+100)
for (j=0;j<w;j=j+100)
{
draw_rectangle(sl,w,h,i,j-4,1,9,white);
draw_rectangle(sl,w,h,i-4,j,9,1,white);
draw_rectangle(sl,w,h,i-1,j-1,3,3,white);
draw_rectangle(a,w,h,i,j-4,1,9,tr);
draw_rectangle(a,w,h,i-4,j,9,1,tr);
draw_rectangle(a,w,h,i-1,j-1,3,3,tr);
}
}
开发者ID:ttill,项目名称:frei0r,代码行数:49,代码来源:test_pat_G.c
示例9: draw_cube
void ShZshapeManager::draw_shape(const char* content)
{
if (content == "cube")
{
draw_cube();
}
if (content == "cylinder")
{
draw_cylinder();
}
if (content == "pipe")
{
draw_pipe();
}
if (content == "cone")
{
draw_cone();
}
if (content == "circle")
{
draw_circle();
}
if (content == "ring")
{
draw_ring();
}
if (content == "pyramid")
{
draw_pyramid();
}
if (content == "triangle")
{
draw_triangle();
}
if (content == "rectangle")
{
draw_rectangle();
}
if (content == "polygon")
{
draw_polygon();
}
if (content == "multigonalStar")
{
draw_multigonalStar();
}
}
开发者ID:shuaihuzhou,项目名称:openglExample,代码行数:57,代码来源:ShZshapeManager.cpp
示例10: status_init_mode_flight
/*
* Initializes the persistent text / graphics for each mode
*/
void status_init_mode_flight(){
//Clear buffer
draw_rectangle(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);
//Write text labels
draw_text(STATUS_PITCH_X, STATUS_PITCH_Y, (char*) "Pitch", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
draw_text(STATUS_ROLL_X, STATUS_ROLL_Y, (char*) "Roll", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, 1,OVERLAY_OR);
// degree symbols
draw_rectangle(63, 6, 65, 8, DRAW_UNFILLED, VALUE_ON, OVERLAY_OR);
draw_rectangle(63, 23, 65, 25, DRAW_UNFILLED, VALUE_ON, OVERLAY_OR);
//Draw invalid batteries
status_set_pilot_battery_level(-1);
status_set_control_battery_level(-1);
glcd_write_buffer();
}
开发者ID:aceperry,项目名称:microcontroller-projects,代码行数:21,代码来源:status_glcd_st7565r.c
示例11: show_cursor
static void show_cursor(int index, int color)
{
if (index < 0) return;
int x = (index % 4) * SLOT_W;
int y = 219 - (index / 4 + 1) * SLOT_H;
draw_rectangle(x, y, SLOT_W, SLOT_H - 2, color, 0);
}
开发者ID:bartleph,项目名称:QuadPawn,代码行数:9,代码来源:file_selector.c
示例12: status_init_mode_version
void status_init_mode_version(){
//Clear buffer
draw_rectangle(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);
//Write text labels
draw_text(STATUS_CONFIG_MODE_TITLE_X, STATUS_CONFIG_MODE_TITLE_Y, (char*) "Version", FONT_SMALL_WIDTH, FONT_SMALL_HEIGHT, ORIENTATION_NORMAL, font_small, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
glcd_write_buffer();
}
开发者ID:aceperry,项目名称:microcontroller-projects,代码行数:9,代码来源:status_glcd_st7565r.c
示例13: draw_rectangle
/*
* Abstract implementation to hightlight the shape.
* Draws a larger rectangle around shape.
*/
void Rectangle::highlight()
{
draw_rectangle(
color_yellow,
false,
_position.x - 5, _position.y - 5,
_width + 10, _height + 10
);
}
开发者ID:Cybot101,项目名称:HIT3172-SwinGame-Shapes,代码行数:13,代码来源:Rectangle.cpp
示例14: get_rect_by_corners
void Canvas::draw_zoom_rectangle( wxDC *dc )
{
wxRect drawn_rect = get_rect_by_corners( drag_start, drag_end );
wxRect max_rect(
wxSize( contents->GetWidth(), contents->GetHeight() )
* zoom_in_level / zoom_out_level );
if ( drawn_rect.Intersects( max_rect ) )
draw_rectangle( drawn_rect.Intersect( max_rect ), dc );
}
开发者ID:stevewolter,项目名称:rapidSTORM,代码行数:9,代码来源:Canvas.cpp
示例15: main_draw_shape
void main_draw_shape(struct template_t *tmp_tpl) {
char *sval = NULL;
if(template_get_setting_string(tmp_tpl, "shape", &sval) == 0) {
int filled = 0, x = 0, y = 0, width = fb_width(), height = fb_height(), border = 0, fcolor = 0;
int x1 = 0, x2 = 0, y1 = 0, y2 = 0, radius = 0, thickness = 1, zindex = 0;
unsigned short *color = NULL;
if(strcmp(sval, "rectangle") == 0 || strcmp(sval, "circle") == 0) {
template_get_setting_number(tmp_tpl, "x", &x);
template_get_setting_number(tmp_tpl, "y", &y);
template_get_setting_number(tmp_tpl, "border", &border);
template_get_setting_number(tmp_tpl, "filled", &filled);
} else if(strcmp(sval, "line") == 0) {
template_get_setting_number(tmp_tpl, "x1", &x1);
template_get_setting_number(tmp_tpl, "x2", &x2);
template_get_setting_number(tmp_tpl, "y1", &y1);
template_get_setting_number(tmp_tpl, "y2", &y2);
template_get_setting_number(tmp_tpl, "thickness", &thickness);
}
if(strcmp(sval, "rectangle") == 0) {
template_get_setting_number(tmp_tpl, "width", &width);
template_get_setting_number(tmp_tpl, "height", &height);
} else if(strcmp(sval, "circle") == 0) {
template_get_setting_number(tmp_tpl, "radius", &radius);
}
if(template_get_setting_color(tmp_tpl, "color", &color) != 0) {
color = malloc(sizeof(unsigned short)*3);
color[0] = 0, color[1] = 0, color[2] = 0;
fcolor = 1;
}
template_get_setting_number(tmp_tpl, "z-index", &zindex);
if(nodaemon == 0) {
if(strcmp(sval, "rectangle") == 0) {
if(filled) {
draw_rectangle_filled(x, y, zindex, width, height, draw_color(color[0], color[1], color[2]));
} else {
draw_rectangle(x, y, zindex, width, height, border, draw_color(color[0], color[1], color[2]));
}
} else if(strcmp(sval, "circle") == 0) {
if(filled) {
draw_circle_filled(x, y, zindex, radius, draw_color(color[0], color[1], color[2]));
} else {
draw_circle(x, y, zindex, radius, border, draw_color(color[0], color[1], color[2]));
}
} else if(strcmp(sval, "line") == 0) {
draw_line(x1, y1, x2, y2, zindex, thickness, draw_color(color[0], color[1], color[2]));
}
}
if(fcolor) {
free(color);
}
}
}
开发者ID:CurlyMoo,项目名称:Splash,代码行数:56,代码来源:daemon.c
示例16: draw_box
/// mini helper function for debuggging, add a rectangle to an existing file
void draw_box(const IntegralChannelsFeature::rectangle_t &box, string png_filename )
{
gil::rgb8_image_t image;
gil::png_read_image(png_filename, image);
draw_rectangle(gil::view(image), rgb8_colors::pink, box);
gil::png_write_view(png_filename, gil::const_view(image));
return;
}
开发者ID:Belial2010,项目名称:Pedestrian-Detection-Project,代码行数:11,代码来源:DetectorsComparisonTestApplication.cpp
示例17: draw_roundrect_precise
void draw_roundrect_precise(gs_scalar x1, gs_scalar y1,gs_scalar x2, gs_scalar y2, float rad, bool outline)
{
if (x1>x2) {
float t=x2;
x2=x1;
x1=t;
}
if (y1>y2) {
float t=y2;
y2=y1;
y1=t;
}
if (x2-x1<rad*2){rad=(x2-x1)/2;}
if (y2-y1<rad*2){rad=(y2-y1)/2;}
if (rad<0){rad=0;}
float r2=rad*rad,r12=rad*M_SQRT1_2,
bx1=x1+rad,by1=y1+rad,
bx2=x2-rad,by2=y2-rad;
if (outline) {
draw_primitive_begin(pr_linelist);
draw_vertex(x1,by1);draw_vertex(x1,by2);
draw_vertex(x2,by1);draw_vertex(x2,by2);
draw_vertex(bx1,y1);draw_vertex(bx2,y1);
draw_vertex(bx1,y2);draw_vertex(bx2,y2);
draw_primitive_end();
draw_primitive_begin(pr_pointlist);
for(float xc=0,yc=rad;xc<=r12;xc++) {
if (xc*xc+yc*yc>r2) yc--;
draw_vertex(bx2+xc,by2+yc);
draw_vertex(bx2+xc,by1-yc);
draw_vertex(bx1-xc,by2+yc);
draw_vertex(bx1-xc,by1-yc);
draw_vertex(bx2+yc,by2+xc);
draw_vertex(bx2+yc,by1-xc);
draw_vertex(bx1-yc,by2+xc);
draw_vertex(bx1-yc,by1-xc);
}
draw_primitive_end();
} else {
draw_primitive_begin(pr_linelist);
for(float xc=0,yc=rad;xc<=r12;xc++) {
if (xc*xc+yc*yc>r2) yc--;
draw_vertex(bx2+xc,by2+yc);
draw_vertex(bx2+xc,by1-yc);
draw_vertex(bx1-xc,by2+yc);
draw_vertex(bx1-xc,by1-yc);
draw_vertex(bx2+yc,by2+xc);
draw_vertex(bx2+yc,by1-xc);
draw_vertex(bx1-yc,by2+xc);
draw_vertex(bx1-yc,by1-xc);
}
draw_primitive_end();
draw_rectangle(bx1,y1,bx2,y2,false);
}
}
开发者ID:JustForkMyLifeUpFam,项目名称:enigma-dev,代码行数:55,代码来源:GSstdraw.cpp
示例18: _frame_rect
void _frame_rect(screen_rectangle *rectangle, short color_index)
{
// Get color
SDL_Color color;
_get_interface_color(color_index, &color);
uint32 pixel = SDL_MapRGB(draw_surface->format, color.r, color.g, color.b);
// Draw rectangle
SDL_Rect r = {rectangle->left, rectangle->top, rectangle->right - rectangle->left, rectangle->bottom - rectangle->top};
draw_rectangle(draw_surface, &r, pixel);
}
开发者ID:blezek,项目名称:marathon-ios,代码行数:11,代码来源:screen_drawing.cpp
示例19: clear_window
int
maintime::idle_progress (midipulse ticks)
{
if (ticks >= 0) /* ca 2016-03-17 to make bar appear */
{
const int yoff = 4;
int tick_x = (ticks % m_ppqn) * m_box_width / m_ppqn;
int beat_x = ((ticks / m_beat_width) % m_ppqn) * m_box_less_pill / m_ppqn;
int bar_x = ((ticks / m_bar_width) % m_ppqn) * m_box_less_pill / m_ppqn;
m_tick = ticks;
clear_window();
draw_rectangle(black(), 0, yoff, m_box_width, m_box_height, false);
if (tick_x <= m_flash_x) /* for flashing the maintime bar */
draw_rectangle(grey(), 2, yoff+2, m_flash_width, m_flash_height);
draw_rectangle(black(), beat_x + 2, yoff+2, m_pill_width, m_flash_height);
draw_rectangle(bar_x + 2, yoff+2, m_pill_width, m_flash_height);
}
return true;
}
开发者ID:danielappelt,项目名称:sequencer64,代码行数:20,代码来源:maintime.cpp
示例20: status_init_mode_calibrate
void status_init_mode_calibrate(){
//Clear buffer
draw_rectangle(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1, DRAW_FILLED, VALUE_ON, OVERLAY_NAND);
//Write text labels
draw_text(STATUS_CONFIG_MODE_TITLE_X, STATUS_CONFIG_MODE_TITLE_Y, (char*) "Calibration", FONT_SMALL_WIDTH, FONT_SMALL_HEIGHT, ORIENTATION_NORMAL, font_small, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
draw_text(STATUS_CONFIG_MODE_TEXT_X + 0 * STATUS_CONFIG_MODE_COLUMN_WIDTH, STATUS_CONFIG_MODE_TEXT_Y + 1 * STATUS_CONFIG_MODE_ROW_HEIGHT + 1, (char*) "Ensure craft is level and press", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
draw_text(STATUS_CONFIG_MODE_TEXT_X + 0 * STATUS_CONFIG_MODE_COLUMN_WIDTH, STATUS_CONFIG_MODE_TEXT_Y + 2 * STATUS_CONFIG_MODE_ROW_HEIGHT + 1, (char*) "triangle to calibrate", FONT_XSMALL_WIDTH, FONT_XSMALL_HEIGHT, ORIENTATION_NORMAL, font_xsmall, codepage_ascii_caps, VALUE_ON, OVERLAY_OR);
glcd_write_buffer();
}
开发者ID:aceperry,项目名称:microcontroller-projects,代码行数:11,代码来源:status_glcd_st7565r.c
注:本文中的draw_rectangle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论