File:  [WindowsNT SDKs] / ntddk / src / video / displays / s3 / pattern.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 18:31:12 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: ntddk-nov-1993, HEAD
Microsoft Windows NT Build 511 (DDK SDK) 11-01-1993

/******************************Module*Header*******************************\
* Module Name: pattern.c
*
* Used for creating and destroying the default patterns to be used on this
* device.
*
* Copyright (c) 1992 Microsoft Corporation
\**************************************************************************/

#include "driver.h"

/******************************Public*Data*Struct*************************\
* gaajPat
*
* These are the standard patterns defined Windows, they are used to produce
* hatch brushes, grey brushes etc.
*
\**************************************************************************/

const BYTE gaajPat[HS_DDI_MAX][32] = {

    { 0x00,0x00,0x00,0x00,                 // ........     HS_HORIZONTAL 0
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0xff,0x00,0x00,0x00,                 // ********
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00 },               // ........

    { 0x08,0x00,0x00,0x00,                 // ....*...     HS_VERTICAL 1
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00 },               // ....*...

    { 0x80,0x00,0x00,0x00,                 // *.......     HS_FDIAGONAL 2
      0x40,0x00,0x00,0x00,                 // .*......
      0x20,0x00,0x00,0x00,                 // ..*.....
      0x10,0x00,0x00,0x00,                 // ...*....
      0x08,0x00,0x00,0x00,                 // ....*...
      0x04,0x00,0x00,0x00,                 // .....*..
      0x02,0x00,0x00,0x00,                 // ......*.
      0x01,0x00,0x00,0x00 },               // .......*

    { 0x01,0x00,0x00,0x00,                 // .......*     HS_BDIAGONAL 3
      0x02,0x00,0x00,0x00,                 // ......*.
      0x04,0x00,0x00,0x00,                 // .....*..
      0x08,0x00,0x00,0x00,                 // ....*...
      0x10,0x00,0x00,0x00,                 // ...*....
      0x20,0x00,0x00,0x00,                 // ..*.....
      0x40,0x00,0x00,0x00,                 // .*......
      0x80,0x00,0x00,0x00 },               // *.......

    { 0x08,0x00,0x00,0x00,                 // ....*...     HS_CROSS 4
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0xff,0x00,0x00,0x00,                 // ********
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00,                 // ....*...
      0x08,0x00,0x00,0x00 },               // ....*...

    { 0x81,0x00,0x00,0x00,                 // *......*     HS_DIAGCROSS 5
      0x42,0x00,0x00,0x00,                 // .*....*.
      0x24,0x00,0x00,0x00,                 // ..*..*..
      0x18,0x00,0x00,0x00,                 // ...**...
      0x18,0x00,0x00,0x00,                 // ...**...
      0x24,0x00,0x00,0x00,                 // ..*..*..
      0x42,0x00,0x00,0x00,                 // .*....*.
      0x81,0x00,0x00,0x00 },               // *......*

    { 0x81,0x00,0x00,0x00,                 // *......*     HS_FDIAGONAL1 6
      0x60,0x00,0x00,0x00,                 // .**.....
      0x18,0x00,0x00,0x00,                 // ...**...
      0x06,0x00,0x00,0x00,                 // .....**.
      0x81,0x00,0x00,0x00,                 // *......*
      0x60,0x00,0x00,0x00,                 // .**.....
      0x18,0x00,0x00,0x00,                 // ...**...
      0x06,0x00,0x00,0x00 },               // .....**.

    { 0x81,0x00,0x00,0x00,                 // *......*     HS_BDIAGONAL1 7
      0x06,0x00,0x00,0x00,                 // .....**.
      0x18,0x00,0x00,0x00,                 // ...**...
      0x60,0x00,0x00,0x00,                 // .**.....
      0x81,0x00,0x00,0x00,                 // *......*
      0x06,0x00,0x00,0x00,                 // .....**.
      0x18,0x00,0x00,0x00,                 // ...**...
      0x60,0x00,0x00,0x00 },               // .**.....

    { 0xFF,0x00,0x00,0x00,                 // ********     HS_SOLID 8
      0xFF,0x00,0x00,0x00,                 // ********
      0xFF,0x00,0x00,0x00,                 // ********
      0xFF,0x00,0x00,0x00,                 // ********
      0xFF,0x00,0x00,0x00,                 // ********
      0xFF,0x00,0x00,0x00,                 // ********
      0xFF,0x00,0x00,0x00,                 // ********
      0xFF,0x00,0x00,0x00 },               // ********

    { 0x38,0x00,0x00,0x00,                 // ..***...     HS_DENSE1 9
      0x7c,0x00,0x00,0x00,                 // .*****..
      0x7c,0x00,0x00,0x00,                 // .*****..
      0x38,0x00,0x00,0x00,                 // ..***...
      0x83,0x00,0x00,0x00,                 // *.....**
      0xc7,0x00,0x00,0x00,                 // **...***
      0xc7,0x00,0x00,0x00,                 // **...***
      0x83,0x00,0x00,0x00 },               // *.....**

    { 0x38,0x00,0x00,0x00,                 // ..***...     HS_DENSE2 10
      0x6c,0x00,0x00,0x00,                 // .**.**..
      0x54,0x00,0x00,0x00,                 // .*.*.*..
      0x38,0x00,0x00,0x00,                 // ..***...
      0x83,0x00,0x00,0x00,                 // *.....**
      0xc6,0x00,0x00,0x00,                 // **...**.
      0x45,0x00,0x00,0x00,                 // .*...*.*
      0x83,0x00,0x00,0x00 },               // *.....**

    { 0x18,0x00,0x00,0x00,                 // ...**...     HS_DENSE3 11
      0x3c,0x00,0x00,0x00,                 // ..****..
      0x34,0x00,0x00,0x00,                 // ..**.*..
      0x18,0x00,0x00,0x00,                 // ...**...
      0x81,0x00,0x00,0x00,                 // *......*
      0xc3,0x00,0x00,0x00,                 // **....**
      0x43,0x00,0x00,0x00,                 // .*....**
      0x81,0x00,0x00,0x00 },               // *......*

    { 0x18,0x00,0x00,0x00,                 // ...**...     HS_DENSE4 12
      0x2c,0x00,0x00,0x00,                 // ..*.**..
      0x24,0x00,0x00,0x00,                 // ..*..*..
      0x18,0x00,0x00,0x00,                 // ...**...
      0x81,0x00,0x00,0x00,                 // *......*
      0xc1,0x00,0x00,0x00,                 // **....*.
      0x42,0x00,0x00,0x00,                 // .*....*.
      0x81,0x00,0x00,0x00 },               // *......*

    { 0x10,0x00,0x00,0x00,                 // ...*....     HS_DENSE5 13
      0x38,0x00,0x00,0x00,                 // ..***...
      0x28,0x00,0x00,0x00,                 // ..*.*...
      0x10,0x00,0x00,0x00,                 // ...*....
      0x01,0x00,0x00,0x00,                 // .......*
      0x83,0x00,0x00,0x00,                 // *.....**
      0x82,0x00,0x00,0x00,                 // *.....*.
      0x01,0x00,0x00,0x00 },               // .......*

    { 0x00,0x00,0x00,0x00,                 // ........     HS_DENSE6 14
      0x10,0x00,0x00,0x00,                 // ...*....
      0x38,0x00,0x00,0x00,                 // ..***...
      0x10,0x00,0x00,0x00,                 // ...*....
      0x00,0x00,0x00,0x00,                 // ........
      0x01,0x00,0x00,0x00,                 // .......*
      0x83,0x00,0x00,0x00,                 // *.....**
      0x01,0x00,0x00,0x00 },               // .......*

    { 0x00,0x00,0x00,0x00,                 // ........     HS_DENSE7 15
      0x10,0x00,0x00,0x00,                 // ...*....
      0x30,0x00,0x00,0x00,                 // ..**....
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x01,0x00,0x00,0x00,                 // .......*
      0x03,0x00,0x00,0x00,                 // ......**
      0x00,0x00,0x00,0x00 },               // ........

    { 0x00,0x00,0x00,0x00,                 // ........     HS_DENSE8 16
      0x00,0x00,0x00,0x00,                 // ........
      0x20,0x00,0x00,0x00,                 // ..*.....
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x02,0x00,0x00,0x00,                 // ......*.
      0x00,0x00,0x00,0x00 },               // ........

    { 0x00,0x00,0x00,0x00,                 // ........     HS_NOSHADE 17
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00,                 // ........
      0x00,0x00,0x00,0x00 },               // ........

    { 0xAA,0x00,0x00,0x00,                 // *.*.*.*.     HS_HALFTONE 18
      0x55,0x00,0x00,0x00,                 // .*.*.*.*
      0xAA,0x00,0x00,0x00,                 // *.*.*.*.
      0x55,0x00,0x00,0x00,                 // .*.*.*.*
      0xAA,0x00,0x00,0x00,                 // *.*.*.*.
      0x55,0x00,0x00,0x00,                 // .*.*.*.*
      0xAA,0x00,0x00,0x00,                 // *.*.*.*.
      0x55,0x00,0x00,0x00 }                // .*.*.*.*
};

/******************************Public*Routine******************************\
* bInitPatterns
*
* This routine initializes the default patterns.
*
\**************************************************************************/

BOOL bInitPatterns(
    IN PPDEV ppdev,
    INT cPatterns)
{
    SIZEL sizl;
    INT   iLoop;

    sizl.cx = 8;
    sizl.cy = 8;

    for (iLoop = 0; iLoop < cPatterns; iLoop++)
    {
        ppdev->ahbmPat[iLoop] = EngCreateBitmap(sizl,
                                                sizl.cx / 8,
                                                BMF_1BPP,
                                                BMF_TOPDOWN,
                                                (PULONG) (&gaajPat[iLoop][0]));

        if (ppdev->ahbmPat[iLoop] == (HBITMAP) 0)
        {
        // Set the count created so vDisablePatterns will clean up.

            ppdev->cPatterns = iLoop;
            return(FALSE);
        }
    }

    ppdev->cPatterns = cPatterns;
    return(TRUE);
}

/******************************Public*Routine******************************\
* vDisablePatterns
*
* Delete the standard patterns allocated.
*
\**************************************************************************/

VOID vDisablePatterns(IN PPDEV ppdev)
{
    ULONG ulIndex;

// Erase all patterns.

    for (ulIndex = 0; ulIndex < ppdev->cPatterns; ulIndex++)
    {
        EngDeleteSurface((HSURF) ppdev->ahbmPat[ulIndex]);
    }
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.