亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
a级精品国产片在线观看| 国产99精品视频| 国产精品久久久久久亚洲毛片| 3d成人h动漫网站入口| 欧美三区在线观看| 欧美卡1卡2卡| 538prom精品视频线放| 欧美精品tushy高清| 日韩一区二区电影在线| 欧美大片拔萝卜| 精品对白一区国产伦| 久久综合九色综合欧美就去吻| 久久精品一区二区三区不卡牛牛 | 国产精品看片你懂得| 国产精品―色哟哟| 综合久久综合久久| 亚洲激情欧美激情| 亚洲自拍欧美精品| 美女一区二区视频| 国产成人免费xxxxxxxx| 91偷拍与自偷拍精品| 欧美日韩免费电影| 日韩精品一区二区三区中文精品| 久久久不卡网国产精品二区| 国产精品福利一区| 亚洲尤物视频在线| 久久99精品久久久久久动态图 | 欧美一级日韩一级| 26uuu久久综合| 亚洲欧美日韩一区| 五月天激情综合| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产精品1区2区| 91久久精品一区二区二区| 日韩欧美综合在线| ...av二区三区久久精品| 水蜜桃久久夜色精品一区的特点| 韩国女主播一区二区三区| 色哟哟欧美精品| 26uuu久久综合| 亚洲国产毛片aaaaa无费看| 秋霞电影网一区二区| 成人毛片老司机大片| 777久久久精品| 亚洲视频每日更新| 国内精品久久久久影院色| 色噜噜狠狠成人中文综合| 日韩欧美黄色影院| 亚洲欧美日韩国产手机在线 | 在线成人免费观看| 中文字幕中文字幕一区| 另类小说欧美激情| 欧美视频在线一区| 国产片一区二区| 麻豆91精品视频| 在线亚洲一区二区| 国产欧美日韩三级| 久久99精品网久久| 538在线一区二区精品国产| 亚洲激情自拍视频| 高清久久久久久| 欧美成人r级一区二区三区| 亚洲精品中文字幕乱码三区| 成人一级黄色片| 精品国产免费一区二区三区香蕉| 午夜免费欧美电影| 在线观看欧美日本| 亚洲日本成人在线观看| 国产高清精品网站| 久久久久国产精品厨房| 久久狠狠亚洲综合| 欧美一区二区三区免费大片| 亚洲自拍欧美精品| 欧美大肚乱孕交hd孕妇| 天堂va蜜桃一区二区三区| 欧美视频三区在线播放| 亚洲激情图片小说视频| 色综合天天综合色综合av| 国产精品理论在线观看| 福利一区二区在线观看| 中文字幕久久午夜不卡| 高清不卡一二三区| 中文字幕一区二区三区蜜月| 成人av在线观| 成人欧美一区二区三区小说| jizz一区二区| 亚洲欧美自拍偷拍色图| 91在线你懂得| 亚洲电影中文字幕在线观看| 欧美三级电影一区| 五月开心婷婷久久| 欧美一二三四在线| 激情文学综合网| 国产精品欧美综合在线| 成人av午夜电影| 樱桃视频在线观看一区| 欧美日韩电影一区| 日本欧美久久久久免费播放网| 欧美一级在线免费| 国产精品一区二区久久不卡| 国产片一区二区| 一本一道波多野结衣一区二区| 亚洲第一搞黄网站| 精品少妇一区二区| 高清国产午夜精品久久久久久| 亚洲同性gay激情无套| 9191成人精品久久| 加勒比av一区二区| 最新国产成人在线观看| 欧美日韩视频在线第一区 | 成人免费在线观看入口| 色综合天天做天天爱| 青青草国产精品97视觉盛宴| 国产三级一区二区三区| 91成人国产精品| 寂寞少妇一区二区三区| 亚洲激情一二三区| 欧美精品一区在线观看| 93久久精品日日躁夜夜躁欧美| 日韩国产一二三区| 欧美激情一区二区三区四区| 在线观看亚洲成人| 国内精品自线一区二区三区视频| 亚洲视频中文字幕| 欧美电影免费提供在线观看| av成人免费在线| 经典三级视频一区| 亚洲综合色视频| 国产欧美一区二区三区在线老狼| 欧洲一区在线观看| 国产美女主播视频一区| 一区二区三区**美女毛片| 久久久99精品久久| 日韩三级伦理片妻子的秘密按摩| 成人av网站在线观看| 日本vs亚洲vs韩国一区三区二区| 国产精品久线观看视频| 欧美一级搡bbbb搡bbbb| 91首页免费视频| 国产福利一区二区三区| 青青青伊人色综合久久| 亚洲小说春色综合另类电影| 中文字幕日韩欧美一区二区三区| 精品理论电影在线观看| 欧美另类变人与禽xxxxx| 色综合久久综合网欧美综合网| 国模大尺度一区二区三区| 午夜久久久久久久久久一区二区| 国产精品成人免费| 欧美激情一二三区| 久久久99精品免费观看| 欧美电影免费观看高清完整版| 欧美日韩精品高清| 在线观看网站黄不卡| av午夜一区麻豆| 高清在线成人网| 国产a久久麻豆| 国产精品自在欧美一区| 蜜桃一区二区三区在线观看| 日韩精品电影在线观看| 亚洲国产视频直播| 午夜婷婷国产麻豆精品| 亚洲最快最全在线视频| 亚洲精选视频免费看| 亚洲精品视频在线观看免费| |精品福利一区二区三区| 中文字幕一区二区三区在线不卡 | 国产福利一区二区三区视频| 国产毛片精品视频| 国产精品99久久久久久久vr| 国产精品1区2区| 国产a精品视频| 不卡视频一二三| 97久久精品人人澡人人爽| 色综合久久中文综合久久97| 日本精品视频一区二区三区| 91丨九色丨国产丨porny| 在线观看国产日韩| 欧美日韩国产影片| 日韩欧美精品在线| 久久综合久久久久88| 国产欧美精品一区二区色综合朱莉| 国产欧美精品国产国产专区| 中文字幕av一区二区三区| 亚洲日本中文字幕区| 亚洲6080在线| 国产另类ts人妖一区二区| 成人免费毛片片v| 色菇凉天天综合网| 欧美男男青年gay1069videost| 日韩视频一区二区| 国产女主播视频一区二区| 日本一区二区三级电影在线观看| 久久久久久久综合| 亚洲精选免费视频| 美女在线视频一区| 91在线精品一区二区| 69堂国产成人免费视频| 久久嫩草精品久久久久| 综合电影一区二区三区 |