static void rtgui_dc_buffer_draw_vline(struct rtgui_dc *self, int x1, int y1, int y2)
{
    struct rtgui_dc_buffer *dst;
    unsigned r, g, b, a;

    dst = (struct rtgui_dc_buffer *)self;

    if (x1 >= dst->width) return;
    if (y1 > dst->height) y1 = dst->height;
    if (y2 > dst->height) y2 = dst->height;

	r = RTGUI_RGB_R(dst->gc.foreground);
	g = RTGUI_RGB_G(dst->gc.foreground);
	b = RTGUI_RGB_B(dst->gc.foreground);
	a = RTGUI_RGB_A(dst->gc.foreground);

	switch (dst->pixel_format)
	{
	case RTGRAPHIC_PIXEL_FORMAT_RGB565:
		VLINE(rt_uint16_t, DRAW_SETPIXEL_RGB565, 0);
		break;
	case RTGRAPHIC_PIXEL_FORMAT_BGR565:
		VLINE(rt_uint16_t, DRAW_SETPIXEL_BGR565, 0);
		break;
	case RTGRAPHIC_PIXEL_FORMAT_RGB888:
		VLINE(rt_uint16_t, DRAW_SETPIXEL_RGB888, 0);
		break;
	case RTGRAPHIC_PIXEL_FORMAT_ARGB888:
		VLINE(rt_uint32_t, DRAW_SETPIXEL_ARGB8888, 0);
		break;
	}
}
Beispiel #2
0
// Wall cross item
void block::WALLIT() {
	e[0] = e[3] = true;
	item = 'w';

	BLOCK(SQ, 12, 14);
	VLINE('=', 12, 14, 1);
	VLINE('=', 12, 14, 2);
}
Beispiel #3
0
// Linha vertical
void block::FIREVLINE() {
	e[0] = e[7] = true;

	BLOCK(NR, 12, 0);
	VLINE(NR, 14, 0, 2);
	VLINE(NR, 15, 0, 3);
	VLINE(NR, 14, 0, 4);
}
Beispiel #4
0
// Bomb punch item
void block::PUNCHIT() {
	e[0] = e[3] = true;
	item = 'p';

	BLOCK(NR, 14, 0);
	VLINE(NR, 13, 0, 3);
	VLINE(B2, 12, 14, 5);
	DOT(DR, 13, 14, 14);
	DOT(NR, 15, 0, 21, 22);
	DOT(NR, 13, 0, 24);
	DOT(UR, 13, 14, 34);
}
Beispiel #5
0
static void
SDL_DrawLine4(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color,
              SDL_bool draw_end)
{
    if (y1 == y2) {
        HLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
    } else if (x1 == x2) {
        VLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
    } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
        DLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
    } else {
        Uint8 _r, _g, _b, _a;
        const SDL_PixelFormat * fmt = dst->format;
        SDL_GetRGBA(color, fmt, &_r, &_g, &_b, &_a);
        if (fmt->Rmask == 0x00FF0000) {
            if (!fmt->Amask) {
                AALINE(x1, y1, x2, y2,
                       DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY_BLEND_RGB888,
                       draw_end);
            } else {
                AALINE(x1, y1, x2, y2,
                       DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY_BLEND_ARGB8888,
                       draw_end);
            }
        } else {
            AALINE(x1, y1, x2, y2,
                   DRAW_FASTSETPIXELXY4, DRAW_SETPIXELXY4_BLEND_RGB,
                   draw_end);
        }
    }
}
Beispiel #6
0
static void
SDL_DrawLine1(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color,
              SDL_bool draw_end)
{
    if (y1 == y2) {
        int length;
        int pitch = (dst->pitch / dst->format->BytesPerPixel);
        Uint8 *pixel;
        if (x1 <= x2) {
            pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
            length = draw_end ? (x2-x1+1) : (x2-x1);
        } else {
            pixel = (Uint8 *)dst->pixels + y1 * pitch + x2;
            if (!draw_end) {
                ++pixel;
            }
            length = draw_end ? (x1-x2+1) : (x1-x2);
        }
        SDL_memset(pixel, color, length);
    } else if (x1 == x2) {
        VLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end);
    } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
        DLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end);
    } else {
        BLINE(x1, y1, x2, y2, DRAW_FASTSETPIXELXY1, draw_end);
    }
}
Beispiel #7
0
// Números
void block::NUMBER(short int x, short int color) {
	VLINE(0, 0, 0, 2);
	VLINE(0, 0, 0, 3);
	VLINE(0, 0, 0, 4);
	switch (x) {
		case 0: {
			DOT(NR, color, 0, 12, 14, 22, 24);
			DOT(UR, color, 0, 13, 32, 33, 34);
			break;
		}
		case 1: {
			DOT(NR, color, 0, 13, 23);
			DOT(UR, color, 0, 12, 33);
			break;
		}
		case 2: {
			DOT(NR, color, 0, 14, 22);
			VLINE(UR, color, 0, 3);
			DOT(UR, color, 0, 12, 24, 32, 34);
			break;
		}
		case 3: {
			DOT(NR, color, 0, 14, 24);
			DOT(UR, color, 0, 34);
			VLINE(UR, color, 0, 2);
			VLINE(UR, color, 0, 3);
			break;
		}
		case 4: {
			DOT(NR, color, 0, 12, 14, 24);
			DOT(UR, color, 0, 22, 23, 34);
			break;
		}
		case 5: {
			DOT(NR, color, 0, 12, 24);
			DOT(UR, color, 0, 14, 22, 32, 34);
			VLINE(UR, color, 0, 3);
			break;
		}
		case 6: {
			DOT(NR, color, 0, 12, 22, 24);
			DOT(UR, color, 0, 14, 32, 34);
			VLINE(UR, color, 0, 3);
			break;
		}
		case 7: {
			DOT(NR, color, 0, 12, 14, 24);
			DOT(UR, color, 0, 13, 34);
			break;
		}
		case 8: {
			DOT(NR, color, 0, 12, 14, 22, 24);
			DOT(UR, color, 0, 32, 34);
			VLINE(UR, color, 0, 3);
			break;
		}
		case 9: {
			DOT(NR, color, 0, 12, 14, 24);
			DOT(UR, color, 0, 22, 32, 34);
			VLINE(UR, color, 0, 3);
			break;
		}
	}
}
Beispiel #8
0
// Letras
void block::LETTER(char x, short int color) {
	ZERO();
	if (x == 'a' || x == 'A') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 12, 13, 22, 23);
		DOT(UR, color, 0, 31, 34);
	} else if (x == 'b' || x == 'B') {
		DOT(NR, color, 0, 11, 21);
		DOT(DR, color, 0, 14, 24);
		DOT(UR, color, 0, 31);
		VLINE(UR, color, 0, 2);
		VLINE(UR, color, 0, 3);
	} else if (x == 'c' || x == 'C') {
		DOT(NR, color, 0, 11, 21);
		DOT(UR, color, 0, 12, 13, 14);
		DOT(UR, color, 0, 31, 32, 33, 34);
	} else if (x == 'd' || x == 'D') {
		DOT(NR, color, 0, 11, 21, 24);
		DOT(UR, color, 0, 12, 13);
		DOT(UR, color, 0, 31, 32, 33);
		DOT(DR, color, 0, 14);
	} else if (x == 'e' || x == 'E') {
		BLOCK(UR, color, 0);
		DOT(NR, color, 0, 11, 21);
		VLINE(0, 0, 0, 5);
	} else if (x == 'f' || x == 'F') {
		DOT(NR, color, 0, 11, 21);
		DOT(UR, color, 0, 12, 13, 14);
		DOT(UR, color, 0, 22, 23, 24, 31);
	} else if (x == 'g' || x == 'G') {
		BLOCK(UR, color, 0);
		VLINE(0, 0, 0, 5);
		DOT(NR, color, 0, 11, 21, 24);
		DOT(0, color, 0, 22);
	} else if (x == 'h' || x == 'H') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 22, 23, 31, 34);
	} else if (x == 'i' || x == 'I') {
		DOT(NR, color, 0, 12, 13, 22, 23);
		DOT(UR, color, 0, 32, 33);
	} else if (x == 'j' || x == 'J') {
		DOT(NR, color, 0, 14, 24);
		DOT(UR, color, 0, 31, 32, 33, 34);
		DOT(DR, color, 0, 21);
	} else if (x == 'k' || x == 'K') {
		DOT(NR, color, 0, 11, 21);
		DOT(UR, color, 0, 14, 22, 31, 34);
		DOT(DR, color, 0, 13, 23);
	} else if (x == 'l' || x == 'L') {
		DOT(NR, color, 0, 11, 21);
		DOT(UR, color, 0, 31, 32, 33, 34);
	} else if (x == 'm' || x == 'M') {
		DOT(DR,color, 0, 12, 13);
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 31, 34);
		DOT(UT, 0, color, 22, 23);
	} else if (x == 'n' || x == 'N') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(DR, color, 0, 12);
		DOT(UR, color, 0, 23, 31, 34);
	} else if (x == 'o' || x == 'O') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 12, 13);
		DOT(UR, color, 0, 31, 32, 33, 34);
	} else if (x == 'p' || x == 'P') {
		DOT(NR, color, 0, 11, 14, 21);
		DOT(UR, color, 0, 12, 13, 22, 23);
		DOT(UR, color, 0, 24, 31);
	} else if (x == 'q' || x == 'Q') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 12, 13, 23);
		DOT(UR, color, 0, 31, 32, 33, 34);
		DOT(DR, color, 0, 22);
	} else if (x == 'r' || x == 'R') {
		DOT(NR, color, 0, 11, 21, 23);
		DOT(UR, color, 0, 12, 13, 22);
		DOT(UR, color, 0, 31, 33, 34);
		DOT(DR, color, 0, 14);
	} else if (x == 's' || x == 'S') {
		BLOCK(UR, color, 0);
		VLINE(0, 0, 0, 5);
		DOT(NR, color, 0, 11, 24);
	} else if (x == 't' || x == 'T') {
		DOT(NR, color, 0, 12, 13, 22, 23);
		DOT(UR, color, 0, 11, 14, 32, 33);
	} else if (x == 'u' || x == 'U') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 31, 32, 33, 34);
	} else if (x == 'v' || x == 'V') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 32, 33);
	} else if (x == 'w' || x == 'W') {
		DOT(NR, color, 0, 11, 14, 21, 24);
		DOT(UR, color, 0, 31, 32, 33, 34);
		DOT(DT, 0, color, 22, 23);
	} else if (x == 'x' || x == 'X') {
		DOT(NR, color, 0, 11, 14);
		DOT(DR, color, 0, 21, 24);
		DOT(UR, color, 0, 22, 23, 31, 34);
	} else if (x == 'y' || x == 'Y') {
		DOT(NR, color, 0, 11, 14, 22, 23);
		DOT(UR, color, 0, 21, 24, 32, 33);
	} else if (x == 'z' || x == 'Z') {
		BLOCK(UR, color, 0);
		VLINE(0, color, 0, 5);
		DOT(NR, color, 0, 14);
		DOT(0, color, 0, 24);
		DOT(DR, color, 0, 21);
	} else if (x == '!') {
		DOT(UR, color, 0, 23, 33);
		DOT(NR, color, 0, 13);
	} else if (x == '?') {
		DOT(DR, color, 0, 11, 14, 23, 33);
		DOT(UR, color, 0, 12, 13, 24);
	} else if (x == '-') {
		DOT(UR, color, 0, 22, 23, 24);
	} else if (x == '|') {
		DOT(DR, color, 0, 13);
		DOT(NR, color, 0, 23);
	}
}
Beispiel #9
0
static void
SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
                       SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                       SDL_bool draw_end)
{
    unsigned r, g, b, a, inva;

    if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
        r = DRAW_MUL(_r, _a);
        g = DRAW_MUL(_g, _a);
        b = DRAW_MUL(_b, _a);
        a = _a;
    } else {
        r = _r;
        g = _g;
        b = _b;
        a = _a;
    }
    inva = (a ^ 0xff);

    if (y1 == y2) {
        switch (blendMode) {
        case SDL_BLENDMODE_BLEND:
            HLINE(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888, draw_end);
            break;
        case SDL_BLENDMODE_ADD:
            HLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
            break;
        case SDL_BLENDMODE_MOD:
            HLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
            break;
        default:
            HLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
            break;
        }
    } else if (x1 == x2) {
        switch (blendMode) {
        case SDL_BLENDMODE_BLEND:
            VLINE(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888, draw_end);
            break;
        case SDL_BLENDMODE_ADD:
            VLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
            break;
        case SDL_BLENDMODE_MOD:
            VLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
            break;
        default:
            VLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
            break;
        }
    } else if (ABS(x1 - x2) == ABS(y1 - y2)) {
        switch (blendMode) {
        case SDL_BLENDMODE_BLEND:
            DLINE(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888, draw_end);
            break;
        case SDL_BLENDMODE_ADD:
            DLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
            break;
        case SDL_BLENDMODE_MOD:
            DLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
            break;
        default:
            DLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
            break;
        }
    } else {
        switch (blendMode) {
        case SDL_BLENDMODE_BLEND:
            AALINE(x1, y1, x2, y2,
                   DRAW_SETPIXELXY_BLEND_ARGB8888, DRAW_SETPIXELXY_BLEND_ARGB8888,
                   draw_end);
            break;
        case SDL_BLENDMODE_ADD:
            AALINE(x1, y1, x2, y2,
                   DRAW_SETPIXELXY_ADD_ARGB8888, DRAW_SETPIXELXY_ADD_ARGB8888,
                   draw_end);
            break;
        case SDL_BLENDMODE_MOD:
            AALINE(x1, y1, x2, y2,
                   DRAW_SETPIXELXY_MOD_ARGB8888, DRAW_SETPIXELXY_MOD_ARGB8888,
                   draw_end);
            break;
        default:
            AALINE(x1, y1, x2, y2,
                   DRAW_SETPIXELXY_ARGB8888, DRAW_SETPIXELXY_BLEND_ARGB8888,
                   draw_end);
            break;
        }
    }
}