New-SlideCanvas
Adds a pixel canvas to a slide.
SYNOPSIS
Adds a pixel canvas to a slide.
SYNTAX
__AllParameterSets
New-SlideCanvas [-Width] <int> [-Height] <int> [-Paint] <scriptblock> [-MaxWidth <int>] [-NoScale]
[-HPadding <int>] [-VPadding <int>]
ALIASES
This cmdlet has no aliases.
DESCRIPTION
Adds a pixel canvas to a slide. The Paint script block runs at authoring time with the canvas
exposed as $_ (also $PSItem) and the dimensions as $Width/$Height. Draw with
$_.SetPixel(x, y, color) and $_.Fill(color).
EXAMPLES
Example 1: A diagonal line
New-SlideCanvas -Width 16 -Height 16 -Paint {
$_.Fill('grey15')
for ($i = 0; $i -lt $Width; $i++) { $_.SetPixel($i, $i, 'lime') }
}
Fills a 16x16 canvas with dark grey and draws a lime diagonal.
PARAMETERS
-Height
The canvas height in pixels.
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-HPadding
Left/right padding, in cells, around the widget. The default is 0.
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxWidth
The maximum rendered width in cells. Defaults to the content width.
Type: System.Nullable`1[System.Int32]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-NoScale
Disables auto-scaling to fit the available width, rendering the canvas at its native size.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Paint
The script block that paints the canvas. The canvas is $_ (and $PSItem); $Width and $Height
are also available.
Type: System.Management.Automation.ScriptBlock
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-VPadding
Top/bottom padding, in rows, around the widget. The default is 1.
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Width
The canvas width in pixels.
Type: System.Int32
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
PSSlideShow.Model.CanvasWidget
A canvas widget to be emitted inside a New-Slide content block.
NOTES
The Paint block runs once at authoring time to render the pixels; it is not re-invoked during the
show. Pixel coordinates are zero-based, with (0, 0) at the top-left.