Ejemplo n.º 1
0
//
// Process the Expose event: draw in the window
//
void MyWindow::onExpose(XEvent& /* event */) {
    // Erase a window
    setForeground(getBackground());
    fillRectangle(m_RWinRect);

    // Draw the coordinate axes
    drawAxes("black", true, "gray");

    // Draw a graph of function
    setForeground("red");
    drawGraphic();

    // Draw a cross on mouse click
    if (clicked) {
        if (mouseButton == Button1)
            setForeground("blue");      // Left button
        else if (mouseButton == Button2)
            setForeground("SeaGreen");  // Middle button
        else if (mouseButton == Button3)
            setForeground("brown");     // Right mouse button
        R2Vector dx(0.2, 0.);
        R2Vector dy(0., 0.2);
        drawLine(lastClick-dx, lastClick+dx);
        drawLine(lastClick-dy, lastClick+dy);
    }
}
Ejemplo n.º 2
0
void Mapper::spin() {

  // The point (x1,y1) is set to the last known pose
  double x1 = lastPose_.position.x;
  double y1 = lastPose_.position.y;

  try{
    ros::Time now = ros::Time::now();
    listener_.waitForTransform(map_frame_, base_frame_, now, ros::Duration(3.0));
    listener_.lookupTransform(map_frame_, base_frame_, now, transform_);
  }
  catch (tf::TransformException ex){
    ROS_ERROR("%s",ex.what());
  }

  // The point (x2,y2) is set to the new pose
  double x2 = transform_.getOrigin().x();
  double y2 = transform_.getOrigin().y();

  if (firstDraw_ && penDown_) {
    fillCircle(x2,y2);
    firstDraw_ = false;

    // Set the last pose to the new pose for the next iteration
    lastPose_.position.x = x2;
    lastPose_.position.y = y2;

    // Update the map's time stamp
    ros::Time updateTime = ros::Time::now();
    mowed_map_.header.stamp = updateTime;

    // Publish the newly populated map
    occupancyGrid_pub_.publish(mowed_map_);
  }

  // If the robot changed its position and the pen is down
  else if ((x1 != x2 || y1 != y2) && penDown_ == true && !firstDraw_) {

    // Set the last pose to the new pose for the next iteration
    lastPose_.position.x = x2;
    lastPose_.position.y = y2;

    fillCircle(x2,y2);
    fillRectangle(x1,y1,x2,y2);

    // Update the map's time stamp
    ros::Time updateTime = ros::Time::now();
    mowed_map_.header.stamp = updateTime;

    // Publish the newly populated map
    occupancyGrid_pub_.publish(mowed_map_);

    // Calculated and publish percent mowed
    calculatePercentMowed();

  }
}
Ejemplo n.º 3
0
int
HGraphTest::runTest()
{
    graph::HGraph* g = new graph::HGraph();
    graph::HGraph* filled = fillRectangle(g, 1000, 100);
    std::cout << "count of vertices: " << filled->countVertices() << std::endl;
    graph::HGraph* linked = fillRandomEdges(filled, 1000, 100, 100); 
    delete linked;   
    return 0;
}
Ejemplo n.º 4
0
void HexMaze::paint(CDC &dc) {
  fillRectangle(dc,getRect(),WHITE);
  m_horizontalWall.paint(dc);
  m_verticalWall1.paint( dc);
  m_verticalWall2.paint( dc);

/*
  markCell(dc,0,0);
  int startRow = m_cell.getRowCount()-1;
  int startCol = m_cell.getColumnCount()-1;
  markCell(dc,startRow,startCol);

  drawWall(dc,*m_cell(startRow,startCol).m_wall[5],YELLOW);
*/
}
Ejemplo n.º 5
0
void SaveDialog::onExpose(XEvent& /* event */) {
    setForeground(getBackground());
    fillRectangle(m_IWinRect);

    setForeground(textColor);
    drawString(
        editor->leftMargin,
        editor->statusLineMargin + editor->ascent,
        "A text has been changed, save it?"
    );

    drawButton(yesButtonRect, "Yes");
    drawButton(noButtonRect, "No");
    drawButton(cancelButtonRect, "Cancel");
}
Ejemplo n.º 6
0
main(void)
{
	int i;
	int array[10] = {10,102,20,50,64,0,85,50,12,10};

	initGraph();

	for(i=0;i<10;i++)
	{
		fillRectangle(i*10,479,i*10+40,479-array[i],BLACK);
	}

	waitButtonPress();

	closeGraph();
}
Ejemplo n.º 7
0
void TextEdit::drawCursor(int cx, int cy, bool on, bool createGC /* = false */)
{
    bool cursorOn = on;
    if (!focusIn || inputDisabled) cursorOn = false;
    if (cx < windowX || cy < windowY || cx >= windowX + windowWidth || cy >= windowY + windowHeight) return;         // Cursor outside of window

    GC savedGC;
    if (createGC) {
        // Save the previous graphic contex, create a temporary GC
        savedGC = m_GC;
        m_GC = XCreateGC(m_Display, m_Window, 0, 0);
        setFont(textFont);
    }

    if (cursorOn) setForeground(fgColor);
    else setForeground(bgColor);

    int x = leftMargin + (cx - windowX) * dx;
    int y = topMargin + (cy - windowY) * dy;

    fillRectangle(I2Rectangle(x, y, dx, ascent + descent));

    if (cursorOn) setForeground(bgColor);
    else setForeground(fgColor);

    if (cy <= text.size())
    {
        TextLine* line;
        if (cy == text.size()) { line = &(endOfText); } else { line = &(text.getLine(cy)); }

        if (cx < line->length()) { drawString(x, y + ascent, line->getString() + cx, 1); }
    }

    if (createGC)
    {
        // Release the temporary graphic contex, restore the previous GC
        XFreeGC(m_Display, m_GC);
        m_GC = savedGC;
    }
}
Ejemplo n.º 8
0
void TFT::drawChar( INT8U ascii, INT16U poX, INT16U poY,INT16U size, INT16U fgcolor)
{
    if((ascii>=32)&&(ascii<=127))
    {
        ;
    }
    else
    {
        ascii = '?'-32;
    }
    for (int i =0; i<FONT_X; i++ ) {
        INT8U temp = pgm_read_byte(&simpleFont[ascii-0x20][i]);
        for(INT8U f=0;f<8;f++)
        {
            if((temp>>f)&0x01)
            {
                fillRectangle(poX+i*size, poY+f*size, size, size, fgcolor);
            }
        }

    }
}
Ejemplo n.º 9
0
void TextEdit::drawStatusLine(bool createGC /* = false */)
{
    GC savedGC;
    if (createGC) {
        // Save the previous graphic contex, create a temporary GC
        savedGC = m_GC;
        m_GC = XCreateGC(m_Display, m_Window, 0, 0);
        setFont(textFont);
    }

    setForeground(bgStatusLineColor);
    fillRectangle(
        I2Rectangle(0, 0, m_IWinRect.width(), dy + statusLineMargin)
    );

    setForeground(fgStatusLineColor);

    char statusLine[256];
    int x = leftMargin;
    int y = statusLineMargin + ascent;
    sprintf(statusLine, "col=%d", cursorX+1);
    drawString(x, y, statusLine);

    sprintf(statusLine, "row=%d", cursorY+1);
    drawString(x + 8*dx, y, statusLine);

    if (textChanged)
        drawString(x + 19*dx, y, "Modified");
    else if (textSaved)
        drawString(x + 19*dx, y, "Saved");

    drawString(m_IWinRect.width() - 15*dx, y, "Ctrl+Q to quit");

    if (createGC) {
        // Release the temporary graphic contex, restore the previous GC
        XFreeGC(m_Display, m_GC);
        m_GC = savedGC;
    }
}
Ejemplo n.º 10
0
void paint()
{
	int width = getWindowWidth();
	int height = getWindowHeight();

	int radius = min(width, height) / 2;

	setFill(colorYellow);
	fillCircle(width / 2, height / 2, radius);
	setStroke(colorGreen, 10);
	drawCircle(width / 2, height / 2, radius);

	setFill(colorYellow);
	fillEllipse(200, 200, 350, 250);
	setStroke(colorGreen, 10);
	drawEllipse(200, 200, 350, 250);

	setStroke(colorBlue, 2);

	drawLine(10, 10, _mouseX, _mouseY);

	if(_pressedChar != 0)
	{
		char str[2] = {0};
		str[0] = _pressedChar;

		drawText(100, 100, str, 10, colorWhite, colorBlue);
	}

	char str[256] = {0};
	sprintf(str, "%d - HELLO COMPUTER", _secondElapsed);

	drawText(100, 200, str, 70, colorYellow, colorBlue);

	setFill((_secondElapsed % 2) == 0 ? colorBlue : colorRed);
	fillRectangle(200, 200, 100, 100);
	setStroke(colorGreen, 2);
	drawRectangle(200, 200, 100, 100);
}
Ejemplo n.º 11
0
void TFT::drawChar( unsigned char ascii, unsigned int poX, unsigned int poY,unsigned int size, unsigned int fgcolor)
{
    if((ascii>=32)&&(ascii<=127))
    {
        ;
    }
    else
    {
        ascii = '?'-32;
    }
    for (int i =0; i<FONT_X; i++ ) {
        unsigned char temp = pgm_read_byte(&simpleFont[ascii-0x20][i]);
        for(unsigned char f=0;f<8;f++)
        {
            if((temp>>f)&0x01)
            {
                fillRectangle(poX+i*size, poY+f*size, size, size, fgcolor);
            }

        }

    }
}
void SmartMatrix::fillRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, const rgb24& outlineColor, const rgb24& fillColor) {
    fillRectangle(x0, y0, x1, y1, fillColor);
    drawRectangle(x0, y0, x1, y1, outlineColor);
}
void SmartMatrix::fillScreen(const rgb24& color) {
    fillRectangle(0, 0, screenConfig.localWidth, screenConfig.localHeight, color);
}
void SmartMatrix::fillRoundRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
  uint16_t radius, const rgb24& outlineColor, const rgb24& fillColor) {
    if (x1 < x0)
        SWAPint(x1, x0);

    if (y1 < y0)
        SWAPint(y1, y0);

    // decrease large radius that would break shape
    if(radius > (x1-x0)/2)
        radius = (x1-x0)/2;
    if(radius > (y1-y0)/2)
        radius = (y1-y0)/2;

    int a = radius, b = 0;
    int radiusError = 1 - a;

    if (radius == 0) {
        fillRectangle(x0, y0, x1, y1, outlineColor, fillColor);
    }

    // draw straight part of outline
    drawFastHLine(x0 + radius, x1 - radius, y0, outlineColor);
    drawFastHLine(x0 + radius, x1 - radius, y1, outlineColor);
    drawFastVLine(x0, y0 + radius, y1 - radius, outlineColor);
    drawFastVLine(x1, y0 + radius, y1 - radius, outlineColor);

    // convert coordinates to point at center of rounded sections
    x0 += radius;
    x1 -= radius;
    y0 += radius;
    y1 -= radius;

    // only draw one line per row/column, skipping the sides
    bool hlineDrawn = true;
    bool vlineDrawn = true;

    while (a >= b)
    {
        // this pair sweeps from far left towards right
        drawPixel(-a + x0, -b + y0, outlineColor);
        drawPixel(-a + x0, b + y1, outlineColor);

        // this pair sweeps from far right towards left
        drawPixel(a + x1, -b + y0, outlineColor);
        drawPixel(a + x1, b + y1, outlineColor);

        if (!vlineDrawn) {
            drawFastVLine(-a + x0, (-b + 1) + y0, (b - 1) + y1, fillColor);
            drawFastVLine(a + x1, (-b + 1) + y0, (b - 1) + y1, fillColor);
            vlineDrawn = true;
        }

        // this pair sweeps from very top towards bottom
        drawPixel(-b + x0, -a + y0, outlineColor);
        drawPixel(b + x1, -a + y0, outlineColor);

        // this pair sweeps from bottom up
        drawPixel(-b + x0, a + y1, outlineColor);
        drawPixel(b + x1, a + y1, outlineColor);

        if (!hlineDrawn) {
            drawFastHLine((-b + 1) + x0, (b - 1) + x1, -a + y0, fillColor);
            drawFastHLine((-b + 1) + x0, (b - 1) + x1, a + y1, fillColor);
            hlineDrawn = true;
        }

        b++;
        if (radiusError < 0) {
            radiusError += 2 * b + 1;
        } else {
            a--;
            hlineDrawn = false;
            vlineDrawn = false;
            radiusError += 2 * (b - a + 1);
        }
    }

    // draw rectangle in center
    fillRectangle(x0 - a, y0 - a, x1 + a, y1 + a, fillColor);
}
Ejemplo n.º 15
0
void TextEdit::redrawTextRectangle(
    int x, int y, int w, int h, bool createGC /* = false */
) {
    int x1 = x + w;
    if (w == INT_MAX) 
        x1 = INT_MAX;
    int y1 = y + h;
    if (h == INT_MAX) 
        y1 = INT_MAX;

    int x0 = x;
    if (x0 < windowX) 
        x0 = windowX;
    int y0 = y;
    if (y0 < windowY)  
        y0 = windowY;

    if (x1 > windowX + windowWidth) 
        x1 = windowX + windowWidth;
    if (y1 > windowY + windowHeight) 
        y1 = windowY + windowHeight;
    if (x1 <= x || y1 <= y) 
        return;

    GC savedGC;
    if (createGC) {
        // Save the previous graphic contex, create a temporary GC
        savedGC = m_GC;
        m_GC = XCreateGC(m_Display, m_Window, 0, 0);
        setFont(textFont);
    }

    int left = leftMargin + (x0 - windowX) * dx;
    int top = topMargin + (y0 - windowY) * dy;
    int width = (x1 - x0) * dx;
    int height = (y1 - y0) * dy;

    if (left + width > m_IWinRect.width())
        width -= (left + width - m_IWinRect.width());
    if (top + height > m_IWinRect.height())
        height -= (top + height - m_IWinRect.height());

    if (!createGC) {
        redrawRectangle(
            I2Rectangle(left, top, width, height)
        );
    } else {
        // Erase a window
        setForeground(bgColor);
        fillRectangle(
            I2Rectangle(left, top, width, height)
        );

        // Draw a text in a window
        setForeground(fgColor);
        int iy = top + ascent;
        for (int yy = y0; yy < y1; yy++, iy += dy) {
            const TextLine* currentLine;
            if (yy > text.size()) {
                break;
            } else if (yy == text.size()) {
                currentLine = &(endOfText);
            } else {
                currentLine = &(text.getLine(yy));
            }
            int len = currentLine->length();
            if (len > x0) {
                len -= x0;
                if (len > x1 - x0)
                    len = x1 - x0;
                drawString(
                    left, iy,
                    currentLine->getString() + x0,
                    len
                );
            }
        }
    }

    if (createGC) {
        // Release the temporary graphic contex, restore the previous GC
        XFreeGC(m_Display, m_GC);
        m_GC = savedGC;
    }
}
Ejemplo n.º 16
0
void TriangularMaze::paint(CDC &dc) {
  fillRectangle(dc,getRect(),WHITE);
  m_horizontalWall.paint(dc);
  m_verticalWall.paint(dc);

/*
  for(size_t r = 0; r < m_cell.getRowCount(); r++) {
    for(size_t  c = 0; c < m_cell.getColumnCount(); c++)
      m_cell.get(r,c).markCenter(dc);
  }
  MazeCell &cell = m_cell(5,6);
  for(size_t I = 0; I < cell.getWallCount(); I++) {
    MazeCell nc = cell.getNeighbor(I);
    nc.mark(g);
  }

  m_cell.markCell(g,0,0);
  m_cell.markCell(g,0,2);
  m_cell.markCell(g,0,4);

  m_cell.markCell(g,2,1);
  m_cell.markCell(g,2,3);
  m_cell.markCell(g,2,5);


  m_cell.markCell(g,5,0);
  m_cell.markCell(g,5,2);
  m_cell.markCell(g,5,4);

  m_cell.markCell(g,7,1);
  m_cell.markCell(g,7,3);
  m_cell.markCell(g,7,5);


  g.setColor(Color.RED);
  m_verticalWall.get(0,0).paint(g);
  g.setColor(Color.GREEN);
  m_verticalWall.get(0,1).paint(g);
  g.setColor(Color.BLUE);
  m_verticalWall.get(0,2).paint(g);

  g.setColor(Color.RED);
  m_verticalWall.get(0,m_verticalWall.getColumns()-2).paint(g);
  g.setColor(Color.GREEN);
  m_verticalWall.get(0,m_verticalWall.getColumns()-1).paint(g);
  g.setColor(Color.BLUE);
  m_verticalWall.get(0,m_verticalWall.getColumns()).paint(g);

  g.setColor(Color.RED);
  m_verticalWall.get(3,0).paint(g);
  g.setColor(Color.GREEN);
  m_verticalWall.get(3,1).paint(g);
  g.setColor(Color.BLUE);
  m_verticalWall.get(3,2).paint(g);

  g.setColor(Color.RED);
  m_verticalWall.get(3,m_verticalWall.getColumns()-2).paint(g);
  g.setColor(Color.GREEN);
  m_verticalWall.get(3,m_verticalWall.getColumns()-1).paint(g);
  g.setColor(Color.BLUE);
  m_verticalWall.get(3,m_verticalWall.getColumns()).paint(g);

  getStartCell().markCenter(g);
  getEndCell().markCenter(g);
*/
}
Ejemplo n.º 17
0
void PICadillo35t::fillScreen(uint16_t color) 
{
	fillRectangle(0, 0,  _width, _height, color);
    _cacheState = cacheInvalid;
}
Ejemplo n.º 18
0
void ArduRCT_Graphics::_executeMacroCommand(ardurct_graphicsMacroCommand_t *mc, int16_t x, int16_t y, uint16_t scaleMul, uint16_t scaleDiv) {
    uint8_t group = mc->cmd & GRAPHICS_MACRO_CMD_GROUP_MASK;

    // presets
    if (group == GRAPHICS_MACRO_CMD_GROUP_PRESET) {
        if (mc->cmd == GRAPHICS_MACRO_CMD_PRESET_FOREGROUND) _mForegroundColor = mc->color;
        else if (mc->cmd == GRAPHICS_MACRO_CMD_PRESET_BACKGROUND) _mBackgroundColor = mc->color;
        else if (mc->cmd == GRAPHICS_MACRO_CMD_PRESET_THICKNESS) {
            _mThickness = mc->param[GRAPHICS_MACRO_PARAM_THICKNESS];
            _mIsThicknessScalable = mc->param[GRAPHICS_MACRO_PARAM_THICKNESS_IS_SCALABLE] != 0;
        } else if (mc->cmd == GRAPHICS_MACRO_CMD_PRESET_ERASE) fillScreen(_mBackgroundColor);
        else if (mc->cmd == GRAPHICS_MACRO_CMD_PRESET_FONT) {
            _mFontSize = mc->param[GRAPHICS_MACRO_PARAM_FONT_SIZE];
            _mIsFontBold = (mc->param[GRAPHICS_MACRO_PARAM_FONT_IS_BOLD] != 0);
            _mIsFontOverlay = (mc->param[GRAPHICS_MACRO_PARAM_FONT_IS_OVERLAY] != 0);
        } else if (mc->cmd == GRAPHICS_MACRO_CMD_PRESET_SCALE) {
            _mScaleMul = mc->param[GRAPHICS_MACRO_PARAM_SCALE_MUL];
            _mScaleDiv = 1;
            if ((mc->nbParams > 1) && (mc->param[GRAPHICS_MACRO_PARAM_SCALE_DIV] != 0)) _mScaleDiv = mc->param[GRAPHICS_MACRO_PARAM_SCALE_DIV];
        }
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.println("preset");    
#endif
        return;
    }
    
    int32_t sMul = _mScaleMul;
    sMul = sMul * (scaleMul == 0 ? 1 : scaleMul);
    int32_t sDiv = _mScaleDiv;
    sDiv = sDiv * (scaleDiv == 0 ? 1 : scaleDiv);
    int32_t sX = mc->param[GRAPHICS_MACRO_PARAM_X1];
    sX = sX * sMul/sDiv + x;
    int32_t sY = mc->param[GRAPHICS_MACRO_PARAM_Y1];        
    sY = sY * sMul/sDiv + y;        
    int32_t sThickness = _mThickness;
    if (_mIsThicknessScalable) sThickness = sThickness * sMul/sDiv;    
    
    // lines
    if (group == GRAPHICS_MACRO_CMD_GROUP_LINE) {
        int32_t sX2, sY2;
        if (mc->nbParams < 2) return;
        if (mc->cmd == GRAPHICS_MACRO_CMD_LINE) {
            if (mc->nbParams > 2) {
                sX2 = mc->param[GRAPHICS_MACRO_PARAM_X2];
                sX2 = x + sX2 * sMul/sDiv;
                sY2 = mc->param[GRAPHICS_MACRO_PARAM_Y2];
                sY2 = y + sY2 * sMul/sDiv;
                // p2 becomes the end point
                _mX = mc->param[GRAPHICS_MACRO_PARAM_X2];
                _mY = mc->param[GRAPHICS_MACRO_PARAM_Y2];
            } else {
                sX2 = sX;
                sY2 = sY;
                sX = _mX;
                sX = x + sX * sMul/sDiv;
                sY = _mY;    
                sY = y + sY * sMul/sDiv;    
                // p1 becomes the end point
                _mX = mc->param[GRAPHICS_MACRO_PARAM_X1];
                _mY = mc->param[GRAPHICS_MACRO_PARAM_Y1];
            }
        } else {
            // delta values
            if (mc->nbParams > 2) {
                // p2 = p1+delta
                sX2 = mc->param[GRAPHICS_MACRO_PARAM_X1] + mc->param[GRAPHICS_MACRO_PARAM_X2];
                sX2 = x + sX2 * sMul/sDiv;
                sY2 = mc->param[GRAPHICS_MACRO_PARAM_Y1] + mc->param[GRAPHICS_MACRO_PARAM_Y2];
                sY2 = y + sY2 * sMul/sDiv;
                // p1+delta becomes the end point
                _mX = mc->param[GRAPHICS_MACRO_PARAM_X1] + mc->param[GRAPHICS_MACRO_PARAM_X2];
                _mY = mc->param[GRAPHICS_MACRO_PARAM_Y1] + mc->param[GRAPHICS_MACRO_PARAM_Y2];
            } else {
                // p2 = old_point+delta
                sX2 = _mX + mc->param[GRAPHICS_MACRO_PARAM_X1];
                sX2 = x + sX2 * sMul/sDiv;
                sY2 = _mY + mc->param[GRAPHICS_MACRO_PARAM_Y1];
                sY2 = y + sY2 * sMul/sDiv;
                sX = _mX;
                sX = x + sX * sMul/sDiv;
                sY = _mY;    
                sY = y + sY * sMul/sDiv;    
                // old_point+delta  becomes the end point
                _mX += mc->param[GRAPHICS_MACRO_PARAM_X1];
                _mY += mc->param[GRAPHICS_MACRO_PARAM_Y1];
            }
            
        }
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.print("line "); Serial.print(sX); Serial.print(" "); Serial.print(sY); Serial.print(" "); 
            Serial.print(sX2); Serial.print(" "); Serial.println(sY2);
#endif
        drawLine(sX, sY, sX2, sY2, _mForegroundColor, sThickness, false);
        return;
    }    
    
    // arcs
    if (group == GRAPHICS_MACRO_CMD_GROUP_ARC) {
        if (mc->nbParams < 1) return;
        boolean reversed = (mc->cmd == GRAPHICS_MACRO_CMD_ARC_REVERSED) || (mc->cmd == GRAPHICS_MACRO_CMD_ARC_FILLED_REVERSED);
        int32_t sRadius = 0;
        if (mc->nbParams == 1) {
            sRadius = mc->param[GRAPHICS_MACRO_PARAM_ARC_1];
            sRadius = sRadius * sMul/sDiv;
            int32_t sArcStartX = _getArcEnd(sRadius, mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], !reversed, true);
            int32_t sArcStartY = _getArcEnd(sRadius, mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], !reversed, false);
            int32_t sArcEndX = _getArcEnd(sRadius, mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], reversed, true);
            int32_t sArcEndY = _getArcEnd(sRadius, mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], reversed, false);
            sX = _mX;
            sX = x + sX * sMul/sDiv - sArcStartX;
            sY = _mY;
            sY = y + sY * sMul/sDiv - sArcStartY;
            _mX += sArcEndX - sArcStartX;
            _mY += sArcEndY - sArcStartY;

        } else if (mc->nbParams == 3) {
            sRadius = mc->param[GRAPHICS_MACRO_PARAM_ARC_3];
            sRadius = sRadius * sMul/sDiv;
            _mX = mc->param[GRAPHICS_MACRO_PARAM_X1] + _getArcEnd(mc->param[GRAPHICS_MACRO_PARAM_ARC_3], mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], reversed, true);
            _mY = mc->param[GRAPHICS_MACRO_PARAM_Y1] + _getArcEnd(mc->param[GRAPHICS_MACRO_PARAM_ARC_3], mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], reversed, false);
        } else return;
        if ((mc->cmd == GRAPHICS_MACRO_CMD_ARC_REVERSED) || (mc->cmd == GRAPHICS_MACRO_CMD_ARC)) 
            drawArc(sX, sY, sRadius, mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], _mForegroundColor, sThickness, false);
        else fillArc(sX, sY, sRadius, mc->param[GRAPHICS_MACRO_PARAM_ARC_OCTANT], _mForegroundColor, false);            
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.print("arc "); Serial.print(sX); Serial.print(" "); Serial.print(sY); Serial.print(" "); Serial.println(sRadius);
#endif
        return;
    }
    
    // circles
    if (group == GRAPHICS_MACRO_CMD_GROUP_CIRCLE) {
        // we need at least 3 parameters
        if (mc->nbParams < 3) return;
        int32_t sRadius = mc->param[GRAPHICS_MACRO_PARAM_RADIUS];
        sRadius = sRadius * sMul/sDiv;
        if (mc->cmd == GRAPHICS_MACRO_CMD_CIRCLE) drawCircle(sX, sY, sRadius, _mForegroundColor, sThickness, false);
        else fillCircle(sX, sY, sRadius, _mForegroundColor, false);
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.print("circle "); Serial.print(sX); Serial.print(" "); Serial.print(sY); Serial.print(" "); Serial.println(sRadius);
#endif
        return;
    }
    
    // rectangles
    if (group == GRAPHICS_MACRO_CMD_GROUP_RECTANGLE) {
        // we need at least 4 parameters
        if (mc->nbParams < 4) return;
        int32_t sWidth = mc->param[GRAPHICS_MACRO_PARAM_WIDTH];
        sWidth = sWidth * sMul/sDiv;
        int32_t sHeight = mc->param[GRAPHICS_MACRO_PARAM_HEIGHT];
        sHeight = sHeight * sMul/sDiv;
        if (mc->cmd == GRAPHICS_MACRO_CMD_RECTANGLE) drawRectangle(sX, sY, sWidth, sHeight, _mForegroundColor, sThickness, false);
        else if (mc->cmd == GRAPHICS_MACRO_CMD_RECTANGLE_FILLED) fillRectangle(sX, sY, sWidth, sHeight, _mForegroundColor, false);
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.print("rectangle "); Serial.print(sX); Serial.print(" "); Serial.print(sY); Serial.print(" "); Serial.print(sWidth); Serial.print(" "); Serial.println(sHeight);
#endif
        // we need at least 1 more parameter to display the rounded rectangle
        if (mc->nbParams < 5) return;
        int32_t sRadius = mc->param[GRAPHICS_MACRO_PARAM_ROUNDING];
        sRadius = sRadius * sMul/sDiv;
        if (mc->cmd == GRAPHICS_MACRO_CMD_RECTANGLE_ROUNDED) drawRoundedRectangle(sX, sY, sWidth, sHeight, sRadius, _mForegroundColor, sThickness, false);
        else if (mc->cmd == GRAPHICS_MACRO_CMD_RECTANGLE_ROUNDED_FILLED) fillRoundedRectangle(sX, sY, sWidth, sHeight, sRadius, _mForegroundColor, false);
        return;
    }
    
    // triangles
    if (group == GRAPHICS_MACRO_CMD_GROUP_TRIANGLE) {
        // we need at least 6 parameters
        if (mc->nbParams < 6) return;
        int32_t sX2 = mc->param[GRAPHICS_MACRO_PARAM_X2];
        sX2 = x + sX2 * sMul/sDiv;
        int32_t sY2 = mc->param[GRAPHICS_MACRO_PARAM_Y2];
        sY2 = y + sY2 * sMul/sDiv;
        int32_t sX3 = mc->param[GRAPHICS_MACRO_PARAM_X3];
        sX3 = x + sX3 * sMul/sDiv;
        int32_t sY3 = mc->param[GRAPHICS_MACRO_PARAM_Y3];
        sY3 = y + sY3 * sMul/sDiv;
        if (mc->cmd == GRAPHICS_MACRO_CMD_TRIANGLE) drawTriangle(sX, sY, sX2, sY2, sX3, sY3, _mForegroundColor, sThickness, false);
        else if (mc->cmd == GRAPHICS_MACRO_CMD_TRIANGLE_FILLED) fillTriangle(sX, sY, sX2, sY2, sX3, sY3, _mForegroundColor, false);
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.print("triangle "); Serial.print(sX); Serial.print(" "); Serial.print(sY); Serial.print(" "); Serial.print(sX2); Serial.print(" "); Serial.print(sY2); 
            Serial.print(" "); Serial.print(sX3); Serial.print(" "); Serial.println(sY3);
#endif
        return;
    }
        
    // strings
    if (mc->cmd == GRAPHICS_MACRO_CMD_STRING) {
        if (mc->nbParams < 2) return;
        int bc = _backgroundColor;
        if (!_mIsFontOverlay) setBackgroundColor(_mBackgroundColor);
        drawString((char *)mc->text, sX, sY, _mForegroundColor, _mFontSize, _mIsFontBold, _mIsFontOverlay, false);
        if (!_mIsFontOverlay) setBackgroundColor(bc);
#ifdef GRAPHICS_MACRO_DEBUG
        Serial.print("text "); Serial.println((char *)mc->text);
#endif

        return;
    }
    
    // executes
    if (group == GRAPHICS_MACRO_CMD_GROUP_EXECUTE) {
        if (mc->param[GRAPHICS_MACRO_PARAM_MACRO_NUMBER] >= GRAPHICS_MACRO_MAX_NUMBER) return;
        // read the length in the EEPROM allocation table
        int length = eeprom_read_uint8_t(mc->param[GRAPHICS_MACRO_PARAM_MACRO_NUMBER]);
        if (length == 0xFF) return;
        // read the EEPROM pointers table to get the start
        int start = GRAPHICS_MACRO_MAX_NUMBER + mc->param[GRAPHICS_MACRO_PARAM_MACRO_NUMBER] * GRAPHICS_MACRO_MAX_SIZE;
        // get the compressed macro
        uint8_t buffer[GRAPHICS_MACRO_MAX_SIZE];
        uint8_t i=0;
        while (i < length) {
            buffer[i] = eeprom_read_uint8_t(start+i);
            i++;
        }
        buffer[i] = 0;
        ardurct_graphicsMacroCommand_t emc;
        // uncompress the macro commands and execute them
        if (mc->cmd == GRAPHICS_MACRO_CMD_EXECUTE_WITH_RESET) _initializeMacros();
        i = 0;
        while (i < length) {
            int8_t len = _uncompressMacroCommand(buffer, i, &emc);
            if (len == GRAPHICS_MACRO_FORMAT_ERROR) return;
            _executeMacroCommand(&emc, x, y, scaleMul, scaleDiv);
            i = len;
        }
    }
}