// This should come from BACK! void draw_event(time_t now, gdi::GraphicApi & drawable) override { (void)now; this->interaction(); // Calculating new speedx and speedy if (this->dancing_rect.x <= 0 && this->speedx < 0) { this->speedx = -this->speedx; } else if (this->dancing_rect.x + this->dancing_rect.cx >= this->get_screen_rect().cx && this->speedx > 0) { this->speedx = -this->speedx; } if (this->dancing_rect.y <= 0 && this->speedy < 0) { this->speedy = -this->speedy; } else if (this->dancing_rect.y + this->dancing_rect.cy >= this->get_screen_rect().cy && this->speedy > 0) { this->speedy = -this->speedy; } // Saving old rect position Rect oldrect = this->dancing_rect.offset(0,0); // Setting the new position this->dancing_rect.x += this->speedx; this->dancing_rect.y += this->speedy; drawable.begin_update(); // Drawing the RECT drawable.draw(RDPOpaqueRect(this->dancing_rect, 0x0000FF), this->screen.rect); // And erase this->wipe(oldrect, this->dancing_rect, 0x00FF00, this->screen.rect); drawable.end_update(); // Final with setting next idle time this->event.set(33333); // 0.3s is 30fps }
void draw(const Rect& clip) override { this->drawable.draw( RDPOpaqueRect( clip, this->color ), this->rect ); }
virtual void draw(const Rect& clip) { this->drawable->draw( RDPOpaqueRect( clip, this->color ), this->rect ); }
void WidgetEdit::draw_border(Rect clip, BGRColor color) { //top this->drawable.draw(RDPOpaqueRect(clip.intersect(Rect( this->x(), this->y(), this->cx() - 1, 1 )), encode_color24()(color)), clip, gdi::ColorCtx::depth24()); //left this->drawable.draw(RDPOpaqueRect(clip.intersect(Rect( this->x(), this->y() + 1, 1, this->cy() - 2 )), encode_color24()(color)), clip, gdi::ColorCtx::depth24()); //right this->drawable.draw(RDPOpaqueRect(clip.intersect(Rect( this->x() + this->cx() - 1, this->y(), 1, this->cy() )), encode_color24()(color)), clip, gdi::ColorCtx::depth24()); //bottom this->drawable.draw(RDPOpaqueRect(clip.intersect(Rect( this->x(), this->y() + this->cy() - 1, this->cx(), 1 )), encode_color24()(color)), clip, gdi::ColorCtx::depth24()); }
virtual void draw_inner_free(const Rect& clip, int bg_color) { Region region; region.rects.push_back(clip); this->impl->draw_inner_free(clip, bg_color, region); for (std::size_t i = 0, size = region.rects.size(); i < size; ++i) { this->drawable.draw(RDPOpaqueRect(region.rects[i], bg_color), region.rects[i]); } }
bouncer2_mod(wait_obj * back_event, Front & front) : internal_mod(front), event(back_event), speedx(10), speedy(10), dancing_rect(NULL) { this->gd.server_begin_update(); this->gd.opaque_rect(RDPOpaqueRect(this->screen.rect, 0x00FF00)); this->gd.server_end_update(); this->dancing_rect = new Rect(0,0,100,100); // Using µsec set this->event->set(33333); }
Bouncer2Mod(FrontAPI & front, uint16_t width, uint16_t height, Font const & font) : InternalMod(front, width, height, font) , speedx(10) , speedy(10) , dancing_rect(0,0,100,100) { this->front.begin_update(); this->front.draw(RDPOpaqueRect(this->screen.rect, 0x00FF00), this->screen.rect); this->front.end_update(); // Using µsec set this->event.set(33333); }
bouncer2_mod(wait_obj * back_event, FrontAPI & front, uint16_t width, uint16_t height) : internal_mod(front, width, height), event(back_event), speedx(10), speedy(10), dancing_rect(NULL) { this->front.begin_update(); this->front.draw(RDPOpaqueRect(this->get_screen_rect(), 0x00FF00), this->screen.rect); this->front.end_update(); this->dancing_rect = new Rect(0,0,100,100); // Using µsec set this->event->set(33333); }
inline Color4 get_colors( gdi::GraphicDepth order_depth, uint32_t color, GraphicsColor const & gd1, GraphicsColor const & gd2, GraphicsColor const & gd3 ) { Color4 colors {{}}; using GdRef = std::reference_wrapper<GraphicsColor const>; GdRef graphics[3] {gd1, gd2, gd3, }; gdi::RngByBpp<GdRef*> rng_by_bpp{order_depth, std::begin(graphics), std::end(graphics)}; gdi::draw_cmd_color_convert( [&](GraphicsColor const & gdc, const RDPOpaqueRect& cmd, const Rect&) { colors[gdc.order_depth().id()-1] = cmd.color; }, order_depth, rng_by_bpp, RDPOpaqueRect({}, color), Rect{} ); return colors; }
void draw_row(uint16_t row_index, const Rect & clip) { uint32_t bg_color; uint32_t fg_color; if (this->selection_y == row_index) { bg_color = (this->has_focus ? this->bg_color_focus : this->bg_color_selection); fg_color = (this->has_focus ? this->fg_color_focus : this->fg_color_selection); } else { const bool odd = row_index & 1; bg_color = (odd ? this->bg_color_1 : this->bg_color_2); fg_color = (odd ? this->fg_color_1 : this->fg_color_2); } uint16_t y = this->rect.y; for (uint16_t r_index = 0, r_count = std::min<uint16_t>(row_index, this->nb_rows); r_index < r_count; r_index++) { y += this->row_height[r_index] + this->border * 2; } uint16_t x = this->rect.x; Rect rectRow(x, y, this->rect.cx, this->row_height[row_index] + this->border * 2); this->drawable.draw(RDPOpaqueRect(rectRow, bg_color), clip); x += this->border; y += this->border; for (uint16_t column_index = 0; column_index < this->nb_columns; column_index++) { Widget2 * w = this->widgets[column_index][row_index]; Rect rectCell(x, y, this->column_width[column_index], this->row_height[row_index]); if (w) { w->set_xy(rectCell.x, rectCell.y); w->set_wh(rectCell.cx, rectCell.cy); w->set_color(bg_color, fg_color); Rect destRect = clip.intersect(rectCell); if (!destRect.isempty()) { w->draw(destRect); } } x += this->column_width[column_index] + this->border * 2; } }
// This should come from BACK! virtual BackEvent_t draw_event() { // this->gd.server_begin_update(); // this->gd.opaque_rect(RDPOpaqueRect(this->screen.rect, 0x00FF00)); // this->gd.server_end_update(); // Creating a new RDP Order: OpaqueRect //RDPOpaqueRect white_rect(Rect(0, 0, 10, 10), 0xFFFFFF); //RDPOpaqueRect black_rect(Rect(0, 0, 10, 10), 0x000000); this->interaction(); // Calculating new speedx and speedy if (this->dancing_rect->x <= 0 && this->speedx < 0) { this->speedx = -this->speedx; } else if (this->dancing_rect->x + this->dancing_rect->cx >= this->screen.rect.cx && this->speedx > 0) { this->speedx = -this->speedx; } if (this->dancing_rect->y <= 0 && this->speedy < 0) { this->speedy = -this->speedy; } else if (this->dancing_rect->y + this->dancing_rect->cy >= this->screen.rect.cy && this->speedy > 0) { this->speedy = -this->speedy; } // Saving old rect position Rect oldrect = this->dancing_rect->offset(0,0); // Setting the new position this->dancing_rect->x += this->speedx; this->dancing_rect->y += this->speedy; // Drawing the RECT this->gd.server_begin_update(); this->gd.opaque_rect(RDPOpaqueRect(*this->dancing_rect, 0x0000FF)); this->gd.server_end_update(); // And erase this->gd.server_begin_update(); this->wipe(oldrect, *this->dancing_rect, 0x00FF00); this->gd.server_end_update(); // Final with setting next idle time this->event->set(33333); // 0.3s is 30fps return BACK_EVENT_NONE; }
// This should come from BACK! virtual BackEvent_t draw_event() { this->interaction(); // Calculating new speedx and speedy if (this->dancing_rect->x <= 0 && this->speedx < 0) { this->speedx = -this->speedx; } else if (this->dancing_rect->x + this->dancing_rect->cx >= this->get_screen_rect().cx && this->speedx > 0) { this->speedx = -this->speedx; } if (this->dancing_rect->y <= 0 && this->speedy < 0) { this->speedy = -this->speedy; } else if (this->dancing_rect->y + this->dancing_rect->cy >= this->get_screen_rect().cy && this->speedy > 0) { this->speedy = -this->speedy; } // Saving old rect position Rect oldrect = this->dancing_rect->offset(0,0); // Setting the new position this->dancing_rect->x += this->speedx; this->dancing_rect->y += this->speedy; // Drawing the RECT this->front.begin_update(); this->front.draw(RDPOpaqueRect(*this->dancing_rect, 0x0000FF), this->screen.rect); this->front.end_update(); // And erase this->front.begin_update(); this->wipe(oldrect, *this->dancing_rect, 0x00FF00, this->screen.rect); this->front.end_update(); // Final with setting next idle time this->event->set(33333); // 0.3s is 30fps return BACK_EVENT_NONE; }
inline void fill_region(gdi::GraphicApi & drawable, const Region & region, int bg_color) { for (const Rect & rect : region.rects) { drawable.draw(RDPOpaqueRect(rect, bg_color), rect); } }
void wipe(Rect oldrect, Rect newrect, int color, const Rect & clip) { oldrect.difference(newrect, [&](const Rect & a) { this->front.draw(RDPOpaqueRect(a, color), clip); }); }
void WidgetEdit::draw_cursor(const Rect clip) { if (!clip.isempty()) { this->drawable.draw(RDPOpaqueRect(clip, encode_color24()(this->cursor_color)), clip, gdi::ColorCtx::depth24()); } }
void draw(const Rect& clip) override { this->drawable.draw(RDPOpaqueRect(clip, color), this->rect); this->WidgetComposite::draw(clip); }
void callback(const Rect & a) { b.front.draw(RDPOpaqueRect(a, color), this->clip); }
void callback(const Rect & a) { b.gd.opaque_rect(RDPOpaqueRect(a, color)); }