Skip to content

Commit

Permalink
feat(win32-api): declare wingdi.enum.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingsong committed Jul 4, 2022
1 parent b128127 commit b94a11d
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/win32-def/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./consts": {
"types": "./src/index.consts.ts",
"import": "./dist/index.consts.js",
"require": "./dist/index.consts.cjs"
},
"./common.def": {
"types": "./src/index.def.ts",
"import": "./dist/index.def.js",
Expand Down
3 changes: 3 additions & 0 deletions packages/win32-def/src/index.consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

export * from './lib/consts/wingdi.enum.js'

1 change: 1 addition & 0 deletions packages/win32-def/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export * from './lib/union/union.types.js'
export * from './lib/ffi.types.js'
export * from './lib/fixed-buffer.js'


41 changes: 41 additions & 0 deletions packages/win32-def/src/lib/consts/wingdi.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

/**
* Specifies the clockwise rotation of the display.
* @link https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ne-wingdi-displayconfig_rotation
*/
export const enum DISPLAYCONFIG_ROTATION {
DISPLAYCONFIG_ROTATION_IDENTITY = 1,
DISPLAYCONFIG_ROTATION_ROTATE90 = 2,
DISPLAYCONFIG_ROTATION_ROTATE180 = 3,
DISPLAYCONFIG_ROTATION_ROTATE270 = 4,
DISPLAYCONFIG_ROTATION_FORCE_UINT32 = 0xFFFFFFFF
}

/**
* Specifies the scaling transformation applied to content displayed
* on a video present network (VidPN) present path.
* @link https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ne-wingdi-displayconfig_scaling
*/
export const enum DISPLAYCONFIG_SCALING {
DISPLAYCONFIG_SCALING_IDENTITY = 1,
DISPLAYCONFIG_SCALING_CENTERED = 2,
DISPLAYCONFIG_SCALING_STRETCHED = 3,
DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX = 4,
DISPLAYCONFIG_SCALING_CUSTOM = 5,
DISPLAYCONFIG_SCALING_PREFERRED = 128,
DISPLAYCONFIG_SCALING_FORCE_UINT32 = 0xFFFFFFFF
}

/**
* Specifies the method that the display uses to create an image on a screen.
* @link https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ne-wingdi-displayconfig_scanline_ordering
*/
export const enum DISPLAYCONFIG_SCANLINE_ORDERING {
DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED = 0,
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE = 1,
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED = 2,
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST,
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST = 3,
DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32 = 0xFFFFFFFF
}

18 changes: 18 additions & 0 deletions packages/win32-def/test/consts/40.consts.wingdi.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import assert from 'node:assert/strict'

import { fileShortPath } from '@waiting/shared-core'

import * as consts from '../../src/index.consts.js'


describe(fileShortPath(import.meta.url), () => {

describe('wingdi.h should work', () => {
it('normal', () => {
assert(Object.keys(consts).length > 0)
assert(consts.DISPLAYCONFIG_ROTATION.DISPLAYCONFIG_ROTATION_IDENTITY === 1)
})
})

})

0 comments on commit b94a11d

Please sign in to comment.