您当前的位置: 首页 >  矩阵

柳鲲鹏

暂无认证

  • 0浏览

    0关注

    4642博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

全网首发:把一个bit数组矩阵旋转-90度

柳鲲鹏 发布时间:2020-12-08 09:01:39 ,浏览量:0

接上文。

https://quantum6.blog.csdn.net/article/details/110849585

将数组旋转-90度:

static char* rotate_270(char* pBuffer, int w, int h, int pitch)
{
    int i=0;
    char* pRotated;

    int size;
    int offset=0;

    if (w < h)
    {
        w = h;
    }
    else if (w > h)
    {
        w = h;
    }

    size = h * pitch;
    pRotated = (char*)malloc(size);
    memset(pRotated, 0, size);

    i = 0;
    for (int x = w-1; x >= 0; x--)
    {
        int offset = 0;
        for (int y = 0; y < h; y++)
        {
            int srcPos      = (offset + x);
            int srcPosByte  = srcPos / 8;
            int srcPosBit   = srcPos % 8;
            int srcBitValue = (pBuffer[srcPosByte] & (0x01             
关注
打赏
1665724893
查看更多评论
0.0477s