开发者

Making Gradient Images Quickly with C++

开发者 https://www.devze.com 2023-04-02 10:27 出处:网络
I\'m currently working with Python to create images of gradients. However, for my uses开发者_JAVA百科 I\'m afraid that Python may just be too slow. I know that Python can be extended with C++ with rel

I'm currently working with Python to create images of gradients. However, for my uses开发者_JAVA百科 I'm afraid that Python may just be too slow. I know that Python can be extended with C++ with relative ease.

So what are some quick ways to produce images of gradients in C++?


Writing a bitmap manually is quite easy. For a Windows Bitmap you need a 54 byte header and then an array of colour values. (.bmp file specs)

So, create a file, write the header, supply the pixel array. For a gradient generating the colour values should be fairly simple.

.pgm/.ppm files are even easier as they have much simpler headers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号