1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        stb-imageC 開發(fā)的圖像讀取解析庫

        聯合創(chuàng)作 · 2023-09-29 16:20

        C 語言開發(fā)的一個簡單易用的圖像讀取解析庫,也是 Duilib 上用到的圖像解析庫。

        使用示例代碼如下:

        #include <stdio.h>
        
        #define STB_IMAGE_WRITE_IMPLEMENTATION
        #include "stb_image_write.h"
        
        #define STB_IMAGE_IMPLEMENTATION
        #include "stb_image.h"
        
        int main(int argc, char** argv)
        {
            int w, h, n;
        
            //rgba
            //load image
            unsigned char *data = stbi_load("rgba.png", &w, &h, &n, 0);
        
            printf("%d, %d, %d\n", w, h, n);
        
            //change pixel
        
            //rgba,write 10 red pixel at line 11
            for (int dx = 0; dx < 10; ++dx)
            {
                data[n * w * 10 + dx * n + 0] = 255;
                data[n * w * 10 + dx * n + 1] = 0;
                data[n * w * 10 + dx * n + 2] = 0;
                data[n * w * 10 + dx * n + 3] = 255;
            }
            
        
            //write image
            stbi_write_png("write.png", w, h, n, data, w * 4);
        
            stbi_image_free(data);
        
        
            return 0;
        }

        開源協(xié)議是 public domain 和 MIT。

        瀏覽 37
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            欧美日韩一道本 | 小泽玛利亚大战黑人 | 久久人人爽人人爽人人片aV东京热 | 国产胖女人操逼樱桃视频 | 91农村站街老熟女露脸 | 国产精品国产三级国产普通话三级 | 男人桶女人桶爽 | 色色免费视频 | 国产探花系列在线观看 | 午夜二区 |