当前位置: 首页>>代码示例>>C++>>正文


C++ plot_pixel函数代码示例

本文整理汇总了C++中plot_pixel函数的典型用法代码示例。如果您正苦于以下问题:C++ plot_pixel函数的具体用法?C++ plot_pixel怎么用?C++ plot_pixel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了plot_pixel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pcw16_vh_decode_mode1

/* 320, 2 bits per pixel */
static void pcw16_vh_decode_mode1(mame_bitmap *bitmap, int x, int y, unsigned char byte)
{
	int b;
	int px;
	int local_byte;
	int cols[4];

	for (b=0; b<3; b++)
	{
		cols[b] = Machine->pens[pcw16_colour_palette[b]];
	}

	local_byte = byte;

	px = x;
	for (b=0; b<4; b++)
	{
		int col;

		col = cols[((local_byte>>6) & 0x03)];

		plot_pixel(bitmap, px, y, col);
		px++;
		plot_pixel(bitmap, px, y, col);
		px++;

		local_byte = local_byte<<2;
	}
}
开发者ID:Synapseware,项目名称:coco,代码行数:30,代码来源:pcw16.c

示例2: draw_line

static void draw_line(mame_bitmap *bitmap, int x1, int y1, int x2, int y2, int dotted)
{
	/* Draws horizontal and Vertical lines only! */
	int col = Machine->pens[1];

	int count, skip;

	/* Draw the Line */

	if (dotted > 0)
		skip = 2;
	else
		skip = 1;

	if (x1 == x2)
	{
		for (count = y2; count >= y1; count -= skip)
		{
			plot_pixel(bitmap, x1, count, col);
		}
	}
	else
	{
		for (count = x2; count >= x1; count -= skip)
		{
			plot_pixel(bitmap, count, y1, col);
		}
	}
}
开发者ID:broftkd,项目名称:historic-mess,代码行数:29,代码来源:circus.c

示例3: line_slow

void line_slow(int x1, int y1, int x2, int y2, byte color)
{
  int dx,dy,sdx,sdy,px,py,dxabs,dyabs,i;
  float slope;

  dx=x2-x1;      /* the horizontal distance of the line */
  dy=y2-y1;      /* the vertical distance of the line */
  dxabs=abs(dx);
  dyabs=abs(dy);
  sdx=sgn(dx);
  sdy=sgn(dy);
  if (dxabs>=dyabs) /* the line is more horizontal than vertical */
  {
    slope=(float)dy / (float)dx;
    for(i=0;i!=dx;i+=sdx)
    {
      px=i+x1;
      py=slope*i+y1;
      plot_pixel(px,py,color);
    }
  }
  else /* the line is more vertical than horizontal */
  {
    slope=(float)dx / (float)dy;
    for(i=0;i!=dy;i+=sdy)
    {
      px=slope*i+x1;
      py=i+y1;
      plot_pixel(px,py,color);
    }
  }
}
开发者ID:pjmodi,项目名称:projects,代码行数:32,代码来源:lines.c

示例4: pdp1_draw_circle

static void pdp1_draw_circle(mame_bitmap *bitmap, int x, int y, int radius, int color)
{
	float fx, fy;
	float interval;


	fx = (float)x*crt_window_width/01777;
	fy = (float)y*crt_window_height/01777;

	interval = radius/sqrt(2);

	for (x=/*ceil*/(fx-interval); x<=fx+interval; x++)
	{
		float dy = sqrt(radius*radius-(x-fx)*(x-fx));

		if ((x >= 0) && (x <= crt_window_width-1) && (fy-dy >= 0))
			plot_pixel(bitmap, x, fy-dy, color);
		if ((x >= 0) && (x <= crt_window_width-1) && (y+dy <= crt_window_height-1))
			plot_pixel(bitmap, x, fy+dy, color);
	}
	for (y=/*ceil*/(fy-interval); y<=fy+interval; y++)
	{
		float dx = sqrt(radius*radius-(y-fy)*(y-fy));

		if ((fx-dx >= 0) && (y >= 0) && (y <= crt_window_height-1))
			plot_pixel(bitmap, fx-dx, y, color);
		if ((fx+dx <= crt_window_width-1) && (y >= 0) && (y <= crt_window_height-1))
			plot_pixel(bitmap, fx+dx, y, color);
	}
}
开发者ID:broftkd,项目名称:historic-mess,代码行数:30,代码来源:pdp1.c

示例5: graphics_bitmap

void graphics_bitmap( struct graphics *g, int32_t x, int32_t y, int32_t width, int32_t height, uint8_t *data )
{
	int i,j,b;
	int value;

	width = MIN(g->clip.w-x,width);
	height = MIN(g->clip.h-y,height);
	x += g->clip.x;
	y += g->clip.y;

	b=0;

	for(j=0;j<height;j++) {
		for(i=0;i<width;i++) {
			value = ((*data)<<b)&0x80;
			if(value) {
				plot_pixel(g->bitmap,x+i,y+j,g->fgcolor);
			} else {
				plot_pixel(g->bitmap,x+i,y+j,g->bgcolor);
			}
			b++;
			if(b==8) {
				data++;
				b=0;
			}
		}
	}
}
开发者ID:Shashwat-AI,项目名称:basekernel,代码行数:28,代码来源:graphics.c

示例6: pcw16_vh_decode_mode2

/* 160, 4 bits per pixel */
static void pcw16_vh_decode_mode2(mame_bitmap *bitmap, int x, int y, unsigned char byte)
{
	int px;
	int b;
	int local_byte;
	int cols[2];

	cols[0] = Machine->pens[pcw16_colour_palette[0]];
	cols[1] = Machine->pens[pcw16_colour_palette[1]];
	local_byte = byte;

	px = x;
	for (b=0; b<2; b++)
	{
		int col;

		col = cols[((local_byte>>4)&0x0f)];

		plot_pixel(bitmap, px, y, col);
		px++;
		plot_pixel(bitmap, px, y, col);
		px++;
		plot_pixel(bitmap, px, y, col);
		px++;
		plot_pixel(bitmap, px, y, col);
		px++;

		local_byte = local_byte<<4;
	}
}
开发者ID:Synapseware,项目名称:coco,代码行数:31,代码来源:pcw16.c

示例7: draw_grid

static void draw_grid(mame_bitmap *bitmap)
{
	const UINT8 *table = memory_region(REGION_GFX3);
	int x,y,counter;

	counter = flip_screen ? 0x000 : 0x400;

	x = Machine->screen[0].visarea.min_x;
	y = Machine->screen[0].visarea.min_y;
	while (y <= Machine->screen[0].visarea.max_y)
	{
		x = 4 * (table[counter] & 0x7f);
		if (x >= Machine->screen[0].visarea.min_x &&
				x <= Machine->screen[0].visarea.max_x)
		{
			if (table[counter] & 0x80)	/* star */
			{
				if (rand() & 1)	/* noise coming from sound board */
					plot_pixel(bitmap,x,y,Machine->pens[256]);
			}
			else if (grid_on)			/* radar */
				plot_pixel(bitmap,x,y,Machine->pens[257]);
		}

		counter++;

		if (x >= 4 * (table[counter] & 0x7f))
			y++;
	}
}
开发者ID:broftkd,项目名称:mess-cvs,代码行数:30,代码来源:dkong.c

示例8: z88_vh_render_6x8

static void z88_vh_render_6x8(mame_bitmap *bitmap, int x, int y, int pen0, int pen1, unsigned char *pData)
{
	int h,b;

	for (h=0; h<8; h++)
	{
		UINT8 data;

		data = pData[h];
		data = data<<2;

		for (b=0; b<6; b++)
		{
			int pen;
			if (data & 0x080)
			{
			  pen = pen1;
			}
			else
			{
			  pen = pen0;
			}

			plot_pixel(bitmap, x+1+b, y+h, pen);
			data = data<<1;
		}

		plot_pixel(bitmap,x,y+h, pen0);
		plot_pixel(bitmap,x+7,y+h, pen0);
	}
}
开发者ID:BirchJD,项目名称:xmame-0.103-RPi,代码行数:31,代码来源:z88.c

示例9: update_smoothing

static void update_smoothing(int bgtilerow, int first, int last)
{
	UINT8 *prom = memory_region(REGION_PROMS) + smooth_table * 0x100;
	UINT8 bgscan[2][256];
	UINT8 *bgcurr = bgscan[0], *bglast = bgscan[1];
	int xstart, xstop, x, y;

	/*
        smoothing notes:
            * even scanlines blend the previous (Y-1) and current (Y) line
            * odd scanlines are just taken from the current line (Y)
            * therefore, if we modify source scanlines 8-15, we must update dest scanlines 16-32

            * even pixels are just taken from the current pixel (X)
            * odd pixels blend the current (X) and next (X+1) pixels
            * therefore, if we modify source pixels 8-15, we must update dest pixels 15-31
    */

	/* compute x start/stop in destination coordinates */
	xstart = first * 16 - 1;
	xstop = last * 16 + 15;

	/* extract the previous bg scanline */
	extract_scanline8(bgbitmap, 0, ((bgtilerow * 16 - 1) & 0x1ff) / 2, 256, bgcurr);

	/* loop over height */
	for (y = 0; y <= 16; y++)
	{
		int curry = (bgtilerow * 16 + y) & 0x1ff;

		/* swap background buffers */
		UINT8 *bgtemp = bgcurr;
		bgcurr = bglast;
		bglast = bgtemp;

		/* extract current bg scanline */
		extract_scanline8(bgbitmap, 0, curry / 2, 256, bgcurr);

		/* loop over columns */
		for (x = xstart; x <= xstop; x++)
		{
			int tr = bglast[((x + 1) & 0x1ff) / 2];
			int br = bgcurr[((x + 1) & 0x1ff) / 2];

			/* smooth pixels */
			if (x & 1)
			{
				int tl = bglast[(x & 0x1ff) / 2];
				int bl = bgcurr[(x & 0x1ff) / 2];
				int mixt = prom[16 * tl + tr];
				int mixb = prom[16 * bl + br];
				plot_pixel(bgexbitmap, x & 0x1ff, curry, prom[0x400 + 16 * mixt + mixb]);
			}
			else
				plot_pixel(bgexbitmap, x & 0x1ff, curry, prom[0x400 + 16 * tr + br]);
		}
	}
}
开发者ID:CrouchingLlama,项目名称:openlase-mame,代码行数:58,代码来源:jedi.c

示例10: cdp1869_draw_line

static void cdp1869_draw_line(mame_bitmap *bitmap, int x, int y, int data, int pcb)
{
	int i;
	int color = 0;

	int ccb0 = (data & 0x40) >> 6;
	int ccb1 = (data & 0x80) >> 7;

	switch (cdp1869.col)
	{
	case 0:
		color = (ccb0 << 2) + (ccb1 << 1) + pcb;
		break;

	case 1:
		color = (ccb0 << 2) + (pcb << 1) + ccb1;
		break;

	case 2:
	case 3:
		color = (pcb << 2) + (ccb0 << 1) + ccb1;
		break;
	}

	data <<= 2;

	for (i = 0; i < CDP1870_CHAR_WIDTH; i++)
	{
		if (data & 0x80)
		{
			plot_pixel(bitmap, x, y, Machine->pens[color]);

			if (!cdp1869.fresvert)
			{
				plot_pixel(bitmap, x, y + 1, Machine->pens[color]);
			}

			if (!cdp1869.freshorz)
			{
				x++;

				plot_pixel(bitmap, x, y, Machine->pens[color]);

				if (!cdp1869.fresvert)
				{
					plot_pixel(bitmap, x, y + 1, Machine->pens[color]);
				}
			}
		}

		x++;

		data <<= 1;
	}
}
开发者ID:broftkd,项目名称:mess-cvs,代码行数:55,代码来源:cdp1869.c

示例11: refresh_bitmaps

static void refresh_bitmaps(void)
{
    int lx,ly;

    for (ly = 0; ly < 256; ly++)
    {
        for (lx = 0; lx < 256; lx++)
        {
            plot_pixel(tmpbitmap,  (lx-6)&0xff, ly, Machine->pens[16 + tmpvideoram[ly*256+lx]]);
            plot_pixel(tmpbitmap2, (lx-6)&0xff, ly, Machine->pens[16 + tmpvideoram2[ly*256+lx]]);
        }
    }
}
开发者ID:kleopatra999,项目名称:historic-mess,代码行数:13,代码来源:cloak.c

示例12: WRITE_HANDLER

static WRITE_HANDLER( findout_bitmap_w )
{
	int sx,sy;
	int fg,bg,mask,bits;

	fg = drawctrl[0] & 7;
	bg = 2;
	mask = 0xff;//drawctrl[2];
	bits = drawctrl[1];

	sx = 8*(offset % 64);
	sy = offset / 64;

//if (mask != bits)
//	usrintf_showmessage("color %02x bits %02x mask %02x\n",fg,bits,mask);

	if (mask & 0x80) plot_pixel(tmpbitmap,sx+0,sy,(bits & 0x80) ? fg : bg);
	if (mask & 0x40) plot_pixel(tmpbitmap,sx+1,sy,(bits & 0x40) ? fg : bg);
	if (mask & 0x20) plot_pixel(tmpbitmap,sx+2,sy,(bits & 0x20) ? fg : bg);
	if (mask & 0x10) plot_pixel(tmpbitmap,sx+3,sy,(bits & 0x10) ? fg : bg);
	if (mask & 0x08) plot_pixel(tmpbitmap,sx+4,sy,(bits & 0x08) ? fg : bg);
	if (mask & 0x04) plot_pixel(tmpbitmap,sx+5,sy,(bits & 0x04) ? fg : bg);
	if (mask & 0x02) plot_pixel(tmpbitmap,sx+6,sy,(bits & 0x02) ? fg : bg);
	if (mask & 0x01) plot_pixel(tmpbitmap,sx+7,sy,(bits & 0x01) ? fg : bg);
}
开发者ID:Ezio-PS,项目名称:mame2003-libretro,代码行数:25,代码来源:findout.c

示例13: WRITE8_HANDLER

static WRITE8_HANDLER( getrivia_bitmap_w )
{
	int sx,sy;
	int fg,bg,mask,bits;
	static int prevoffset, yadd;

	videoram[offset] = data;

	yadd = (offset==prevoffset) ? (yadd+1):0;
	prevoffset = offset;

	fg = drawctrl[0] & 7;
	bg = 2;
	mask = 0xff;/*drawctrl[2]; */
	bits = drawctrl[1];

	sx = 8 * (offset % 64);
	sy = offset / 64;
	sy = (sy + yadd) & 0xff;


/*if (mask != bits) */
/*  ui_popup("color %02x bits %02x mask %02x\n",fg,bits,mask); */

	if (mask & 0x80) plot_pixel(tmpbitmap,sx+0,sy,(bits & 0x80) ? fg : bg);
	if (mask & 0x40) plot_pixel(tmpbitmap,sx+1,sy,(bits & 0x40) ? fg : bg);
	if (mask & 0x20) plot_pixel(tmpbitmap,sx+2,sy,(bits & 0x20) ? fg : bg);
	if (mask & 0x10) plot_pixel(tmpbitmap,sx+3,sy,(bits & 0x10) ? fg : bg);
	if (mask & 0x08) plot_pixel(tmpbitmap,sx+4,sy,(bits & 0x08) ? fg : bg);
	if (mask & 0x04) plot_pixel(tmpbitmap,sx+5,sy,(bits & 0x04) ? fg : bg);
	if (mask & 0x02) plot_pixel(tmpbitmap,sx+6,sy,(bits & 0x02) ? fg : bg);
	if (mask & 0x01) plot_pixel(tmpbitmap,sx+7,sy,(bits & 0x01) ? fg : bg);
}
开发者ID:CrouchingLlama,项目名称:openlase-mame,代码行数:33,代码来源:getrivia.c

示例14: oric_vh_render_6pixels

/* used in hires and text mode */
static void oric_vh_render_6pixels(mame_bitmap *bitmap,int x,int y, int fg, int bg,int data, int invert_flag)
{
	int i;
	int pens[2];
	int px;
	
	/* invert? */
	if (invert_flag)
	{
		fg ^=0x07;
		bg ^=0x07;
	}

	pens[1] = Machine->pens[fg];
	pens[0] = Machine->pens[bg];
	
	px = x;
	for (i=0; i<6; i++)
	{
		int col;

		col = pens[(data>>5) & 0x01];
		plot_pixel(bitmap,px, y, col);
		px++;
		data = data<<1;
	}
}
开发者ID:broftkd,项目名称:historic-mess,代码行数:28,代码来源:oric.c

示例15: draw_headlights

static void draw_headlights( struct mame_bitmap *bitmap, const struct rectangle *cliprect, int bFog )
{
	int sx, sy, color;
	int x0 = 256-grchamp_player_xpos-64;
	int y0 = 240-grchamp_player_ypos-64;
	const UINT8 *source = memory_region( REGION_GFX4 );
	int x,y,bit;
	if( !bFog ) source += 0x400;
	for( y=0; y<128; y++ )
	{
		for( x=0; x<64; x+=8 )
		{
			int data = *source++;
			if( data )
			{
				for( bit=0; bit<8; bit++ )
				{
					if( data&0x80 ){
						sx = x0+x+bit;
						sy = y0+y;
						if( sx>=cliprect->min_x && sy>=cliprect->min_y && 
							sx<=cliprect->max_x && sy<=cliprect->max_y )
						{
							color = read_pixel( headlight_bitmap, x+bit, y );
							plot_pixel( bitmap, sx,sy, color );
						}
					}
					data <<= 1;
				}
			}
		}
	}
}
开发者ID:Ezio-PS,项目名称:mame2003-libretro,代码行数:33,代码来源:grchamp_vidhrdw.c


注:本文中的plot_pixel函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。