コード例 #1
0
/*********************************************************************************************************
** Function name:           drawRectangle
** Descriptions:            drawRectangle
*********************************************************************************************************/
void ePaper::drawRectangle(int poX, int poY, int len, int width)
{
    drawHorizontalLine(poX, poY, len);
    drawHorizontalLine(poX, poY+width, len);
    drawVerticalLine(poX, poY, width);
    drawVerticalLine(poX + len, poY, width);
}
コード例 #2
0
ファイル: TFTv2.cpp プロジェクト: 0xPIT/Arduino
void TFT::drawRectangle(INT16U poX, INT16U poY, INT16U length, INT16U width,INT16U color)
{
    drawHorizontalLine(poX, poY, length, color);
    drawHorizontalLine(poX, poY+width, length, color);
    drawVerticalLine(poX, poY, width,color);
    drawVerticalLine(poX + length, poY, width,color);
}
コード例 #3
0
ファイル: DirectXHook.cpp プロジェクト: ChurroV2/ElDorito
void DirectXHook::drawBox(int x, int y, int width, int height, D3DCOLOR BorderColor, D3DCOLOR FillColor)
{
	drawRect(x, y, width, height, FillColor);
	drawHorizontalLine(x, y, width, BorderColor);
	drawVerticalLine(x, y, height, BorderColor);
	drawVerticalLine(x + width, y, height, BorderColor);
	drawHorizontalLine(x, y + height, width, BorderColor);
}
コード例 #4
0
ファイル: TFTv2.cpp プロジェクト: Bazing4/libraries
void TFT::drawRectangle(unsigned int poX, unsigned int poY, unsigned int length, unsigned int width,unsigned int color)
{
    drawHorizontalLine(poX, poY, length, color);
    drawHorizontalLine(poX, poY+width-1, length, color);
    drawVerticalLine(poX, poY, width,color);
    drawVerticalLine(poX + length-1, poY, width,color);

}
コード例 #5
0
ファイル: TFTLCD.cpp プロジェクト: imclab/picture-portal
// draw a rectangle
void TFTLCD::drawRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, 
		      uint16_t color) {
  // smarter version
  drawHorizontalLine(x, y, w, color);
  drawHorizontalLine(x, y+h-1, w, color);
  drawVerticalLine(x, y, h, color);
  drawVerticalLine(x+w-1, y, h, color);
}
コード例 #6
0
ファイル: TFTLCD.c プロジェクト: blaezec/stm32f4
void fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint16_t color)
{
    if (y0 > y1)
    {
        swap(y0, y1); swap(x0, x1);
    }
    if (y1 > y2)
    {
        swap(y2, y1); swap(x2, x1);
    }
    if (y0 > y1)
    {
        swap(y0, y1); swap(x0, x1);
    }

    int32_t dx1, dx2, dx3; // Interpolation deltas
    int32_t sx1, sx2, sy; // Scanline co-ordinates

    sx2=(int32_t)x0 * (int32_t)1000; // Use fixed point math for x axis values
    sx1 = sx2;
    sy=y0;

  // Calculate interpolation deltas
    if (y1-y0 > 0) dx1=((x1-x0)*1000)/(y1-y0);
    else dx1=0;
    if (y2-y0 > 0) dx2=((x2-x0)*1000)/(y2-y0);
    else dx2=0;
    if (y2-y1 > 0) dx3=((x2-x1)*1000)/(y2-y1);
    else dx3=0;

  // Render scanlines (horizontal lines are the fastest rendering method)
    if (dx1 > dx2)
    {
        for(; sy<=y1; sy++, sx1+=dx2, sx2+=dx1)
        {
            drawHorizontalLine(sx1/1000, sy, (sx2-sx1)/1000, color);
        }
        sx2 = x1*1000;
        sy = y1;
        for(; sy<=y2; sy++, sx1+=dx2, sx2+=dx3)
        {
            drawHorizontalLine(sx1/1000, sy, (sx2-sx1)/1000, color);
        }
    }
    else
    {
        for(; sy<=y1; sy++, sx1+=dx1, sx2+=dx2)
        {
            drawHorizontalLine(sx1/1000, sy, (sx2-sx1)/1000, color);
        }
        sx1 = x1*1000;
        sy = y1;
        for(; sy<=y2; sy++, sx1+=dx3, sx2+=dx2)
        {
            drawHorizontalLine(sx1/1000, sy, (sx2-sx1)/1000, color);
        }
    }
}
コード例 #7
0
ファイル: DungeonUtil.cpp プロジェクト: jrbeck/longshot
void DungeonUtil::drawRect(int x1, int y1, int x2, int y2, const SelectiveDungeonTile& tile) {
  orderAscending(x1, x2);
  orderAscending(y1, y2);

  drawHorizontalLine(x1, x2, y1, tile);
  drawHorizontalLine(x1, x2, y2, tile);
  drawVerticalLine(x1, y1 + 1, y2 - 1, tile);
  drawVerticalLine(x2, y1 + 1, y2 - 1, tile);
}
コード例 #8
0
ファイル: region.cpp プロジェクト: VillainyStudios/opensludge
void showBoxes () {
	screenRegion * huntRegion = allScreenRegions;

	while (huntRegion) {
		drawVerticalLine (huntRegion -> x1, huntRegion -> y1, huntRegion -> y2);
		drawVerticalLine (huntRegion -> x2, huntRegion -> y1, huntRegion -> y2);
		drawHorizontalLine (huntRegion -> x1, huntRegion -> y1, huntRegion -> x2);
		drawHorizontalLine (huntRegion -> x1, huntRegion -> y2, huntRegion -> x2);
		huntRegion = huntRegion -> next;
	}
}
コード例 #9
0
ファイル: TFTLCD.cpp プロジェクト: imclab/picture-portal
// draw a rounded rectangle
void TFTLCD::drawRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t r,
			   uint16_t color) {
  // smarter version
  drawHorizontalLine(x+r, y, w-2*r, color);
  drawHorizontalLine(x+r, y+h-1, w-2*r, color);
  drawVerticalLine(x, y+r, h-2*r, color);
  drawVerticalLine(x+w-1, y+r, h-2*r, color);
  // draw four corners
  drawCircleHelper(x+r, y+r, r, 1, color);
  drawCircleHelper(x+w-r-1, y+r, r, 2, color);
  drawCircleHelper(x+w-r-1, y+h-r-1, r, 4, color);
  drawCircleHelper(x+r, y+h-r-1, r, 8, color);
}
コード例 #10
0
ファイル: game.c プロジェクト: dong-brian/2048Plus
void drawMovingBlocks(int row, int col, Direction d, int spaces) {
    int r = TOP_MARGIN + (BLOCK_SIZE + 1)*row + 1;
    int c = LEFT_MARGIN + (BLOCK_SIZE + 1)*col + 1;
    int length = 0;
    switch (d) {
        case UP:
            length = (size - row)*(BLOCK_SIZE + 1) - 1;
            for (int i = 0; i < spaces; i++) {
                for (int j = 0; j < BLOCK_NUM_MOVES; j++) {
                    shiftRectVertical(r + BLOCK_SPEED, c, BLOCK_SIZE, length, -BLOCK_SPEED);
                }
                waitForVblank();
                drawHorizontalLine(r + length, c, BLOCK_SIZE, WHITE);
            }
            break;
        case DOWN:
            r = TOP_MARGIN + 1;
            length = (row + 1)*(BLOCK_SIZE + 1) - 1;
            for (int i = 0; i < spaces; i++) {
                for (int j = 0; j < BLOCK_NUM_MOVES; j++) {
                    shiftRectVertical(r, c, BLOCK_SIZE, length - BLOCK_SPEED, BLOCK_SPEED);
                }
                waitForVblank();
                drawHorizontalLine(r + BLOCK_SIZE, c, BLOCK_SIZE, WHITE);
            }
            break;
        case LEFT:
            length = (size - col)*(BLOCK_SIZE + 1) - 1;
            for (int i = 0; i < spaces; i++) {
                for (int j = 0; j < BLOCK_NUM_MOVES; j++) {
                    shiftRectHorizontal(r, c + BLOCK_SPEED, length, BLOCK_SIZE, -BLOCK_SPEED);
                }
                waitForVblank();
                drawVerticalLine(r, c + length, BLOCK_SIZE, WHITE);
            }
            break;
        case RIGHT:
            c = LEFT_MARGIN + 1;
            length = (col + 1)*(BLOCK_SIZE + 1) - 1;
            for (int i = 0; i < spaces; i++) {
                for (int j = 0; j < BLOCK_NUM_MOVES; j++) {
                    shiftRectHorizontal(r, c, length - BLOCK_SPEED, BLOCK_SIZE, BLOCK_SPEED);
                }
                waitForVblank();
                drawVerticalLine(r, c + BLOCK_SIZE, BLOCK_SIZE, WHITE);
            }
            break;
    }
}
コード例 #11
0
/*********************************************************************************************************
** Function name:           drawTraingle
** Descriptions:            drawTraingle
*********************************************************************************************************/
void ePaper::fillRectangle(int poX, int poY, int len, int width)
{
    for(int i=0; i<width; i++)
    {
        drawHorizontalLine(poX, poY+i, len);
    }
}
コード例 #12
0
ファイル: game.c プロジェクト: dong-brian/2048Plus
void drawBoard() {
    int length = (BLOCK_SIZE + 1)*size + 1;
    for (int i = 0; i <= size; i++) {
        drawHorizontalLine(TOP_MARGIN + (BLOCK_SIZE + 1)*i, LEFT_MARGIN, length, WHITE);
        drawVerticalLine(TOP_MARGIN, LEFT_MARGIN + (BLOCK_SIZE + 1)*i, length, WHITE);
    }
}
コード例 #13
0
ファイル: DungeonUtil.cpp プロジェクト: jrbeck/longshot
void DungeonUtil::drawFilledRect(int x1, int y1, int x2, int y2, const SelectiveDungeonTile& innerTile, const SelectiveDungeonTile& borderTile) {
  orderAscending(x1, x2);
  orderAscending(y1, y2);

  // draw the interior: shamelessly stolen from the other drawFilledRect()
  for(int j = y1 + 1; j < y2; j++) {
    for(int i = x1 + 1; i < x2; i++) {
      mDungeon->setTile(i, j, innerTile);
    }
  }

  // draw the border: stolen from drawRect()
  drawHorizontalLine(x1, x2, y1, borderTile);
  drawHorizontalLine(x1, x2, y2, borderTile);
  drawVerticalLine(x1, y1, y2, borderTile);
  drawVerticalLine(x2, y1, y2, borderTile);
}
コード例 #14
0
//
// _drawSampledIndicator()
//
void DrawingCanvas:: _drawSampledIndicator(double x, double y){
	
	double offset = DrawingMetrics::getIconRadius();
	double padding = 1.0*DrawingMetrics::getScalingFactor();
	double symbolDiameter = 2.5*DrawingMetrics::getScalingFactor();
	double symbolRadius   = 0.5*symbolDiameter;
	
	double ax = x - offset - padding - symbolRadius; 
	double ay = y - offset + symbolRadius;
	
	drawHorizontalLine (ay, ax - symbolRadius , ax + symbolRadius );
	drawVerticalLine   (ax, ay - symbolRadius , ay + symbolRadius );
	
}
コード例 #15
0
ファイル: main.c プロジェクト: blaezec/stm32f4
void testfastlines(uint16_t color1, uint16_t color2)
{
    uint16_t x,y;
    fillScreen(BLACK);
    for ( y=0; y < height(); y+=5)
    {
        drawHorizontalLine(0, y, width(), color1);
    }
    for ( x=0; x < width(); x+=5)
    {
        drawVerticalLine(x, 0, height(), color2);
    }

}
コード例 #16
0
ファイル: lgui.c プロジェクト: unregistered/lg-activate
void DeviceAddScreen::render()
{
    uint16_t schcolor = color565(142,35,35);
    fillScreen(BLACK);
    makeRectangle(15,15, 200,280, BLACK, 5);
    drawPgmString(210,50 , PSTR("ADD ADAPTERS"), schcolor, BLACK, 2);
    drawPgmString(180,50, PSTR("While this screen is open, devices will"), WHITE, BLACK, 1);
    drawPgmString(170,50, PSTR("synchronize with the basestation. Press"), WHITE, BLACK, 1);
    drawPgmString(160,50, PSTR("and hold HOME or BACK to exit."), WHITE, BLACK, 1);

    drawCircle(100, 100, 30, WHITE);
    drawCircle(100, 220, 30, WHITE);
    drawHorizontalLine(100, 130, 60, WHITE, 1);
    // 100, 190 is point of arrow
    for(int8_t i=0; i < 8; i++) {
        drawPixel(100-i, 190-i, WHITE);
        drawPixel(100+i, 190-i, WHITE);
    }

    for(int8_t i=0; i < 8; i++) {
        drawPixel(100-i, 130+i, WHITE);
        drawPixel(100+i, 130+i, WHITE);
    }
}
コード例 #17
0
ファイル: TFTLCD.cpp プロジェクト: imclab/picture-portal
// fill a rectangle
void TFTLCD::fillRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, 
		      uint16_t fillcolor) {
  // smarter version
  while (h--)
    drawHorizontalLine(x, y++, w, fillcolor);
}
コード例 #18
0
ファイル: lgui.c プロジェクト: unregistered/lg-activate
void SettingsSetTimeScreen::render()
{
    uint16_t setcolor = color565(35,142,35);
    fillScreen(BLACK);
	makeRectangle(5,5, 230,310, setcolor, 3);
	drawPgmString(225,50 , PSTR("SET TIME"), setcolor, BLACK, 2);

	drawVerticalLine(0,160,235, setcolor,  3);

	makeRectangle(190, 30, 30,100, WHITE, 3);
	makeRectangle(190, 190, 30, 100, WHITE, 3);
	drawPgmString(195, 60, PSTR("DATE"), WHITE, BLACK, 2);
	drawPgmString(195, 220, PSTR("TIME"), WHITE , BLACK, 2);

	drawPgmString(175, 10, PSTR("MONTH"), WHITE, BLACK, 1);
	drawPgmString(175, 63, PSTR("DAY"), WHITE, BLACK, 1);
	drawPgmString(175, 107, PSTR("YEAR"), WHITE, BLACK, 1);
	drawPgmString(175, 165, PSTR("HOUR"), WHITE, BLACK, 1);
	drawPgmString(175, 213, PSTR("MINUTE"), WHITE, BLACK, 1);
	drawPgmString(175, 276, PSTR("AM/PM"), WHITE, BLACK, 1);

	makeRectangle(135, 10, 35, 33, BLUE, 3);
	makeRectangle(135, 63, 35, 34, BLUE, 3);
	makeRectangle(135, 117, 35, 33, BLUE, 3);
	makeRectangle(135, 170, 35, 33, BLUE, 3);
	makeRectangle(135, 223, 35, 34, BLUE, 3);
	makeRectangle(135, 277, 35, 33, BLUE, 3);

	drawChar(110, 45, '/', WHITE, BLACK, 2);
	drawChar(110, 95, '/', WHITE, BLACK, 2);
	drawChar(110, 205, ':', WHITE, BLACK, 2);

	drawHorizontalLine(105, 0, 319, WHITE, 3);
	drawHorizontalLine(125, 0, 319, WHITE, 3);
	makeRectangle(60, 10, 35, 33, RED, 3);
	makeRectangle(60, 63, 35, 34, RED, 3);
	makeRectangle(60, 117, 35, 33, RED, 3);
	makeRectangle(60, 170, 35, 33, RED, 3);
	makeRectangle(60, 223, 35, 34, RED, 3);
	makeRectangle(60, 277, 35, 33, RED, 3);

	drawChar(150, 20,  '+', BLUE, BLACK, 2);
	drawChar(150, 73,  '+', BLUE, BLACK, 2);
	drawChar(150, 127, '+', BLUE, BLACK, 2);
	drawChar(150, 180, '+', BLUE, BLACK, 2);
	drawChar(150, 233, '+', BLUE, BLACK, 2);
	drawChar(150, 287, '+', BLUE, BLACK, 2);

	drawChar(75, 20,  '-', RED, BLACK, 2);
	drawChar(75, 73,  '-', RED, BLACK, 2);
	drawChar(75, 127, '-', RED, BLACK, 2);
	drawChar(75, 180, '-', RED, BLACK, 2);
	drawChar(75, 233, '-', RED, BLACK, 2);
	drawChar(75, 287, '-', RED, BLACK, 2);

	// makeRectangle(10, 20, 20, 120, GREEN, 3);
	// drawString(12, 30, "CONFIRM", BLACK, WHITE, 2);
    renderMonth();
    renderDay();
    renderYear();
    renderHour();
    renderMinute();
    renderAMPM();
}
コード例 #19
0
ファイル: CSE618Lab2.cpp プロジェクト: haitzza/classwork
void BresLine(glm::vec2 p1, glm::vec2 p2, GLubyte rgb[]) {
	if (p1.x == p2.x) {
		drawVerticalLine(p1,p2,rgb);
	} else if (p1.y == p2.y) {
		drawHorizontalLine(p1,p2,rgb);
	} else if (p1.x == p1.y && p2.x == p2.y) {
		drawDiagonalLine(p1,p2,rgb);
	}
	double m = (p2.y - p1.y) / (p2.x - p1.x);
	bool slope = m < 0;
	m = abs(m);
	if (m > 1) {
		std::swap(p1.x, p1.y);
		std::swap(p2.x, p2.y);
	} if (p1.x > p2.x) {
		std::swap(p1,p2);
	} 

	int x = p1.x, y = p1.y;
	int dx = p2.x - p1.x, dy = p2.y - p1.y;
	int dT = 2 * (dy-dx);
	int dS = 2 * dy;
	int d = 2 * (dy - dx);

	if (slope) {
		x = p2.x, y = p2.y;
		dx = p2.x - p1.x, dy = p1.y - p2.y;
		dT = 2 * (dy-dx);
		dS = 2 * dy;
		d = 2 * (dy - dx);

		while (x > p1.x) {
			x--;
			if (d < 0) {
				d = d + dS;
			} else {
				y++;
				d = d + dT;
			}
			if (m > 1) {
				setPixel(y,x,rgb);
			} else {
				setPixel(x, y, rgb);
			}		
		}
	}  else {
		while (x < p2.x) {
			x++;
			if (d < 0) {
				d = d + dS;
			} else {
				y++;
				d = d + dT;
			}
			if (m > 1) {
				setPixel(y,x,rgb);
			} else {
				setPixel(x, y, rgb);
			}
		} 
	}

	
}