[C Language] advanced | graphics library, advanced graphics

Source: Internet
Author: User

[C Language] advanced | graphics library, advanced graphics

----------------------------------------------------------------------

// Main. c // Created by weichen on 15/7/7. // Copyright (c) 2015 weichen. all rights reserved. # include <stdio. h> int main (int argc, const char * argv []) {/* Windows API: It appears from the first 32-bit Windows, which is called Win32API. it is a pure C function library, just like the C standard library, so that you can write Windows applications in the past many Windows programs are made in this way main (): main () the entry function to become a C language has nothing to do with the C language itself. Your code is called by a short program called to start the code, it requires an operating system named main to load your executable program into the memory, start running, and then call your main function WinMain (): As main () is th E entry function of an ordinary C program, WinMain () is the one Win32API program. windows applications have a different "startup" code that needs a function "WinMain ()". # include <windows. h> int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) // parameter {MessageBox (NULL, "Goodbye, cruel world! "," Note ", MB_ OK); return 0;} // create the ACLlib Program # include" acllib. h "# include <stdio. h> int Setup () {initConsole (); printf ("input width:"); int width; scanf ("% d", & width); initWindow ("test ", 100,100, width, width); beginPaint (); line (20, 20, width-20, width-20); putPixel (100,150, RGB (255,255, 0 )); endPaint (); return 0; // The Basic drawing function creates the drawing window void initWindow (const char title [], int left, int top, int width, int Height); in windows/unix, coordinates are defined by Pixel numbers. For the window you created, the upper left corner is (0, 0), the X axis is increased from left to right, and the Y axis is increased from top to bottom. If you need to use scanf and printf, you need to first initConsole (); then you can use scanf and printf in that window to start/end the drawing void beginPaint (); void endPaint (); call any plotting function. void putPixel (int x, int y, ACL_Color color); ACL_Color getPixel (int x, int y ); color RGB (r, g, B); RED-> RGB (255, 0, 0); BLACK, RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, WHITE Line void moveTo (int x, int y); void moveRel (int dx, int dy ); Void line (int x0, int y0, int x1, int y1); void lineTo (int x, int y); void lineRel (int dx, int dy ); void arc (int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nXStartArc, int nYStartArc, int nXEndArc, int nYEndArc); brush void setPenColor (ACL_Color color ); void setPenWidth (int width); void setPenStyle (ACL_Pen_Style style); PEN_STYLE_SOLID, PEN_STYLE_DASH, // ---- PEN_STYLE_DOT ,//.... PEN_STYLE_DASHDOT ,//_. _. _. PEN_STYLE_DASHDOTDOT ,//_.. _.. _.. PEN_STYLE_NULL, surface void chrod (); void ellipse (); void pie (); void rectangle (); void roundrect (); brush is responsible for wire and surface edges, void setBrushColor (ACL_Color color); void setBrushStyle (ACL_Brush_Style); BRUSH_STYLE_SOLID =-1, strong, // ---- BRUSH_STYLE_VERTICAL, // | required, // \\\\ BRUSH_STYLE_BDIAGO NAL, ///// BRUSH_STYLE_CROSS, // ++ BRUSH_STYLE_DIAGCROSS, // xxxx text void setTextColor (ACL_Color color); void setTextBkColor (ACL_Color color ); void setTextSize (int size); void setTextFont (char * pFontName); void paintText (int x, int y, const char * pStr); */printf ("Hello, World! \ N "); return 0 ;}

ACLLib is open-source on github at: https://github.com/wengkai/ACLLib

ACLLib can be used by multiple ides in Windows, including but not limited to DevC ++, MS Visual Studio, and CodeBlocks. It can also be directly compiled by the MinGW compiler in Makefile mode.

 

Link: http://www.cnblogs.com/farwish/p/4628568.html

@ Blackeye poet <www.farwish.com>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.