Create GFX
1. API Description
This API is used to create GFX.
Request mode:
- V2.6.0 and above: POST [ip]/mwapi/V2.0/gfx/create-gfx
- V2.5.0 and below: POST [ip]/mwapi/create-osd
| Administrator Rights | Logged-in | 
|---|---|
| No | Yes | 
2. Input Parameters
| Name | Required | Type | Description | 
|---|---|---|---|
| fileName | Yes | String | The file name | 
| md5 | Yes | String | The MD5 value of the file | 
| sourceType | Yes | Int | The source type. 10: GFX | 
| x | Yes | Int | The X-axis position of the content window, relative value (0~1)*1,000,000. | 
| y | Yes | Int | The Y-axis position of the content window, relative value (0~1)*1,000,000. | 
| scaleX | Yes | Int | The X-axis scaling ratio, relative value (0~1)*1,000,000. | 
| scaleY | Yes | Int | The Y-axis scaling ratio, relative value (0~1)*1,000,000. | 
| width | Yes | Int | The width of the content window, relative value (0~1)*1,000,000. | 
| height | Yes | Int | The height of the content window, relative value (0~1)*1,000,000. | 
| alpha | Yes | Int | The opacity, relative value (0~1)*1,000,000. | 
| secondaryType | Yes | Int | The GFX type. 4: Picture; 5: Text | 
| text | No | String | The text content, required for text GFX. | 
| fontFamily | No | Int | The font, required for text GFX. | 
| textColor | No | Int | The text color, required for text GFX. | 
| strokeColor | No | Int | The text stroke color, required for text GFX. | 
| strokeWidth | No | Int | The text stroke width, required for text GFX. | 
| fontSize | No | Int | The font size, required for text GFX. | 
| glyph | No | Int | The text style, required for text GFX. Binary flags: 1: Enabled; 0: Disabled Italic: 1st bit (0x1LL << 1) Underline: 2nd bit (0x1LL << 2) Bold: 3rd bit (0x1LL << 3) | 
| textAlignment | No | Int | The text alignment, required for text GFX. 0: Left; 1: Center; 2: Right | 
| fixed | Yes | Int | Whether it is a GFX template layer. 0: No; 1: Yes | 
3. Output Parameters
| Name | Type | Description | 
|---|---|---|
| status | Int | Status code | 
| message | String | Status description | 
| info | InfoData | GFX information | 
InfoData
| Name | Type | Description | 
|---|---|---|
| audioList | AudioListData | Audio configuration information in a layer | 
| bglayer | LayerData | Layer information | 
| dividerLine | DividerLineData | Separator attributes | 
| id | Int | GFX ID | 
| layerList | LayerData | Layer array | 
| name | String | Scene name | 
| sceneGfxInfo | Int | On-screen GFX information in the scene. The subparameter sceneGfxId is the GFX ID that is overlayed onto the scene | 
| template | Int | Scene combination mode 0: Picture-in-Picture; 1: Side-by-Side; 2: Single-layer | 
| type | Int | Scene type 4: Note; Other numbers: Scene | 
AudioListData
| Name | Type | Description | 
|---|---|---|
| layerId | Int | Layer ID, the layer position in the layer array | 
| muted | Int | Whether it is muted. 0: No; 1: Yes | 
| type | Int | Audio type 0x0100: HDMI 1; 0x0200: Video; 0x0300: HDMI 2; 0x0400: USB Camera; 0x0500: Picture; 0x0700: Web page | 
| volume | Int | Volume, ranging from 0 to 1000000 | 
LayerData
| Name | Type | Description | 
|---|---|---|
| alpha | Int | The alpha attribute of the layer | 
| cropWindow | WindowData | The attribute of the cropped window | 
| fixed | Int | Whether it is a GFX template layer 0: No; 1: Yes | 
| flip | Int | The flip attribute 0: No flip 1: Flip horizontally 2: Flip vertically 3: Flip horizontally and vertically | 
| frame | FrameData | The frame attribute | 
| givenBg | Int | Whether it is a note background image uploaded by the user 1: Yes; 0: No | 
| mediaProgress | Int | The playback progress of video source | 
| pdfPosition | Int | PDF location information, (page number - 1) * 100 | 
| pdfScaleMode | Int | PDF zoom mode 0: Free 1: Maintain original page ratio 2: Fit content to screen 3: Fit width to screen | 
| pdfScaleValue | Int | PDF zoom attribute, ranging from 1 to 5 * 10000 | 
| rotation | Int | Rotation angle, in the counterclockwise direction, ranging from 0 to 360 | 
| scaleX | Int | Scaling ratio on the X-axis, ranging from 0 to 1000000 | 
| scaleY | Int | Scaling ratio on the Y-axis, ranging from 0 to 1000000 | 
| sourceColor | Int | Color value of the solid-color layer, of type uint32 (GBRA) | 
| sourceDuration | Int | Length of the source video | 
| sourceHeight | Int | Height of the source frame | 
| sourceId | Int | Resource ID, the unique identifier of the resource in the device | 
| sourceThumbHeight | Int | Height of the source thumbnail | 
| sourceThumbWidth | Int | Width of the source thumbnail | 
| sourceTotalPageNumber | Int | Number of pages in the PDF file | 
| sourceType | Int | Source type 1: Picture; 2: Video; 3: HDMI 1; 4: HDMI 2; 5: USB-Camera; 6: Audio; 7: Background image | 
| sourceWidth | Int | Width of the source scene | 
| srcWindow | WindowData | Content window properties | 
| url | String | Web page address | 
| videoPolicy | Int | Video end policy 0: Show last frame 1: Repeat video 2: Switch to scene X 3: Show first frame 4: Go to black 5: Hide video | 
| videoPolicyIn | Int | Video start policy 0: Auto start; 1: Manual start | 
| videoPolicyNextScene | Int | When the video end policy is to switch to scene X, it refers to the ID of the target scene | 
| videoPolicyOut | Int | When the video is switched out before it ends and then switched back, how the video will continue 0: Keeps the progress where you left off 1: Rewinds to the start of video | 
| videoRangeEnd | Int | Video cutting start position, in ms | 
| videoRangeStart | Int | Video cutting end position, in ms | 
| webScaleValue | Int | Web page zoom attribute, with a value range from 1 to 5 * 10000 | 
| window | WindowData | Window properties | 
WindowData
| Name | Type | Description | 
|---|---|---|
| x | Int | X-axis position, relative value (0~1)×1,000,000 | 
| y | Int | Y-axis position, relative value (0~1)×1,000,000 | 
| width | Int | Window width | 
| height | Int | Window height | 
| type | Int | Cropping type 0: Free 1: Original 2: 4:3 3: 16:9 4: 1:1 | 
FrameData
| Name | Type | Description | 
|---|---|---|
| color | Int | Frame color, of type uint32 (GBRA) | 
| width | Int | Frame width, in px | 
DividerLineData
| Name | Type | Description | 
|---|---|---|
| color | Int | Separator color, of type uint32 (GBRA) | 
| x1 | Int | X-axis position of the vertex of the separator, relative value (0 - 1) * 1,000,000 | 
| y1 | Int | Y-axis position of the vertex of the separator, relative value (0 - 1) * 1,000,000 | 
| x2 | Int | X-axis position of the end point of the separator, relative value (0 - 1) * 1,000,000 | 
| y2 | Int | Y-axis position of the end point of the separator, relative value (0 - 1) * 1,000,000 | 
4. Example
Creating a GFX with picture and text.
Input Example
{
    "layerList":[
        {
            "fileName":"image.png",
            "md5":"01b0f9f65ac74dafa1efd6804e69d743",
            "sourceType":10,
            "x":70313,
            "y":186111,
            "scaleX":1030000,
            "scaleY":1030000,
            "width":303646,
            "height":795370,
            "alpha":1000000,
            "secondaryType":4,
            "text":"",
            "fontFamily":"sans-serif",
            "textColor":0,
            "strokeColor":0,
            "strokeWidth":0,
            "fontSize":14,
            "glyph":0,
            "textAlignment":0,
            "fixed":0
        },
        {
            "fileName":"20230113095607876",
            "md5":"3f050a3c836cd50f16cbfbcd50d12551",
            "sourceType":10,
            "x":371875,
            "y":856481,
            "scaleX":1000000,
            "scaleY":1000000,
            "width":269271,
            "height":77778,
            "alpha":1000000,
            "secondaryType":5,
            "text":"Input text here",
            "fontFamily":"sans-serif",
            "textColor":0,
            "strokeColor":0,
            "strokeWidth":0,
            "fontSize":26,
            "glyph":14,
            "textAlignment":0,
            "fixed":0
        }
    ]
}
Output Example
{
    "info":{
        "audioList":[
        ],
        "bgLayer":{
            "alpha":1000000,
            "cropWindow":{
                "height":1000000,
                "type":0,
                "width":1000000,
                "x":0,
                "y":0
            },
            "fixed":0,
            "flip":0,
            "frame":{
                "color":0,
                "width":0
            },
            "givenBg":0,
            "mediaProgress":0,
            "pdfPosition":0,
            "pdfScaleMode":3,
            "pdfScaleValue":10000,
            "rotation":0,
            "scaleX":1000000,
            "scaleY":1000000,
            "sourceColor":255,
            "sourceDuration":0,
            "sourceHeight":0,
            "sourceId":0,
            "sourceThumbHeight":0,
            "sourceThumbWidth":0,
            "sourceTotalPageNumber":0,
            "sourceType":12,
            "sourceWidth":0,
            "srcWindow":{
                "height":1000000,
                "width":1000000,
                "x":0,
                "y":0
            },
            "videoPolicy":0,
            "videoPolicyIn":0,
            "videoPolicyNextScene":0,
            "videoPolicyOut":0,
            "videoRangeEnd":0,
            "videoRangeStart":0,
            "webScaleValue":10000,
            "window":{
                "height":1000000,
                "width":1000000,
                "x":0,
                "y":0
            }
        },
        "dividerLine":{
            "color":0,
            "width":0,
            "x1":500000,
            "x2":500000,
            "y1":0,
            "y2":1000000
        },
        "id":108,
        "layerList":[
            {
                "alpha":1000000,
                "cropWindow":{
                    "height":1000000,
                    "type":1,
                    "width":1000000,
                    "x":0,
                    "y":0
                },
                "fixed":0,
                "flip":0,
                "frame":{
                    "color":16777215,
                    "width":0
                },
                "givenBg":0,
                "mediaProgress":0,
                "pdfPosition":0,
                "pdfScaleMode":3,
                "pdfScaleValue":10000,
                "rotation":360,
                "scaleX":1030000,
                "scaleY":1030000,
                "sourceColor":255,
                "sourceDuration":0,
                "sourceHeight":292,
                "sourceId":2029,
                "sourceThumbHeight":377,
                "sourceThumbWidth":256,
                "sourceTotalPageNumber":0,
                "sourceType":10,
                "sourceWidth":198,
                "srcWindow":{
                    "height":1000000,
                    "width":1000000,
                    "x":0,
                    "y":0
                },
                "videoPolicy":0,
                "videoPolicyIn":0,
                "videoPolicyNextScene":0,
                "videoPolicyOut":0,
                "videoRangeEnd":0,
                "videoRangeStart":0,
                "webScaleValue":10000,
                "window":{
                    "height":795370,
                    "width":303646,
                    "x":348438,
                    "y":100926
                }
            },
            {
                "alpha":1000000,
                "cropWindow":{
                    "height":1000000,
                    "type":1,
                    "width":1000000,
                    "x":0,
                    "y":0
                },
                "fixed":0,
                "flip":0,
                "frame":{
                    "color":16777215,
                    "width":0
                },
                "givenBg":0,
                "mediaProgress":0,
                "pdfPosition":0,
                "pdfScaleMode":3,
                "pdfScaleValue":10000,
                "rotation":360,
                "scaleX":1000000,
                "scaleY":1000000,
                "sourceColor":255,
                "sourceDuration":0,
                "sourceHeight":85,
                "sourceId":2033,
                "sourceThumbHeight":46,
                "sourceThumbWidth":256,
                "sourceTotalPageNumber":0,
                "sourceType":10,
                "sourceWidth":472,
                "srcWindow":{
                    "height":1000000,
                    "width":1000000,
                    "x":0,
                    "y":0
                },
                "videoPolicy":0,
                "videoPolicyIn":0,
                "videoPolicyNextScene":0,
                "videoPolicyOut":0,
                "videoRangeEnd":0,
                "videoRangeStart":0,
                "webScaleValue":10000,
                "window":{
                    "height":77778,
                    "width":232292,
                    "x":630729,
                    "y":811111
                }
            }
        ],
        "name":"",
        "template":2,
        "type":5
    },
    "message":"success",
    "status":0
}
5. Error Code
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Status | Definition | Description | 
|---|---|---|
| 7 | MW_STATUS_INVALID_ARG | Missing required parameters | 
| 39 | MW_STATUS_MISMATCH | The BGM does not exist |