blit_x2_8.c

来自「十七种模拟器源代码 非常有用的作课程设计不可缺少的」· C语言 代码 · 共 44 行

C
44
字号
/******************************************************************************//*                                                                            *//*                         RAINE DOUBLE SIZE BLITTING                         *//*                                                                            *//******************************************************************************/#include "raine.h"void raine_blit_x2_y1(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h){	int x, y;	int new_x;	int total_x = (w<<1);	for( y = 0; y < h ; y++ )	{		for( x = 0, new_x = 0; x < total_x; x++, new_x+=2 )		{			dest->line[ y + d_y ][ new_x + d_x ] = src->line[ y + s_y ][ x + s_x ];			dest->line[ y + d_y ][ new_x + d_x+1 ] = src->line[ y + s_y ][ x + s_x ];		}	}}void raine_blit_x2_y2(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h){	int x, y;	int new_x;	int total_x = (w<<1);	for( y = 0; y < h ; y++ )	{		for( x = 0, new_x = 0; x < total_x; x++, new_x+=2 )		{			dest->line[ y + d_y ][ new_x + d_x ] = src->line[ y + s_y ][ x + s_x ];			dest->line[ y + d_y+1 ][ new_x + d_x ] = src->line[ y + s_y ][ x + s_x ];			dest->line[ y + d_y ][ new_x + d_x+1 ] = src->line[ y + s_y ][ x + s_x ];			dest->line[ y + d_y+1 ][ new_x + d_x+1 ] = src->line[ y + s_y ][ x + s_x ];		}	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?