简体   繁体   English

在C中显示.pgm图像文件中的像素颜色

[英]Display pixel color from .pgm image file in C

I am writing a program where in I need to display image in .pgm format to TFT screen. 我正在编写一个程序,需要在其中将.pgm格式的图像显示到TFT屏幕。 I am using C language. 我正在使用C语言。 I am able to read the file and when I tried to display image content on screen, I can see only characters coming and not the pixel color. 我能够读取文件,并且当我尝试在屏幕上显示图像内容时,我只能看到字符而不是像素颜色。 I am using P5 magic number in .pgm file. 我在.pgm文件中使用P5幻数。 My question is simple how this character (in .pgm file) can be displayed as a pixel color? 我的问题很简单,如何将此字符(在.pgm文件中)显示为像素颜色? Should I have to use any library functions for this? 我是否应该为此使用任何库函数?

是的,您需要一个可与ANSI C一起使用的图形库,例如SDLAllegro

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM