Documentation
¶
Index ¶
- Constants
- func ClosePrinter(handle Printer) (err error)
- func Default() (string, error)
- func DeleteDC(dc HDC) (err error)
- func DrawDIImage(dc HDC, dx, dy, dw, dh, sx, sy uint32, sw, sh int32, image []byte) (err error)
- func EndDoc(dc HDC) (err error)
- func EndDocPrinter(handle Printer) (err error)
- func EndPage(dc HDC) (err error)
- func EndPagePrinter(handle Printer) (err error)
- func EnumPrinter(flag EnumFlag, name *uint16, level uint32, info *byte, bufLen uint32, ...) (err error)
- func GetDefaultPrinter(buf *uint16, bufN *uint32) (err error)
- func GetDeviceCaps(dc HDC, index PropType) (number uint32, err error)
- func GetPixel(dc HDC, x, y uint32) (color uint32, err error)
- func GetTextExtentPoint32(hdc syscall.Handle, text string) (uint32, uint32, error)
- func LineTo(dc HDC, x, y uint32) (err error)
- func MoveTo(dc HDC, x, y uint32) (rect *image.Point, err error)
- func ResetDC(dc HDC) (err error)
- func SetBoldFont(hdc HDC, bold bool) (err error)
- func SetDefaultPrinter(buf *uint16) (err error)
- func SetFont(hdc HDC, fontName string) (err error)
- func SetItalicFont(hdc HDC, italic bool) (err error)
- func SetPixel(dc HDC, x, y uint32, color uint32) (err error)
- func SetTextSize(hdc HDC, size int32) (i int32, err error)
- func StartDCPrinter(dc HDC, docName string) (err error)
- func StartDoc(dc HDC, doc *DOCINFOA) (err error)
- func StartDocPrinter(handle Printer, level uint32, doc *DOC_INFO_1) (err error)
- func StartPage(dc HDC) (err error)
- func StartPagePrinter(handle Printer) (err error)
- func StretchDIBits(dc HDC, dx, dy, dw, dh, sx, sy uint32, sw, sh int32, image []byte, ...) (err error)
- func TextOut(dc HDC, x, y uint32, text string, len uint32) (err error)
- func WritePrinter(handle Printer, buf *byte, bufN uint32, written *uint32) (err error)
- type BITMAPINFO
- type BITMAPINFOHEADER
- type BiCompression
- type COLORREF
- type DIBColors
- type DOCINFOA
- type DOC_INFO_1
- type EnumFlag
- type HDC
- type LOGFONT
- type PRINT_INFO_4
- type Printer
- type PrinterInfo
- type PropType
- type RGBQUAD
- type RasterOperationCode
Constants ¶
const ( OBJ_PEN = 1 OBJ_BRUSH = 2 OBJ_DC = 3 OBJ_METADC = 4 OBJ_PAL = 5 OBJ_FONT = 6 OBJ_BITMAP = 7 OBJ_REGION = 8 OBJ_METAFILE = 9 OBJ_MEMDC = 10 OBJ_EXTPEN = 11 OBJ_ENHMETADC = 12 OBJ_ENHMETAFILE = 13 OBJ_COLORSPACE = 14 )
Object Definitions for EnumObjects()
const ( Arial = "Arial" TimesNewRoman = "Times New Roman" CourierNew = "Courier New" Verdana = "Verdana" )
const ( PRINTER_ATTRIBUTE_LOCAL uint32 = 0x00000040 PRINTER_ATTRIBUTE_NETWORK uint32 = 0x00000010 )
const (
HFONT = 6 // Object type for getCurrentFont
)
Constants
Variables ¶
This section is empty.
Functions ¶
func ClosePrinter ¶
func DeleteDC ¶
DeleteDC https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-deletedc
func DrawDIImage ¶
func EndPagePrinter ¶
func EnumPrinter ¶
func EnumPrinter(flag EnumFlag, name *uint16, level uint32, info *byte, bufLen uint32, bufSize *uint32, returnLen *uint32) (err error)
EnumPrinter https://learn.microsoft.com/zh-cn/windows/win32/printdocs/enumprinters
func GetDefaultPrinter ¶
func GetPixel ¶
GetPixel https://learn.microsoft.com/zh-cn/windows/win32/api/wingdi/nf-wingdi-getpixel
func GetTextExtentPoint32 ¶
Calcule la largeur et la hauteur de la chaîne passée en paramètre
func ResetDC ¶
ResetDC https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-resetdcw
func SetBoldFont ¶
func SetDefaultPrinter ¶
func SetItalicFont ¶
func SetPixel ¶
SetPixel https://learn.microsoft.com/zh-cn/windows/win32/api/wingdi/nf-wingdi-setpixel
func SetTextSize ¶
SetTextSize changes the text height for the specified device context Parameters:
- hdc: Handle to the device context
- size: Text height in logical units (points)
Returns:
- error: nil if successful, error object otherwise
func StartDCPrinter ¶
func StartDocPrinter ¶
func StartDocPrinter(handle Printer, level uint32, doc *DOC_INFO_1) (err error)
https://learn.microsoft.com/en-us/windows/win32/printdocs/startdocprinter
func StartPagePrinter ¶
func StretchDIBits ¶
func StretchDIBits(dc HDC, dx, dy, dw, dh, sx, sy uint32, sw, sh int32, image []byte, bitmap *BITMAPINFO, color DIBColors, operation RasterOperationCode) (err error)
Types ¶
type BITMAPINFO ¶
type BITMAPINFO struct { BmiHeader BITMAPINFOHEADER BmiColors RGBQUAD }
type BITMAPINFOHEADER ¶
type BITMAPINFOHEADER struct {
// contains filtered or unexported fields
}
type BiCompression ¶
type BiCompression uint32
const ( BI_RGB BiCompression = 0 BI_RLE8 BiCompression = 1 BI_RLE4 BiCompression = 2 BI_BITFIELDS BiCompression = 3 BI_JPEG BiCompression = 4 BI_PNG BiCompression = 5 )
type COLORREF ¶
type COLORREF uint32
COLORREF represents a Windows color value in BGR format
func SetTextColor ¶
SetTextColor sets the text color for the specified device context Parameters:
- hdc: Handle to the device context
- color: Color value created using RGB()
Returns:
- Previous text color value
- error: nil if successful, error object otherwise
type EnumFlag ¶
type EnumFlag uint32
const ( PRINTER_ENUM_DEFAULT EnumFlag = 0x00000001 PRINTER_ENUM_LOCAL EnumFlag = 0x00000002 PRINTER_ENUM_CONNECTIONS EnumFlag = 0x00000004 PRINTER_ENUM_FAVORITE EnumFlag = 0x00000004 PRINTER_ENUM_NAME EnumFlag = 0x00000008 PRINTER_ENUM_REMOTE EnumFlag = 0x00000010 PRINTER_ENUM_SHARED EnumFlag = 0x00000020 PRINTER_ENUM_NETWORK EnumFlag = 0x00000040 )
type LOGFONT ¶
type LOGFONT struct { Height int32 Width int32 Escapement int32 Orientation int32 Weight int32 Italic byte Underline byte StrikeOut byte CharSet byte OutPrecision byte ClipPrecision byte Quality byte PitchAndFamily byte FaceName [32]uint16 }
LOGFONT contains information about a logical font
type PRINT_INFO_4 ¶
type Printer ¶
func OpenPrinter ¶
type PrinterInfo ¶
type PropType ¶
type PropType uint32
const ( DRIVERVERSION PropType = 0 /* Device driver version */ TECHNOLOGYPropType PropType = 2 /* Device classification */ HORZSIZE PropType = 4 /* Horizontal size in millimeters */ VERTSIZE PropType = 6 /* Vertical size in millimeters */ HORZRES PropType = 8 /* Horizontal width in pixels */ VERTRES PropType = 10 /* Vertical height in pixels */ BITSPIXEL PropType = 12 /* Number of bits per pixel */ PLANES PropType = 14 /* Number of planes */ NUMBRUSHES PropType = 16 /* Number of brushes the device has */ NUMPENS PropType = 18 /* Number of pens the device has */ NUMMARKERS PropType = 20 /* Number of markers the device has */ NUMFONTS PropType = 22 /* Number of fonts the device has */ NUMCOLORS PropType = 24 /* Number of colors the device supports */ PDEVICESIZE PropType = 26 /* Size required for device descriptor */ CURVECAPS PropType = 28 /* Curve capabilities */ LINECAPSPropType PropType = 30 /* Line capabilities */ POLYGONALCAPSPropType PropType = 32 /* Polygonal capabilities */ TEXTCAPSPropType PropType = 34 /* Text capabilities */ CLIPCAPSPropType PropType = 36 /* Clipping capabilities */ RASTERCAPS PropType = 38 /* Bitblt capabilities */ ASPECTX PropType = 40 /* Length of the X leg */ ASPECTY PropType = 42 /* Length of the Y leg */ ASPECTXYPropType PropType = 44 /* Length of the hypotenuse */ LOGPIXELSX PropType = 88 /* Logical pixels/inch in X */ LOGPIXELSY PropType = 90 /* Logical pixels/inch in Y */ SIZEPALETTE PropType = 104 /* Number of entries in physical palette */ NUMRESERVED PropType = 106 /* Number of reserved entries in palette */ COLORRES PropType = 108 /* Actual color resolution */ PHYSICALWIDTH PropType = 110 /* Physical Width in device units */ PHYSICALHEIGHT PropType = 111 /* Physical Height in device units */ PHYSICALOFFSETX PropType = 112 /* Physical Printable Area x margin */ PHYSICALOFFSETY PropType = 113 /* Physical Printable Area y margin */ SCALINGFACTORX PropType = 114 /* Scaling factor x */ SCALINGFACTORY PropType = 115 /* Scaling factor y */ VREFRESH PropType = 116 /* Current vertical refresh rate of the */ /* display device (for displays only) in Hz*/ DESKTOPVERTRES PropType = 117 /* Horizontal width of entire desktop in */ /* pixels */ DESKTOPHORZRES PropType = 118 /* Vertical height of entire desktop in */ /* pixels */ BLTALIGNMENT PropType = 119 /* Preferred blt alignment */ SHADEBLENDCAPS PropType = 120 /* Shading and blending caps */ COLORMGMTCAPS PropType = 121 /* Color Management caps */ )
type RasterOperationCode ¶
type RasterOperationCode uint32
const ( SRCCOPY RasterOperationCode = 0x00CC0020 /* dest = source */ SRCPAINT RasterOperationCode = 0x00EE0086 /* dest = source OR dest */ SRCAND RasterOperationCode = 0x008800C6 /* dest = source AND dest */ SRCINVERT RasterOperationCode = 0x00660046 /* dest = source XOR dest */ SRCERASE RasterOperationCode = 0x00440328 /* dest = source AND (NOT dest ) */ NOTSRCCOPY RasterOperationCode = 0x00330008 /* dest = (NOT source) */ NOTSRCERASE RasterOperationCode = 0x001100A6 /* dest = (NOT src) AND (NOT dest) */ MERGECOPY RasterOperationCode = 0x00C000CA /* dest = (source AND pattern) */ MERGEPAINT RasterOperationCode = 0x00BB0226 /* dest = (NOT source) OR dest */ PATCOPY RasterOperationCode = 0x00F00021 /* dest = pattern */ PATPAINT RasterOperationCode = 0x00FB0A09 /* dest = DPSnoo */ PATINVERT RasterOperationCode = 0x005A0049 /* dest = pattern XOR dest */ DSTINVERT RasterOperationCode = 0x00550009 /* dest = (NOT dest) */ BLACKNESS RasterOperationCode = 0x00000042 /* dest = BLACK */ WHITENESS RasterOperationCode = 0x00FF0062 /* dest = WHITE */ )