简体   繁体   English

ansi C是否支持Windows图形?

[英]Does ansi C support Windows graphics?

I want to make a Windows application in ansi C but I am having trouble with the graphic usage. 我想在ansi C中制作Windows应用程序,但是在图形使用方面遇到麻烦。 Is ansi C able to handle the graphics of Windows without using any extra libraries? ansi C是否可以在不使用任何其他库的情况下处理Windows的图形? Guide line required. 需要指导线。

ANSI (or more modernly ISO) C is the language standard . ANSI(或更现代的ISO)C是语言标准 It doesn't deal with graphics, at all . 它不处理图形, 在所有

However, you sure can write graphical applications with C (the language). 但是,您肯定可以使用C(语言)编写图形应用程序。 On Windows you have the Win32 API, and there are also cross-platform libraries like GTK, which you can use to create graphical applications on Windows (as well as on other OSes). 在Windows上,您具有Win32 API,并且还有跨平台库,例如GTK,可用于在Windows(以及其他OS)上创建图形应用程序。

The original Windows API was written to be accessed via C, that was the main language for developing Windows apps back in the day. 最初的Windows API被编写为可通过C进行访问,这是当时开发Windows应用程序的主要语言。 I can't immediately see why you couldn't use ANSI C to write graphical Windows programs. 我无法立即明白为什么您不能使用ANSI C编写图形Windows程序。

I was worried about GDI+ (I've never used it from C), so looked it up . 我担心GDI +(我从没从C使用过它),所以抬头看了一下 It says it's a class-based API "...for C/C++ programmers." 它说它是“ ...面向C / C ++程序员的”基于类的API。 Taken literally, that would mean you can use C to access it (otherwise it's for C++ programmers, but not C programmers), but you'd want to look closely to be sure they're not just being loose with their language there. 从字面上看,这意味着您可以使用C来访问它(否则,它适用于C ++程序员,但不适用于C程序员),但是您需要仔细检查以确保它们不只是在那里放任自流。

To clarify the two answers above mine. 为了澄清以上两个问题。 One could in principle find a strictly ANSI C graphics library for Windows. 原则上可以为Windows找到严格的ANSI C图形 But if the goal is to have graphics portability cross-platform, that would require the library to be available on the platforms which are under consideration. 但是,如果目标是使图形可移植性跨平台,那将要求该库在正在考虑的平台上可用。 If, on the the other hand, the goal is to do something with the ANSI standard library graphicswise, nothing like that exists as it is way too unportable (and would have likely been even more so when the first ANSI standard was published). 另一方面,如果目标是以图形方式对ANSI 标准库进行操作,则不存在类似的东西,因为它太不可移植了(在第一个ANSI标准发布时可能会更是如此)。

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

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