⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmiiconresource.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
};

FfsIcon ffs_picture[10];

/************************************************************************/
/* function part                                                        */
/************************************************************************/
/*******************************************************************************

 $Function:    	Draw_Picture

 $Description:	Draw picture through picture id
 
 $Returns:		

 $Arguments:	
 
*******************************************************************************/
extern void Draw_Picture( unsigned short    in_X,
						  unsigned short    in_Y,
						  unsigned short    in_Index,
						  unsigned short    in_IconId,
						  unsigned short    in_Rop,
						  unsigned int      in_Attr)
{
	MMI_TRACE_EVENT(("sunsj-----------Draw_Picture()"));
	
	if( in_X > SCREEN_SIZE_X || in_Y > SCREEN_SIZE_Y )
	{
		MMI_TRACE_EVENT(("!!!Wrong location"));
	}

	if( in_IconId > 0 && in_IconId < ICON_MAX_NUMBER )
	{
		Draw_Icon(in_X, in_Y, in_Index, in_IconId, in_Rop, in_Attr);
	}
	else if ( in_IconId == ICON_FFS_PICTURE )
	{
		Draw_FFS_Icon(in_X, in_Y, in_Index, in_IconId, in_Rop, in_Attr);
	}
	else if ( in_IconId == ICON_BUFFER_PICTURE )
	{
		Draw_Buffer_Icon(in_X, in_Y, in_Index, in_IconId, in_Rop, in_Attr);
	}
	else
	{
		MMI_TRACE_EVENT(("None picture"));
	}
}

/*******************************************************************************

 $Function:    	Draw_Icon

 $Description:	Draw the icon in code
 
 $Returns:		

 $Arguments:	
 
*******************************************************************************/
extern int Draw_Icon( unsigned short    in_X,
                      unsigned short    in_Y,
                      unsigned short    in_Index,
                      unsigned short    in_IconId,
                      unsigned short    in_Rop,
					  unsigned int      in_Attr)
{
	char *icons = NULL;
	char *iconsmask = NULL;
	unsigned short px = 0;
	unsigned short py = 0;
	unsigned short sx = 0;
	unsigned short sy = 0;

	MMI_TRACE_EVENT(("sunsj-----------Draw_Icon()"));

	/* Check iconid if it is large than the totle number of icon then return */
	if( in_IconId > ICON_MAX_NUMBER || icontable[in_IconId].icon == NULL )
	{
		if( in_IconId > ICON_MAX_NUMBER )
		{
			MMI_TRACE_EVENT(("error iconid"));
		}
		else if( icontable[in_IconId].icon == NULL )
		{
			MMI_TRACE_EVENT(("error icon"));
		}
		return 0;
	}

	if( icontable[in_IconId].iconNum != 1 )
	{
		if( in_Index >= icontable[in_IconId].iconNum )
		{
			MMI_TRACE_EVENT(("icon index is large than icon number"));
			return 0;
		}
	}
	else
	{
		if( in_Index >= icontable[in_IconId].icon->nIcons )
		{
			MMI_TRACE_EVENT(("icon index is large than icon buffer"));
			return 0;
		}
	}
	/************************************************************************/
	/* 如果ICON ID是一组图片,则可以根据in_Index来决定画其中的某一幅        */
	/************************************************************************/
	if( in_Index != 0 )
	{
		/************************************************************************/
		/* 判断图片数组的个数,如果个数不是1,那么in_Index就是指向数组          */
		/************************************************************************/
		if(icontable[in_IconId].iconNum != 1 )
		{
			icons = icontable[in_IconId].icon[in_Index].icons;
			
			/************************************************************************/
			/* 判断是否控制显示位置,如果需要从in_X和in_Y中得到图片位置,不然从图片
			   属性中得到位置                                                       */
			/************************************************************************/
			if( in_Attr & ICON_LOCATION )
			{
				px = in_X;
				py = in_Y;
			}
			else
			{
				px = icontable[in_IconId].icon[in_Index].area.px;
				py = icontable[in_IconId].icon[in_Index].area.py;
			}

			/************************************************************************/
			/* 得到图片大小的属性                                                   */
			/************************************************************************/
			sx = icontable[in_IconId].icon[in_Index].area.sx;
			sy = icontable[in_IconId].icon[in_Index].area.sy;
		}
		/************************************************************************/
		/* 判断图片数组的个数,如果个数是1,那么in_Index就是指向图片中的某一个部
		   分并且得到图片的数据                                                 */
		/************************************************************************/
		else
		{
			/************************************************************************/
			/* 判断in_Index是否大于图片中的个数,如果大于了总的个数,则对输入的值取余
			   并且求取图片的数据                                                   */
			/************************************************************************/
			if( in_Index > icontable[in_IconId].icon->nIcons )
			{
				in_Index = in_Index%icontable[in_IconId].icon->nIcons;
			}

			icons = icontable[in_IconId].icon->icons + in_Index *
				icontable[in_IconId].icon->area.sx *
				icontable[in_IconId].icon->area.sy * 2;

			/************************************************************************/
			/* 判断是否控制显示位置,如果需要从in_X和in_Y中得到图片位置,不然从图片
			   属性中得到位置                                                       */
			/************************************************************************/
			if( in_Attr & ICON_LOCATION )
			{
				px = in_X;
				py = in_Y;
			}
			else
			{
				px = icontable[in_IconId].icon->area.px;
				py = icontable[in_IconId].icon->area.py;
			}

			/************************************************************************/
			/* 得到图片大小的属性                                                   */
			/************************************************************************/
			sx = icontable[in_IconId].icon->area.sx;
			sy = icontable[in_IconId].icon->area.sy;
		}
	}
	else
	{
		icons = icontable[in_IconId].icon->icons;

		/************************************************************************/
		/* 判断是否控制显示位置,如果需要从in_X和in_Y中得到图片位置,不然从图片
		   属性中得到位置                                                       */
		/************************************************************************/
		if( in_Attr & ICON_LOCATION )
		{
			px = in_X;
			py = in_Y;
		}
		else
		{
			px = icontable[in_IconId].icon->area.px;
			py = icontable[in_IconId].icon->area.py;
		}

		/************************************************************************/
		/* 得到图片大小的属性                                                   */
		/************************************************************************/
		sx = icontable[in_IconId].icon->area.sx;
		sy = icontable[in_IconId].icon->area.sy;
	}

	/************************************************************************/
	/* 判断图片是否需要透色,如果需要透色从当前ICON ID的后一个ICON ID得到透色
	   图片的数据                                                           */
	/************************************************************************/
	if( in_Attr & ICON_MASK )
	{
		if( in_Index != 0 )
		{
			/************************************************************************/
			/* 判断mask iconid数组中图片的数量                                      */
			/************************************************************************/
			if( icontable[in_IconId+1].iconNum == 1 )
			{
				/************************************************************************/
				/* 判断mask iconid的图片数量是否在正确的范围内,如果正确则得到mask icon
				   的数据                                                               */
				/************************************************************************/
				if( icontable[in_IconId+1].icon->nIcons > 1 )
				{
					if( icontable[in_IconId+1].icon->nIcons <= icontable[in_IconId].icon->nIcons)
					{
						iconsmask = icontable[in_IconId+1].icon->icons + in_Index *
							icontable[in_IconId].icon->area.sx *
							icontable[in_IconId].icon->area.sy * 2;
					}
				}
				else
				{
					if( icontable[in_IconId+1].icon->icons != NULL )
					{
						iconsmask = icontable[in_IconId+1].icon->icons;
					}
				}
			}
			else
			{
				if( icontable[in_IconId+1].icon[in_Index].icons != NULL)
				{
					iconsmask = icontable[in_IconId+1].icon[in_Index].icons;
				}
			}	
		}
		else
		{
			if( icontable[in_IconId+1].icon->icons != NULL )
			{
				iconsmask = icontable[in_IconId+1].icon->icons;
			}
		}
	}

	/************************************************************************/
	/* 判断透色图的数据是否和图片数据存放在一起,并取出赋予iconmask         */
	/************************************************************************/
	if( in_Attr & ICON_MASK_OWN )
	{
		if( in_Index != 0 )
		{
			iconsmask = icontable[in_IconId].icon[in_Index].icons + 
				icontable[in_IconId].icon->area.sx *
				icontable[in_IconId].icon->area.sy * 2;
		}
		else
		{
			iconsmask = icontable[in_IconId].icon->icons + 
				icontable[in_IconId].icon->area.sx *
				icontable[in_IconId].icon->area.sy * 2;
		}
	}

	/************************************************************************/
	/* 根据是否需要透色选择画图片的方式                                     */
	/************************************************************************/
	if( (in_Attr & ICON_MASK || in_Attr & ICON_MASK_OWN) && iconsmask != NULL )
	{
		pdspl_BitBlt(px, py, sx, sy, 0, icons , DSPL_BMPXOR);
		pdspl_BitBlt(px, py, sx, sy, 0, iconsmask , DSPL_BMPAND);
		pdspl_BitBlt(px, py, sx, sy, 0, icons , DSPL_BMPXOR);
	}
	else
	{
		pdspl_BitBlt(px, py, sx, sy, 0, icons , in_Rop);
	}

	return 1;
}

/*******************************************************************************

 $Function:    	Draw_Idleanimation

 $Description:	Draw dynamic wallpaper through animation id
 
 $Returns:		

 $Arguments:	
 
*******************************************************************************/
extern int Draw_Idleanimation( unsigned short    in_IconId,
                               unsigned short    anim_frame)
{
	U8 uNewIndex = anim_frame + 1;
	MfwIcnAttr * icnBkg = 0;
	MfwIcnAttr * icnCurrent = 0;
	
	U8 uloop= 0 ;
	U8 uI;

	/* Check iconid if it is large than the totle number of icon then return */
	if(in_IconId > ICON_MAX_NUMBER)
	{
		MMI_TRACE_EVENT(("error dynamic idle iconid"));
		return 0;
	}
	
	if((icnBkg = (MfwIcnAttr *)icontable[in_IconId].icon) == 0)
	{
		return 0xff;
	}
	
	//draw bkg
	drawIconByIcnAttr(icnBkg,NULL);
	
	icnCurrent = (MfwIcnAttr *)icontable[in_IconId].icon + 1;
	
	while(icnCurrent->nIcons && anim_frame)
	{
		if(icnCurrent->icons == 0)
		{
			icnCurrent +=  icnCurrent->nIcons + 1;
			anim_frame -- ;
			if(anim_frame == 0)
				break;
		}
		else
			return 0xff;
	}
	
	
	if(anim_frame || icnCurrent->nIcons == 0)
	{
		return 0xff;
	}
	
	//draw anim
	uloop = icnCurrent->nIcons;
	for(uI = 0; uI < uloop ;uI++)
	{
		drawIconByIcnAttr(++icnCurrent,NULL);
	}
	
	if( (icnCurrent+1)->nIcons == 0)
		uNewIndex = 0;
	return uNewIndex;
}

MfwIcnAttr * GetIconAttr(unsigned short in_IconId, unsigned short in_Index)
{
	return (MfwIcnAttr * )&icontable[in_IconId].icon[in_Index];
}

int GetIconAttrNumber(unsigned short in_IconId)
{
	return icontable[in_IconId].iconNum;
}

extern int Draw_FFS_Icon( unsigned short    in_X,
					      unsigned short    in_Y,
					      unsigned short    in_Index,
					      unsigned short    in_IconId,
					      unsigned short    in_Rop,
					      unsigned int      in_Attr)
{
	return 1;
}

extern int Draw_Buffer_Icon( unsigned short    in_X,
						     unsigned short    in_Y,
						     unsigned short    in_Index,
						     unsigned short    in_IconId,
						     unsigned short    in_Rop,
						     unsigned int      in_Attr)
{
	return 1;
}

void ffs_picture_initialize()
{
	int i=0;
	MMI_TRACE_EVENT(("ffs_picture_initialize()"));

	memset(ffs_picture, 0x00, sizeof(ffs_picture));
	/************************************************************************/
	/* 初始化ffs上的图片列表                                                */
	/************************************************************************/
}

⌨️ 快捷键说明

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