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

📄 swg.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
字号:
//
// Windows CE Software Graphics Library
// swg.h
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This is the public header file for the swg.lib library. It includes
// prototypes for the public functions in the library, along with the
// necessary supporting types and constants.

#pragma once

// Macros

// Turn 4 ASCII characters into a packed FourCC code to identify a color
// space.

#define MAKE_FOURCC(ch0, ch1, ch2, ch3)                                 \
                ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |       \
                ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))

// Standard RGB color space. Unlike most Four CC codes the RGB one does
// NOT imply a set of masks. It does imply that you should refer to the
// Masks array for the appropriate data.

#define FOURCC_RGB  0

// Use these to index into the Masks array for RGB.

#define RED_MASK   0
#define GREEN_MASK 1
#define BLUE_MASK  2
#define ALPHA_MASK 3

// This FourCC code is used for palettized surfaces. The BitsPerPixel
// value determine the number of entries in the lookup table.

#define FOURCC_PAL MAKE_FOURCC('P', 'A', 'L', 'D')

// Structs

// This structure describes a pixel format.

typedef struct t_FORMAT {

  ULONG FourCC;

  ULONG BitsPerPixel;

  union u_PaletteMask {
    const ULONG * Masks;
    const ULONG * Palette;
  };

} FORMAT;

// This structure brings together common data members pertaining to surfaces,
// which are chunks of memory that hold a certian number of pixels, with some
// attributes.

typedef enum e_MEMORY_TYPE {

  VideoMemory = 0,
  SystemMemory = 1

} MEMORY_TYPE;

typedef struct t_SURFACE {

  LPVOID         Ptr;
  SIZE           Size;
  const FORMAT * Format;
  LONG           Stride;
  MEMORY_TYPE    Type;

} SURFACE;

// This structure must be filled out and passed to the software line
// routine.

typedef struct t_LINE_PARAM {

  const SURFACE * Destination;

  ULONG           FillValue;

  LONG            X;
  LONG            Y;

  LONG            PixelCount;

  ULONG           dM;
  ULONG           dN;

  LONG            Gamma;

  LONG            Direction;

  ULONG           Style;
  LONG            StyleState;

  USHORT          Mix;

} LINE_PARAM;

// These structures are typically used as part of colorkey operations. The
// type enumeration specifies if colors are keyed from the source or
// destination surface. The color space structure is to allow ranges of colors
// to be keyed. (The swg software blitter will only key single colors,
// however.)

typedef enum e_COLORKEY_TYPE {

  NoColorKey = 0,
  SourceColorKey = 1,
  DestColorKey = 2,
  SourceAndDestColorKey = 3

} COLORKEY_TYPE;

typedef struct t_COLOR_SPACE {

  ULONG LowValue;
  ULONG HighValue;

} COLOR_SPACE;

// Specifies if we are filling with a solid color or a bitmap "brush."

typedef enum e_PATTERN_TYPE {

  SolidPattern = 0,
  BitmapPattern = 1

} PATTERN_TYPE;

// This structure must be filled out and passed to the software blit
// routine.

typedef struct t_BLT_PARAM {

  ULONG               Rop;

  const SURFACE     * Destination;
  const RECT        * DestRect;

  const SURFACE     * Source;
  const RECT        * SourceRect;

  PATTERN_TYPE        PatternType;

  ULONG               FillValue;

  const SURFACE     * Brush;
  const RECT        * BrushRect;
  const POINT       * BrushOrigin;

  const SURFACE     * Mask;
  const RECT        * MaskRect;

  BOOL                ScanXPositive;
  BOOL                ScanYPositive;

  ULONG               ClipRectCount;
  const RECT        * ClipRect;

  COLORKEY_TYPE       ColorKeyType;
  const COLOR_SPACE * SourceColorKey;
  const COLOR_SPACE * DestColorKey;

} BLT_PARAM;

// Exported functions.

// Line drawing.

extern BOOL
SoftwareLine(
  LINE_PARAM * Parameters
  );

// Software blitting.

extern BOOL 
SoftwareBlt(
  BLT_PARAM * Parameters
  );

// Color conversion.

extern BOOL
IsSameFormat(
  const FORMAT * Format1,
  const FORMAT * Format2
  );

extern BOOL
InitColorConverter(
  const FORMAT * SourceFormat,
  const FORMAT * DestFormat
  );

extern ULONG
ColorConvert(
  ULONG SourceValue
  );

extern void
CleanupColorConverter();

// Utility

extern LONG
RectWidth(
  const RECT * Rect
  );

extern LONG
RectHeight(
  const RECT * Rect
  );

⌨️ 快捷键说明

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