使用临近插值算法,轻量,算法没有优化,有兴趣可以参考,这里只为整理记录。
//
void map_zoom(loadmap_t *dst_map ,loadmap_t *src_map)
{
//获取原始图像及即将缩放图像的大小
  int dst_width = dst_map->frame.w;
  int dst_height = dst_map->frame.h;
  int src_width = src_map->frame.w;
  int src_height = src_map->frame.h;
  dst_map->ori_img_buf = NULL;
//创建要缩放的图像缓存区
  xfree(dst_map->ori_img_buf);
  dst_map->ori_img_buf = (unsigned char * )xmalloc(dst_width * dst_height, "zoom map");
  unsigned char *dst = dst_map->ori_img_buf;
  unsigned char *src = src_map ->ori_img_buf;
  
  if (  (0 == dst_width)||(0 == dst_height)
      ||(0 == src_width)||(0 == src_height)) return;
  for (long x=0;x
					 
 huangea的博客
huangea的博客


 
			
受益匪浅