Skip to content

Commit

Permalink
Ps docs update Oct 2023 (#449)
Browse files Browse the repository at this point in the history
* Scripting example code fixes.

* Export `getDisplayConfiguration` in Core Modules.

Add `historyStateID` to Imaging API `getPixels`.

* Update changelog for Beta 25.2.

* Clarify use of Imaging API option targertSize for getPixels.

* Layer name is read/write.
  • Loading branch information
samgannawayA committed Nov 2, 2023
1 parent ac3c191 commit 705f63c
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 130 deletions.
251 changes: 127 additions & 124 deletions src/pages/ps_reference/changelog/index.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/pages/ps_reference/classes/layer.md
Expand Up @@ -50,7 +50,7 @@ group.layers.forEach((layer) => {
| layers | [*Layers*](/ps_reference/classes/layers/) | R | 23.0 | The layers inside this group layer. |
| linkedLayers | [*Layers*](/ps_reference/classes/layers/) | R | 22.5 | Layers linked to this layer. See [Layer.link](/ps_reference/classes/layer/#link) |
| locked | *boolean* | R | 22.5 | True if any property of this layer is locked. |
| name | *string* | R | 22.5 | Name of the layer. |
| name | *string* | R W | 22.5 | Name of the layer. |
| opacity | *number* | R W | 22.5 | The master opacity of the layer, in percent. |
| parent | [*Layer*](/ps_reference/classes/layer/) | R | 22.5 | The group layer that contains this layer. It will return null if the layer is a top layer in the document. |
| pixelsLocked | *boolean* | R W | 22.5 | When set to true, prevents the pixels of this layer from being edited. |
Expand Down
6 changes: 4 additions & 2 deletions src/pages/ps_reference/media/imaging.md
Expand Up @@ -137,11 +137,13 @@ const imageObj = await imaging.getPixels(options);
Options describing the operation.
* `documentID` | Number - Optional. The id of the source document. If missing, or negative, then the source is the active document.
* `layerID` | Number - Optional. The id of the source layer. If the value is not provided then the API returns pixels from the composite document image.
* `historyStateID` | Number - Optional. The id of a history state that the thumbnail should be created for. If not provided, then the current document state is used. This option can be used to get pixels from past document states.
* `sourceBounds` | Object - Optional. The region whose pixels should be returned. If the value is not provided, then pixels from the entire layer or document are is returned. The provided bounds will be trimmed to only that region that contains pixel data. In this event, the returned `sourceBounds` will reflect this smaller region. The provided object must describe a rectangle using one the following number-value property sets:
* `left`, `top`, `right`, and `bottom`
* `left`, `top`, `width`, and `height`
* `targetSize` | Object - Optional. The dimensions of the returned image. If this value is not provided then the returned size will match the requested size. That is, no scaling will be performed on the returned pixels. The provided object must have one or more of the following attributes:
* `width` and `height`. If only one dimension is included, then the returned image data is scaled proportionally to match the requested dimension.
* `targetSize` | Object - Optional. Used to scale the returned image to a specific size. For example, a much smaller `targetSize` would be specified to get a image suitable for a thumbnail representation. If this option is not used, then the returned buffer size will be determined solely by `sourceBounds` as described above. The provided object must have at least one of the following attributes. If only one dimension is included, then the returned image data is scaled proportionally to match the requested dimension.
* `width`
* `height`
* `colorSpace` | String - Optional. Requested color space of the returned pixels. If omitted, then the color space of the source document is used to convert colors.
* `colorProfile` | String - Optional. The name of a color profile to apply to the returned pixels. If omitted, then the resulting color profile depends on the requested color space:
* If the requested color space matches the source document, then the returned data will use the color profile of the source document.
Expand Down
23 changes: 23 additions & 0 deletions src/pages/ps_reference/media/photoshopcore.md
Expand Up @@ -270,6 +270,29 @@ var isARM = vendor === "ARM"

___

### getDisplayConfiguration
<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">23.0</span>

*Promise*<object\>

Returns the current display configuration.

Note: returned units differ by platform.
- Mac uses logical units, points.
- Windows uses physical units, pixels.

```javascript
psCore.getDisplayConfiguration( {physicalResolution: true} )
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | *object* | object Currently only one: physicalResolution. If true, then a property with that name will also appear in the return object. |

___

### getGPUInfo
<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">23.1</span>

Expand Down
2 changes: 1 addition & 1 deletion src/pages/scripting/how-it-works/index.md
Expand Up @@ -14,7 +14,7 @@ Photoshop sets an execution context while invoking a script.
Within an execution context, only one script can be executed at a time. You cannot invoke another script from the running script. Using the UXP script module, you can access `ExecutionContext`.

```js
const script = await require("uxp").script;
const { script } = require("uxp");
const executionContext = script.executionContext;
```
It provides details about the current script execution, methods to send data to Photoshop, and events to manage script lifecycles. You can also use methods belonging to `executionControl.hostControl` to suspend/resume history states and auto close documents. Read more in the scripting [reference](../reference/).
Expand Down
4 changes: 2 additions & 2 deletions src/pages/scripting/reference/index.md
Expand Up @@ -13,7 +13,7 @@ Represents the UXP module that contains the properties and methods used for scri
### Usage
---
```js
const script = await require("uxp").script;
const { script } = require("uxp");
```

### Properties
Expand All @@ -36,7 +36,7 @@ Passed by the host when invoking scripts. Contains the following:
---

```jsx
const script = await require("uxp").script;
const { script } = require("uxp");
const executionContext = script.executionContext;
console.log("isCancelled: ", executionContext.isCancelled);
```
Expand Down

0 comments on commit 705f63c

Please sign in to comment.