ERIS CORE

◆ drawLine()

void AppWren::drawLine ( int16_t  start_x,
int16_t  start_y,
int16_t  end_x,
int16_t  end_y,
int16_t  r,
int16_t  g,
int16_t  b 
)
inline

draws a line on the render target

Parameters
start_x
start_y
end_x
end_y
r
g
b

Definition at line 452 of file AppWren.h.

452  {
453 
454  if ((start_x == end_x) && (start_y == end_y)){
455  if (draw){
456  if (has_pop){
457  //draw->ILI9341_t3n::drawPixel(start_x,start_y,CL((uint16_t)r,(uint16_t)g,(uint16_t)b));
458  } else{
459  if (!surface_cache) return;
460  if (start_x >= surface_cache->getWidth()) start_x = surface_cache->getWidth()-1;
461  if (start_y >= surface_cache->getHeight()) start_y = surface_cache->getHeight()-1;
462  if (start_x < 0 ) start_x = 0;
463  if (start_y < 0 ) start_y = 0;
464 
465  if (end_x >= surface_cache->getWidth()) end_x = surface_cache->getWidth()-1;
466  if (end_y >= surface_cache->getHeight()) end_y = surface_cache->getHeight()-1;
467  if (end_x < 0 ) end_x = 0;
468  if (end_y < 0 ) end_y = 0;
469  draw->drawPixel(surface_cache,start_x,start_y,CL(r,g,b));
470  }
471  }
472  return;
473  }else if (draw){
474  if (has_pop){
475  draw->drawLine(start_x, start_y, end_x, end_y, CL(r,g,b));
476  }else{
477  if (!surface_cache) return;
478  if (start_x >= surface_cache->getWidth()) start_x = surface_cache->getWidth()-1;
479  if (start_y >= surface_cache->getHeight()) start_y = surface_cache->getHeight()-1;
480  if (start_x < 0 ) start_x = 0;
481  if (start_y < 0 ) start_y = 0;
482 
483  if (end_x >= surface_cache->getWidth()) end_x = surface_cache->getWidth()-1;
484  if (end_y >= surface_cache->getHeight()) end_y = surface_cache->getHeight()-1;
485  if (end_x < 0 ) end_x = 0;
486  if (end_y < 0 ) end_y = 0;
487  draw->drawSurfaceLine(surface_cache, start_x, start_y, end_x, end_y, CL(r,g,b));
488  }
489  return;
490  }
491  }
ILI9341_t3_ERIS * draw
Definition: AppBaseClass.h:41
Surface * surface_cache
Definition: AppWren.h:770
void drawSurfaceLine(Surface *dest, int16_t start_x, int16_t start_y, int16_t end_x, int16_t end_y, uint16_t color)
void drawPixel(Surface *dest, int16_t x, int16_t y, uint16_t color)
uint16_t getHeight()
uint16_t getWidth()

References AppBaseClass::draw, ILI9341_t3_ERIS::drawPixel(), ILI9341_t3_ERIS::drawSurfaceLine(), Surface::getHeight(), Surface::getWidth(), AppBaseClass::has_pop, and surface_cache.

Referenced by drawLineCallback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: