void Label::paintEvent( PaintEvent& , GFX& g ) { int w, h; g.color() = _color; size( w, h ); g.drawText( 0, 0, w, h, _aligment, _label.c_str() ); }
void GLView::paintEvent( PaintEvent& ev, GFX& g ) { if( g.supportsGL() ){ _viewport = ( ( GFXEngineGL* ) g._engine )->viewport(); g.beginGL(); _allowViewportChange = true; paintGLEvent( ev ); _allowViewportChange = false; g.endGL(); } }
//! Local help function GFX formal_derivate(const GFX &f) { int degree = f.get_true_degree(); int q = f.get_size(); int i; GFX fprim(q, degree); fprim.clear(); for (i = 0; i <= degree - 1; i += 2) { fprim[i] = f[i + 1]; } return fprim; }
void Widget::paintChild( Widget* w, GFX& gfx, const Recti& rect ) const { if( w->parent() != this ) return; /* get current cliprect and translation */ Recti cliprect = gfx.clipRect(); Vector2i gtransold; gfx.getTranslationGlobal( gtransold ); /* get child rectangle in global coords */ Recti newcliprect = w->rect(); Recti childrect = newcliprect; newcliprect.intersect( cliprect ); /* set new clipping */ gfx.setClipRect( newcliprect ); /* do painting with default GFX, only paint currently visible part */ newcliprect.intersect( rect ); PaintEvent pe( newcliprect ); gfx.setTranslationGlobal( Vector2i( childrect.x, childrect.y ) ); gfx.setDefault(); w->paintEvent( pe, gfx ); /* restore old viewport */ gfx.setTranslationGlobal( gtransold ); gfx.setDefault(); gfx.setClipRect( cliprect ); }
int main(int argc, char **argv) { setup_bind_pose(); GFX gfx; gfx.Init(800,600,false,DrawScene); timeBeginPeriod(1); glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE);get_GL_error(); wglSwapIntervalEXT(0); #ifdef USE_PBUFFER pbuffer.Init(512,512); pbuffer.begin(); gfx.InitGL(512,512); #endif // manager.load_obj ("../media/trousers.obj"); // manager.load_obj ("../media/box2.obj"); // manager.load_obj ("../media/can4.obj"); // manager.load_obj ("../media/suspension.obj"); // manager.load_obj ("../media/leg3.obj"); // manager.load_obj ("../media/female3.obj"); // manager.load_obj ("../media/char3.obj"); manager.load_obj ("../media/female-legs.obj"); #ifdef USE_PBUFFER pbuffer.end(); #endif manager.print_controls(); manager.print_materials(); gfx.Run(); return 0; }
void Moveable::paintEvent( PaintEvent& , GFX& gfx ) { int w, h; size( w, h ); gfx.color().set( 0.2f, 0.2f, 0.2f, 0.8f ); gfx.fillRoundRect( 0, 0, w, h, 10.0f ); gfx.color().set( 0.6f, 0.6f, 0.6f, 1.0f ); Recti rtitle( 10, 2, w - 20, 18 ); gfx.drawText( rtitle, ALIGN_LEFT | ALIGN_VCENTER, _title.c_str() ); Recti r = rect(); paintChildren( gfx, r ); if( !_togglebutton.state() ) { gfx.color().set( 0.6f, 0.6f, 0.6f, 1.0f ); gfx.drawIcon( w - 18, h - 18, GFX::ICON_CORNER ); } }
void gfx_line_to(float x, float y, float z){ if ((NextionPage == 1) && (Printing || IS_SD_PRINTING)) gfx.line_to(VC_TOOL, x, y, z); }
void gfx_cursor_to(float x, float y, float z) { if ((NextionPage == 1) && (Printing || IS_SD_PRINTING)) gfx.cursor_to(x, y, z); }
void lcd_init() { HAL::delayMilliseconds(2000); for (uint8_t i = 0; i < 10; i++) { NextionON = nexInit(); if (NextionON) break; delay(1000); } if (!NextionON) { ECHO_LM(DB, "Nextion LCD not connected!"); } else { ECHO_LM(DB, "Nextion LCD connected!"); Pstart.attachPop(ExitPopCallback); Exit1.attachPop(ExitPopCallback); Exit3.attachPop(ExitPopCallback); #if ENABLED(NEXTION_GFX) gfx.color_set(VC_AXIS + X_AXIS, 63488); gfx.color_set(VC_AXIS + Y_AXIS, 2016); gfx.color_set(VC_AXIS + Z_AXIS, 31); gfx.color_set(VC_MOVE, 2047); gfx.color_set(VC_TOOL, 65535); #endif #if ENABLED(SDSUPPORT) MSD1.attachPop(setpageSDPopCallback); MSD3.attachPop(setpageSDPopCallback); MSD5.attachPop(setpageSDPopCallback); MSD6.attachPop(setpageSDPopCallback); sdlist.attachPop(sdlistPopCallback); ScrollUp.attachPop(sdlistPopCallback); ScrollDown.attachPop(sdlistPopCallback); Exit2.attachPop(ExitPopCallback); NPlay.attachPop(PlayPausePopCallback); NStop.attachPop(StopPopCallback); #endif #if HAS_TEMP_0 hot0.attachPop(hotPopCallback, &hot0); #endif #if HAS_TEMP_1 hot1.attachPop(hotPopCallback, &hot1); #endif #if HAS_TEMP_2 || HAS_TEMP_BED hot2.attachPop(hotPopCallback, &hot2); #endif Fanpic.attachPop(setfanPopCallback, &Fanpic); m11.attachPop(sethotPopCallback, &m11); tup.attachPop(settempPopCallback, &tup); tdown.attachPop(settempPopCallback, &tdown); XYHome.attachPop(setmovePopCallback); XYUp.attachPop(setmovePopCallback); XYRight.attachPop(setmovePopCallback); XYDown.attachPop(setmovePopCallback); XYLeft.attachPop(setmovePopCallback); ZHome.attachPop(setmovePopCallback); ZUp.attachPop(setmovePopCallback); ZDown.attachPop(setmovePopCallback); SpeedOk.attachPop(ExitPopCallback); Benter.attachPop(setgcodePopCallback); startimer.enable(); } }
void gfx_line_to(float x, float y, float z){ if (PageInfo && (Printing || IS_SD_PRINTING)) gfx.line_to(VC_TOOL, x, y, z); }
void gfx_cursor_to(float x, float y, float z) { if (PageInfo && (Printing || IS_SD_PRINTING)) gfx.cursor_to(x, y, z); }
void gfx_clear(float x, float y, float z) { if (PageInfo && (Printing || IS_SD_PRINTING)) gfx.clear(x, y, z); }