您当前的位置: 首页 > 

柳鲲鹏

暂无认证

  • 0浏览

    0关注

    4642博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

RGB数据剪切后保存为JPG格式文件的代码(使用jpeglib)

柳鲲鹏 发布时间:2018-09-06 14:42:27 ,浏览量:0

  从一个大的RGBA数据中,剪切部分为RGB格式:

#include 
#include 
#include 

#include "gh_rgba2jpg.h"

#include 

int clipRgbaToJpgFile(const char *pFileName, const char* pRgbaData, const int nWidth, const int nHeight, const int nClipLeft, const int nClipTop, const int nClipWidth, const int nClipHeight)
{
    char* pClipSource     = NULL;
    char* pClipData       = NULL;
    int pixcelBytes       = nClipWidth*nClipHeight*3;
    int i = 0;
    int j = 0;

    pClipSource = malloc(pixcelBytes);
    if (!pClipSource)
    {
        return -1;
    }

    //移动到制定位置
    pRgbaData += nClipTop * nWidth * 4;
    pRgbaData += nClipLeft * 4;

    pClipData = pClipSource;
    for (i=0; i            
关注
打赏
1665724893
查看更多评论
0.0503s