⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canvas.h

📁 windows mobile phone source code
💻 H
字号:
/*
 * canvas.h
 *
 * Canvas ancestor class.
 *
 * Portable Windows Library
 *
 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Portable Windows Library.
 *
 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
 *
 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
 * All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 * $Log: canvas.h,v $
 * Revision 1.10  2001/05/22 12:49:33  robertj
 * Did some seriously wierd rewrite of platform headers to eliminate the
 *   stupid GNU compiler warning about braces not matching.
 *
 * Revision 1.9  1998/11/30 02:59:49  robertj
 * New directory structure
 *
 * Revision 1.8  1998/09/24 03:39:32  robertj
 * Added open software license.
 *
 * Revision 1.7  1996/08/08 10:09:27  robertj
 * Directory structure changes for common files.
 *
 * Revision 1.6  1995/01/27 11:20:37  robertj
 * Underscored library variables.
 * "Commonised" DrawRect function.
 * Fixed bugs in drawing filled shapes.
 *
 * Revision 1.5  1995/01/21  05:18:02  robertj
 * Removed redundent function.
 *
 * Revision 1.4  1994/10/30  11:37:58  robertj
 * Improved DC creation in RedrawCanvas.
 *
 * Revision 1.3  1994/10/23  05:44:45  robertj
 * Fixed DrawRect semantics so pen and fill modes are independent.
 *
 * Revision 1.2  1994/08/21  23:43:02  robertj
 * Added MakeFont() function to resolve font bootstrap on canvas creation.
 *
 * Revision 1.1  1994/04/12  08:21:52  robertj
 * Initial revision
 *
 */

#ifndef _PCANVAS

///////////////////////////////////////////////////////////////////////////////
// PCanvas

#define _PCANVAS_PLATFORM_INCLUDE
#include "../../canvas.h"

#endif
#ifdef _PCANVAS_PLATFORM_INCLUDE
#undef _PCANVAS_PLATFORM_INCLUDE

  public:
    // Overrides from class PCanvasState
    virtual BOOL SetPenStyle(PenStyles style);
      // Set the pen style to be used by future drawing operations.

    virtual BOOL SetPenWidth(int width);
      // Set the pen width to be used by future drawing operations.

    virtual BOOL SetPenFgColour(const PColour & colour);
      // Set the pen foreground colour to be used by future drawing operations.

    virtual BOOL SetFillPattern(const PPattern & pattern);
      // Set the fill pattern to be used by future drawing operations.

    virtual BOOL SetPatternOrigin(const PPoint & pt);
      // Set the fill pattern to be used by future drawing operations.

    virtual BOOL SetFillFgColour(const PColour & colour);
      // Set the fill foreground colour to be used by future drawing operations.

    virtual BOOL SetFont(const PFont & newFont);
      // Set the font drawing tool to be used by future drawing operations.

    virtual BOOL SetPolyFillMode(PolyFillMode newMode);
      // Set the polygon fill mode to be used by future drawing operations.

    virtual BOOL SetPalette(const PPalette & newPal);
      // Set the palette drawing tool to be used by future drawing operations.

    virtual BOOL SetMappingRect(const PRect & rect);
      // Set the source rectangle to be used in the coordinate transform in
      // future drawing operations. This is a rectangle in the world
      // coordinates of the application.

    virtual BOOL SetViewportRect(const PRect & rect);
      // Set the destination rectangle to be used in the coordinate transform
      // in future drawing operations. This is a rectangle in the device
      // coordinates (pixels) of the screen, printer etc


    // New functions for class
    virtual HDC GetHDC() const;
      // Return the MS-Windows GDI Device Context.

    void SetHDC(HDC newDC);
      // Function to associate the MS-Windows GDI Device Context to the canvas
      // object.

    BOOL NullHDC() const;
      // Return TRUE if the hDC is NULL, ie not used by any OnRedraw().


  protected:
    void MakePen();
      // Make a MS-Windows GDI pen for the canvas

    void MakeBrush();
      // Make a MS-Windows GDI brush for the canvas

    void MakeFont();
      // Make a MS-Windows GDI font for the canvas

    void SetTransform();
      // Set the coordinate transforms.

    HGDIOBJ SetUpDrawModes(DrawingModes mode,
                           const PColour & fg, const PColour & bg,
                           HGDIOBJ restoreObj, int saveObj);
      // Set the MS-Windows GDI ROP mode, background colour & background mode.

    LPPOINT MakePOINTArray(const PPointArray & ptArray);
    LPPOINT MakePOINTArray(const PPoint * ptArray, PINDEX numPts);
      // Make an array of POINTs from parameter. Array must be deleted.

    void DrawPolyLine(LPPOINT ptArray, PINDEX numPts);
      // Draw a series of lines represented by the array of points.

    virtual void DrawPolygon(LPPOINT ptArray, PINDEX numPts);
      // Draw a closed polygon represented by the array of points.


    // Member variables
    HDC _hDC;
      // The MS-Windows GDI Device Context creates internal to the canvas.

    HPEN _hPen;
      // The MS-Windows GDI pen object

    HBRUSH _hBrush;
      // The MS-Windows GDI brush object

    HFONT _hFont;
      // The MS-Windows GDI font object

#endif


// End Of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -