亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? graphics.c

?? c語言開發方面的經典問題,包括源代碼.c語言開發所要注意的問題,以及在嵌入式等各方面的應用
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* * File: graphics.c * Version: 3.0 * Last modified on Wed Sep 21 23:53:53 1994 by eroberts * ----------------------------------------------------- * This file implements the graphics.h and extgraph.h interfaces * for the Borland/Windows platform. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <math.h>#include <conio.h>#include <windows.h>#include <time.h>#include "genlib.h"#include "gcalloc.h"#include "strlib.h"#include "extgraph.h"/* * Parameters * ---------- * DesiredWidth    -- Desired width of the graphics window * DesiredHeight   -- Desired height of the graphics window * DefaultSize     -- Default point size * MaxTitle        -- Maximum window title length * MaxFontName     -- Maximum font name length * MaxFonts        -- Maximum number of fonts * LeftMargin      -- Margin from left of screen to both windows * RightMargin     -- Minimum margin to right of windows * TopMargin       -- Margin from top of screen to graphics window * BottomMargin    -- Minimum margin from bottom of screen to console window * WindowSep       -- Separation between graphics and console windows * ConsoleHeight   -- Height of the console window (pixels) * MinConsoleScale -- Smallest acceptable scale factor for the console * PStartSize      -- Starting size for polygon (must be greater than 1) * MaxColors       -- Maximum number of color names allowed * MinColors       -- Minimum number of colors the device must support * GWClassName     -- Class name of the graphics window * DefaultFont     -- Font that serves as the "Default" font */#define DesiredWidth       7.0#define DesiredHeight      4.0#define DefaultSize       12#define MaxTitle          75#define MaxFontName       50#define MaxFonts         100#define LeftMargin        10#define RightMargin       25#define TopMargin          2#define BottomMargin      30#define WindowSep          5#define ConsoleHeight    110#define MinConsoleScale    0.8#define PStartSize        50#define MaxColors        256#define MinColors         16#define GWClassName "Graphics Window"#define DefaultFont "System"/* * Other constants * --------------- * LargeInt  -- Integer too large for a coordinate value * Epsilon   -- Small arithmetic offset to reduce aliasing/banding * Pi        -- Mathematical constant pi * AnyButton -- Union of all mouse buttons */#define LargeInt 16000#define Epsilon  0.00000000001#define Pi       3.1415926535#define AnyButton (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON)/* * Type: graphicsStateT * -------------------- * This structure holds the variables that make up the graphics state. */typedef struct graphicsStateT {    double cx, cy;    string font;    int size;    int style;    bool erase;    int color;    struct graphicsStateT *link;} *graphicsStateT;/* * Type: fontEntryT * ---------------- * This structure holds the data for a font. */typedef struct {    string name;    int size, style;    int points, ascent, descent, height;    HFONT font;} fontEntryT;/* * Type: regionStateT * ------------------ * The region assembly process has the character of a finite state * machine with the following four states: * *   NoRegion       Region has not yet been started *   RegionStarting Region is started but no line segments yet *   RegionActive   First line segment appears *   PenHasMoved    Pen has moved during definition * * The current state determines whether other operations are legal * at that point. */typedef enum {    NoRegion, RegionStarting, RegionActive, PenHasMoved} regionStateT;/* * Type: colorEntryT * ----------------- * This type is used for the entries in the color table. */typedef struct {    string name;    double red, green, blue;} colorEntryT;/* * Static table: fillList * ---------------------- * This table contains the bitmap patterns for the various density * values.  Adding more patterns to this list increases the * precision with which the client can control fill patterns. * Note that this bitmap is inverted from that used on most * systems, with 0 indicating foreground and 1 indicating background. */static short fillList[][8] = {    { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },    { 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD },    { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA },    { 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 },    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },};#define NFills (sizeof fillList / sizeof fillList[0])/* * Global variables * ---------------- * initialized    -- TRUE if initialization has been done * pauseOnExit    -- TRUE if library should pause when exiting * consoleWindow  -- Window handle for console window * graphicsWindow -- Window handoe for graphics window * gdc            -- Graphics DC (screen) * osdc           -- Offscreen DC (memory backup) * osbits         -- Offscreen bitmap * drawPen        -- Pen used for drawing * erasePen       -- Pen used for erasing * nullPen        -- Pen used for filling * drawColor      -- Color used for drawing * eraseColor     -- Color used for erasing * windowTitle    -- Current window title (initialized statically) * xResolution    -- Horizontal resolution of screen (dots per inch) * yResolution    -- Vertical resolution of screen (dots per inch) * windowWidth    -- Width of graphics window (inches) * windowHeight   -- Height of graphics window (inches) * pixelWidth     -- Width of graphics window (pixels) * pixelHeight    -- Height of graphics window (pixels) * fontTable      -- Table of stored fonts * nFonts         -- Number of fonts in fontTable * currentFont    -- Index of current font in fontTable * regionState    -- Current state of the region * regionDensity  -- Fill density to apply to region * polygonPoints  -- Array of points used in current region * nPolygonPoints -- Number of active points * polygonSize    -- Number of allocated points * polygonBounds  -- Bounding box of polygon * colorTable     -- Table of defined colors * nColors        -- Number of defined colors * previousColor  -- Last color index set * stateStack     -- Stack of graphicStateT blocks * cx, cy         -- Current coordinates     | These * eraseMode      -- Setting of erase flag   | variables * textFont       -- Current font            | consititute * textStyle      -- Current style           | the current * pointSize      -- Current point size      | graphics * penColor       -- Color of pen            | state */static bool initialized = FALSE;static bool pauseOnExit = TRUE;static HWND consoleWindow, graphicsWindow;static HDC gdc, osdc;static HBITMAP osBits;static HPEN drawPen, erasePen, nullPen;static COLORREF drawColor, eraseColor;static PAINTSTRUCT ps;static string windowTitle = "Graphics Window";static double xResolution, yResolution;static double windowWidth = DesiredWidth;static double windowHeight = DesiredHeight;static int pixelWidth, pixelHeight;static fontEntryT fontTable[MaxFonts];static int nFonts;static int currentFont;static regionStateT regionState;static double regionDensity;static POINT *polygonPoints;static int nPolygonPoints;static int polygonSize;static RECT polygonBounds;static HBITMAP fillBitmaps[NFills];static colorEntryT colorTable[MaxColors];static int nColors;static int previousColor;static graphicsStateT stateStack;static double cx, cy;static bool eraseMode;static string textFont;static int textStyle;static int pointSize;static int penColor;static int mouseX, mouseY;static bool mouseButton = FALSE;/* Private function prototypes */static void InitCheck(void);static void InitGraphicsState(void);static void InitDisplay(void);static void InitDrawingTools(void);static void DisplayExit(void);static HWND FindConsoleWindow(void);static BOOL CALLBACK EnumerateProc(HWND window, LPARAM clientData);static void RegisterWindowClass(void);static LONG FAR PASCAL GraphicsEventProc(HWND w, UINT msg,                                         WPARAM p1, LPARAM p2);static void DoUpdate(void);static void DisplayClear(void);static void PrepareToDraw(void);static void DisplayLine(double x, double y, double dx, double dy);static void DisplayArc(double xc, double yc, double rx, double ry,                       double start, double sweep);static void RenderArc(double x, double y, double rx, double ry,                      double start, double sweep);static void DisplayText(double x, double y, string text);static void DisplayFont(string font, int size, int style);static int FindExistingFont(string name, int size, int style);static void SetLineBB(RECT *rp, double x, double y, double dx, double dy);static void SetArcBB(RECT *rp, double xc, double yc,                     double rx, double ry, double start, double sweep);static void SetTextBB(RECT *rp, double x, double y, string text);static void StartPolygon(void);static void AddSegment(int x0, int y0, int x1, int y1);static void DisplayPolygon(void);static void AddPolygonPoint(int x, int y);static void InitColors(void);static int FindColorName(string name);static bool StringMatch(string s1, string s2);static bool PrefixMatch(string prefix, string str);static int RectWidth(RECT *rp);static int RectHeight(RECT *rp);static void SetRectFromSize(RECT *rp, int x, int y, int width, int height);static double Radians(double degrees);static int Round(double x);static double InchesX(int x);static double InchesY(int y);static int PixelsX(double x);static int PixelsY(double y);static int ScaleX(double x);static int ScaleY(double y);static int Min(int x, int y);static int Max(int x, int y);/* Exported entries *//* Section 1 -- Basic functions from graphics.h */void InitGraphics(void){    if (!initialized) {        initialized = TRUE;        ProtectVariable(stateStack);        ProtectVariable(windowTitle);        ProtectVariable(textFont);        InitColors();        InitDisplay();    }    DisplayClear();    InitGraphicsState();}void MovePen(double x, double y){    InitCheck();    if (regionState == RegionActive) regionState = PenHasMoved;    cx = x;    cy = y;}void DrawLine(double dx, double dy){    InitCheck();    switch (regionState) {      case NoRegion:        DisplayLine(cx, cy, dx, dy);        break;      case RegionStarting: case RegionActive:        DisplayLine(cx, cy, dx, dy);        regionState = RegionActive;        break;      case PenHasMoved:        Error("Region segments must be contiguous");    }    cx += dx;    cy += dy;}void DrawArc(double r, double start, double sweep){    DrawEllipticalArc(r, r, start, sweep);}double GetWindowWidth(void){    InitCheck();    return (windowWidth);}double GetWindowHeight(void){    InitCheck();    return (windowHeight);}double GetCurrentX(void){    InitCheck();    return (cx);}double GetCurrentY(void){    InitCheck();    return (cy);}/* Section 2 -- Elliptical arcs */void DrawEllipticalArc(double rx, double ry,                       double start, double sweep){    double x, y;    InitCheck();    x = cx + rx * cos(Radians(start + 180));    y = cy + ry * sin(Radians(start + 180));    switch (regionState) {      case NoRegion:        DisplayArc(x, y, rx, ry, start, sweep);        break;      case RegionStarting: case RegionActive:        RenderArc(x, y, rx, ry, start, sweep);        regionState = RegionActive;        break;      case PenHasMoved:        Error("Region segments must be contiguous");    }    cx = x + rx * cos(Radians(start + sweep));    cy = y + ry * sin(Radians(start + sweep));}/* Section 3 -- Graphical structures */void StartFilledRegion(double grayScale){    InitCheck();    if (regionState != NoRegion) {        Error("Region is already in progress");    }    if (grayScale < 0 || grayScale > 1) {        Error("Gray scale for regions must be between 0 and 1");    }    regionState = RegionStarting;    regionDensity = grayScale;    StartPolygon();}void EndFilledRegion(void){    InitCheck();    if (regionState == NoRegion) {        Error("EndFilledRegion without StartFilledRegion");    }    DisplayPolygon();    regionState = NoRegion;}/* Section 4 -- String functions */void DrawTextString(string text){    InitCheck();    if (regionState != NoRegion) {        Error("Text strings are illegal inside a region");    }    DisplayText(cx, cy, text);    cx += TextStringWidth(text);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一级在线观看| 亚洲一区视频在线| 亚洲电影在线免费观看| 国产精华液一区二区三区| 欧美午夜精品久久久久久超碰| 26uuu国产电影一区二区| 一区二区理论电影在线观看| 国产精品一区二区在线播放 | 香蕉加勒比综合久久| 粉嫩av一区二区三区在线播放| 91黄色免费看| 678五月天丁香亚洲综合网| 国产欧美一区二区精品忘忧草| 青青草原综合久久大伊人精品| 99国产精品久久久| 国产欧美精品在线观看| 麻豆传媒一区二区三区| 欧美理论片在线| 亚洲一区二区三区视频在线| av在线综合网| 欧美激情一区二区三区不卡 | 日韩免费观看高清完整版| 亚洲国产精品久久一线不卡| av在线不卡免费看| 国产精品久久久一本精品| 国产经典欧美精品| 久久精品视频一区二区| 精品一二三四区| 精品国产乱码久久久久久图片| 麻豆高清免费国产一区| 欧美刺激脚交jootjob| 蜜桃av噜噜一区二区三区小说| 欧美视频一区二区三区在线观看 | 在线影视一区二区三区| 亚洲丝袜美腿综合| 色偷偷久久一区二区三区| 亚洲视频在线一区观看| 91极品视觉盛宴| 婷婷成人激情在线网| 欧美一区二区福利视频| 精品一区二区三区在线播放视频 | 51精品视频一区二区三区| 亚洲国产另类精品专区| 7799精品视频| 久久精品国产77777蜜臀| 久久综合999| 成人综合激情网| 亚洲美女少妇撒尿| 欧美久久一二三四区| 蜜桃视频免费观看一区| 国产欧美日韩在线观看| 欧美精品免费视频| 国产成人在线电影| 18成人在线观看| 在线观看视频欧美| 美腿丝袜亚洲色图| 国产精品免费视频网站| 色婷婷久久久久swag精品| 首页亚洲欧美制服丝腿| 久久久精品日韩欧美| 99久久精品国产精品久久| 洋洋成人永久网站入口| 日韩亚洲欧美中文三级| 成人午夜免费电影| 日日骚欧美日韩| 中文字幕av一区二区三区高 | 亚洲男人天堂一区| 欧美xingq一区二区| 91猫先生在线| 久久精品国产一区二区| 国产精品免费人成网站| 欧美年轻男男videosbes| 国产91在线观看| 日韩精品电影在线| 国产精品成人免费精品自在线观看| 91高清视频免费看| 粉嫩久久99精品久久久久久夜| 亚洲一区免费观看| 国产精品高潮久久久久无| 欧美日韩精品一区二区三区蜜桃| 国产成a人亚洲| 奇米色777欧美一区二区| 国产精品动漫网站| 欧美成人乱码一区二区三区| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 国产在线观看免费一区| 精品国产一区二区三区不卡 | 天天亚洲美女在线视频| 中文字幕视频一区| 日韩女优av电影| 欧美日韩免费观看一区三区| 成人污视频在线观看| 久久爱www久久做| 婷婷开心激情综合| 亚洲国产日韩一区二区| ㊣最新国产の精品bt伙计久久| 精品久久国产字幕高潮| 777午夜精品免费视频| 91欧美一区二区| 国产成人av电影| 精品在线一区二区三区| 免费国产亚洲视频| 午夜影院在线观看欧美| 樱桃国产成人精品视频| 国产精品网站在线| 国产亚洲精品免费| 久久久噜噜噜久久人人看| 精品日本一线二线三线不卡| 91精品国产高清一区二区三区 | 久久久久99精品国产片| 久久美女高清视频| 精品国产一区二区三区四区四| 欧美一级国产精品| 欧美成人精品福利| 日韩免费高清视频| 日韩欧美一区二区三区在线| 欧美一级午夜免费电影| 日韩美女视频在线| 26uuu国产日韩综合| 久久久久久久久久久久久久久99 | 亚洲精品免费一二三区| 亚洲美女精品一区| 亚洲一区二区三区四区在线观看| 亚洲免费在线电影| 亚洲国产欧美日韩另类综合| 亚洲电影你懂得| 日韩成人av影视| 精品一区在线看| 成人av在线观| 91免费国产在线观看| 欧美日精品一区视频| 日韩一区二区三区在线| 欧美大胆人体bbbb| 国产精品每日更新| 亚洲综合一区在线| 麻豆精品一区二区综合av| 国产sm精品调教视频网站| 99免费精品在线| 欧美日本高清视频在线观看| 精品久久久久久久一区二区蜜臀| 国产日韩欧美电影| 亚洲一区免费在线观看| 久久精品免费观看| 色呦呦国产精品| 精品国产电影一区二区| 国产精品久久久久久福利一牛影视 | 国产午夜亚洲精品理论片色戒 | 国产伦理精品不卡| 国产福利一区二区三区视频在线| 亚洲香肠在线观看| 美国一区二区三区在线播放| 岛国一区二区三区| 在线视频中文字幕一区二区| 亚洲午夜久久久| 国产精品成人免费在线| 一区二区日韩电影| 久久99九九99精品| www.日韩大片| 欧美日韩国产综合视频在线观看 | 欧美大片国产精品| 欧美亚洲综合一区| 国产亚洲成av人在线观看导航| 中文字幕一区二区在线观看| 亚洲综合小说图片| 夜夜操天天操亚洲| 成人福利视频在线| 精品视频一区 二区 三区| 亚洲精品在线观| 一区二区三区蜜桃网| 日本亚洲视频在线| www.日韩大片| 在线观看三级视频欧美| 国产精品你懂的在线欣赏| 一区二区三区欧美视频| 国产麻豆精品在线观看| 91日韩精品一区| 欧美不卡一区二区三区四区| 中文字幕一区二区在线观看| 国产在线精品视频| 欧美色偷偷大香| 国产精品久久一级| 男人操女人的视频在线观看欧美| 色天天综合色天天久久| 精品国产91乱码一区二区三区 | 成人app在线| 欧美系列日韩一区| 一区在线观看免费| 精品一区二区久久久| 日韩精品一区二区三区四区| **欧美大码日韩| 国产一区二区在线看| 欧美日韩免费观看一区二区三区| 亚洲精品中文在线| 成人免费福利片| 欧美精品一区二区三区在线播放| 热久久一区二区| 欧美性做爰猛烈叫床潮| 国产精品久久久一本精品| 国产一区二区不卡在线 | 欧美色成人综合|