RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice...

29
RVU Version 2.0 Protocol Specification RVU Alliance CONFIDENTIAL V2.0 Rev 1.1 DRAFT February 2014

Transcript of RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice...

Page 1: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVUVersion 2.0 Protocol Specification

RVU AllianceCONFIDENTIAL

V2.0 Rev 1.1 DRAFTFebruary 2014

Page 2: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol Revision History

Intellectual Property Notice

Use of the information contained herein shall be governed solely by the terms and conditions of the RVU Alliance IPR Policy. Thedocument and information contained herein is not a license, either expressly or impliedly, to any intellectual property owned orcontrolled by any of the authors or developers of this specification. The information contained herein is provided on an “AS IS” basis,and to the maximum extent permitted by applicable law, the authors and developers of this specification hereby disclaim all otherwarranties and conditions, either express, implied or statutory, including but not limited to, any (if any) implied warranties, duties orconditions of merchantability, of fitness for a particular purpose, of accuracy or completeness of responses, of results, ofworkmanlike effort, of lack of viruses, of lack of negligence. ALSO THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIETENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT.

RVU is a registered trademark of the RVU Alliance. All rights reserved.

Copyright 2014 © RVU Alliance.

2 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Revision History

Revision Description Date

V2.0 Rev 1.0

DRAFT

Initial Document 2012-10-18

V2.0 Rev 1.0

FINAL

Board of Directors approved 2012-12-20

V2.0 Rev 1.1DRAFT

Draft for Board of Directors approval and member IP review 2014-02-20

Page 3: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol Table of Contents

3 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Table of Contents

1 Introduction ............................................................................................................................................ 6

2 References............................................................................................................................................. 6

3 Compatibility with RVU Version 1.0 ....................................................................................................... 6

4 Client Memory Requirements ................................................................................................................ 6

5 RVU Canvas 2D Functionality ............................................................................................................... 7

5.1 Summary of New RVU Commands ................................................................................................. 7

5.2 Object Allocation and Deletion......................................................................................................... 7

5.2.1 AllocateCanvas Command details .......................................................................................... 8

5.2.2 DeleteObject Command Details .............................................................................................. 9

5.3 ObjectMethodInvokeCommand Details ......................................................................................... 11

5.4 ObjectAttributeSetCommand Details ............................................................................................. 14

5.5 ObjectAttributeGet Command Details............................................................................................ 16

5.6 Additional Requirements for Specific Canvas 2D Context Methods.............................................. 18

5.6.1 Unmanaged Objects.............................................................................................................. 18

5.7 Fonts .............................................................................................................................................. 19

5.7.1 SendFont ............................................................................................................................... 19

5.8 HTML5 Web IDL Types.................................................................................................................. 20

5.8.1 Mapping of HTML5 Web IDL Types...................................................................................... 21

5.9 Limitations of RVU 1.0 Graphics Boundary Clipping for Canvas Context 2D................................ 22

5.10 Canvas2D Context Transformation, Transparency and Compositing Impact on RVU Version 1.0Commands..................................................................................................................................... 24

5.11 Canvas2D Methods/Attributes and RVU Version 1.0 Blitqueue .................................................... 26

5.12 Additional Examples....................................................................................................................... 26

5.12.1 Example of creating an RVU Canvas Object and drawing a rectangle................................. 26

5.12.2 Example Setting the Canvas2D globalCompositeOperation attribute .................................. 27

5.12.3 Example mapping of four Canvas path methods to their equivalent RVU commands: ........ 28

5.12.4 Example of using HTMLCanvasElement in drawImage........................................................ 28

Page 4: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Figures

4 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

List of Figures

Figure 5-1: Example Output of Drawing Square Outside the Graphics Boundaries ..................................23

Figure 5-2: Example Output of Rotating Outside the Graphics Boundaries ...............................................24

Figure 5-3: Example Output of Mixed RVU Commands .............................................................................26

Page 5: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

5 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

List of Tables

Table 1: Summary of Commands for Enabling the Canvas2DContext ........................................................ 7

Table 2: AllocateCanvas command attributes .............................................................................................. 8

Table 3: AllocateCanvas command attributes .............................................................................................. 8

Table 4: AllocateCanvas response attributes ............................................................................................... 9

Table 5: AllocateCanvas response error codes............................................................................................ 9

Table 6: DeleteObject command attributes.................................................................................................10

Table 7: DeleteObject response attributes..................................................................................................10

Table 8: DeleteObject response error codes ..............................................................................................10

Table 9: ObjectMethodinvoke command attributes for invoking canvas methods......................................12

Table 10: ObjectMethodInvoke response attributes for invoking canvas methods ....................................13

Table 11: ObjectMethodInvokeresponse error codes.................................................................................13

Table 12: ObjectAttributeSet command attributes for setting object attributes..........................................15

Table 13: ObjectAttributeSet response attributes for setting object attributes............................................16

Table 14: ObjectAttributeSet response error codes....................................................................................16

Table 15: ObjectAttributeGetcommand attributes for getting object attributes ...........................................16

Table 16: ObjectAttributeGetresponse attributes for getting object attributes ............................................17

Table 17: ObjectAttributeGet response error codes ...................................................................................17

Table 18. Client Response to Unmanaged Object Attributes ....................................................................18

Table 19. measureText() Method Response Attributes .............................................................................19

Table 20: SendFont command attributes....................................................................................................20

Table 21: SendFont response attributes.....................................................................................................20

Table 22: SendFont response error codes .................................................................................................20

Table 23: Mapping of HTML5 Web IDL Types to RVU Types ...................................................................22

Page 6: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

6 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

1 Introduction

This document specifies advanced functionality supplemental to the RVU version 1.0specification. The convention for requirement description in this document follows that of theRVU version 1.0 protocol specification.

2 References

Ref Document Title Version Date

Ref1 RVU Protocol Specification Version 1.0 Revision 1.5.1 1.0, Revision1.5.1 and higher

February2014

Ref2 HTML Canvas 2D Context W3C Working Draft 29 March 2012 ,http://www.w3.org/TR/2012/WD-2dcontext-20120329/

29 March2012

Ref3 WOFF File Format 1.0 W3C Candidate Recommendationhttp://www.w3.org/TR/2011/CR-WOFF-20110804/

August 4,2012

Ref4 ECMA-262 5th

Edition

ECMAScript Language Spec

http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf

September19, 2012

3 Compatibility with RVU Version 1.0

[3-1]M: RVU-S, RVU-CRVU elements compliant with this specification shall be fully compliant with RVU 1.0 protocolspecification [Ref 1].

[3-2]M: RVU-S, RVU-CAn RVU 2.0 element operating in a mixed network of RVU 1.0 and RVU 2.0 elements shallinteroperate with RVU 1.0 elements in compliance with the RVU 1.0 specification.

[3-3]M: RVU-SWithin a mixed network of RVU 1.0 and RVU 2.0 elements, an RVU 2.0 server shallinteroperate with RVU 1.0 clients in compliance with the RVU 1.0 specification and with RVU2.0 clients in compliance with requirements in this document

[3-4] M: RVU-CWithin a mixed network of RVU 1.0 and RVU 2.0 elements, an RVU 2.0 client shall interoperatewith RVU 1.0 servers in compliance with the RVU 1.0 specification and with RVU 2.0 servers incompliance with requirements in this document

[3-5]M: RVU-S, RVU-CRVU 2.0 elements in a mixed network shall not cause RVU 1.0 element performance or featuredegradation

4 Client Memory Requirements

The RVU 2.0 client shall allocate a minimum 64 Mbytes of graphic buffer memory.

Page 7: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

7 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

5 RVU Canvas 2D Functionality

This section specifies how HTML5 Web IDL interfaces such as the Canvas 2D Context are usedwithin the RVU command/data protocol. Canvas 2D provides additional graphics functionalitysuch as rectangle, line and arc and curve drawing tools, rendering of fonts, and scaling, rotationand translation of these rendering operations.

With the exception of the unimplemented methods listed in section Error! Reference sourcenot found.5.6, all Canvas2D Context methods, attributes and objects shall remain compliantwith the semantics and processes of the HTML5 Canvas 2D Context specification and theInterface Definition Language (IDL) as described in [Ref2].

5.1 Summary of New RVU Commands

The specifics of the sending, processing, and responses for each command are detailed infollowing sections.

Command Description

AllocateCanvas Allocates an RVU Canvas 2D Context Object and assignsallocated object to an RVU graphics buffer

DeleteObject Destroys/de-allocates an allocated object

ObjectMethodInvoke Invoke an object method

ObjectAttributeSet Set an object attribute

ObjectAttributeGet Get an object attribute

SendFont Downloads font data in a WOFF format to a client

Table 1: Summary of Commands for Enabling the Canvas2DContext

5.2 Object Allocation and Deletion

HTML5 Web IDL canvas interfaces (CanvasRenderingContext2D or WebGL) are typicallyimplemented with JavaScript objects. This section specifies RVU object allocation of HTML 5Web IDL interfaces and invocation of operations on these objects. Object lifetime is managedby the endpoint that allocates the object. The endpoint that allocated an object implements theoperations on the interface of that object.

References to RVU objects are passed via a uint value, termed the objectId. When the object isreferenced in an RVU command, there will be an RVU command attribute name of “objectId”with a value being the uint value of the object. An object is in use if it is referenced by either theRVU server or by another object.

[5.2-1] M: RVU-C

A newly allocated RVU objectId must be unique among the set of all currently active objectIdvalues in an RVU session.

Page 8: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

8 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

[5.2-2] M: RVU-C

An RVU client shall be capable of processing and managing a minimum of 128 allocatedobjects.

[5.2-3]M: RVU-C

An RVU version 2.0 client shall respond to the GetMemInfo command by returning the followingattribute information in addition to the requirements of [Ref1] Table 4-17 in section 4.8.2.1.3-2

RVU Attribute Description Type

maxObjectAllocations Maximum number of RVU 2.0 objects that can be allocated uint

curObjectAllocation Current number of allocated RVU 2.0 objects uint

Table 2: AllocateCanvas command attributes

[5.2-4]M: RVU-C

An RVU client shall exclude deleted objects from the number of currently allocated objects.

5.2.1 AllocateCanvas Command details

The AllocateCanvas command is used to allocate an RVU Canvas 2D Context object. Theobject must be assigned to an RVU graphics buffer upon allocation.

[5.2.1-1] M: RVU-S

An RVU server shall have the ability to send the AllocateCanvas command as described in thefollowing table.

RVU Attribute Description Type

commandToken A unique ID representing this command. uint

bufId The RVU graphics buffer to which the allocated RVU Canvas2D Context object is associated

uint

Table 3: AllocateCanvas command attributes

[5.2.1-2] M: RVU-CAn RVU client shall process the AllocateCanvas command by creating a RVU Canvas 2DContext object and associate it to the specified RVU graphics buffer.

[5.2.1-3] M: RVU-CIf the specified RVU graphics buffer is already assigned to another RVU Canvas 2D Contextobject, then the RVU client shall return the error ERR_BUFFER_ALREADY_ASSIGNED andnot create the RVU Canvas 2D Context object.

Page 9: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

9 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

[5.2.1-4] M: RVU-C

If a DeallocateBuffer command is issued for a RVU graphics buffer that is assigned to a RVUCanvas 2D Context object, the RVU client shall return the error ERR_BUFFER_IN_USE (hereinappended to Table 4-34 in [Ref1] for RVU 2.0 clients) and shall not deallocate the RVU graphicsbuffer.

[5.2.1-5] M: RVU-CAn RVU client shall respond to the AllocateCanvas command by returning the samecommandToken, appropriate errCode, and an objectId that will be used to reference the RVUCanvas 2D Context object as described in the following tables.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

errCode See error code table below. string

returnType Always an object in response to AllocateCanvas command string withvalue=”object”

returnValue objectID uint

Table 4: AllocateCanvas response attributes

Error Codes

Error Code Description

ERR_SUCCESS The operation succeeded.

ERR_FAIL The object could not be created.

ERR_BUFFER_ALREADY_ASSIGNED The buffer has already been assigned to another RVUCanvas 2D Context object.

Table 5: AllocateCanvas response error codes

An example of allocating an RVU Canvas 2D Context object is as follows:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

5.2.2 DeleteObject Command Details

The DeleteObject command destroys a previously allocated object.

[5.2.2-1] M: RVU-SAn RVU server shall have the ability to send the DeleteObject command as described in thefollowing table.

Page 10: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

10 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

RVU Attribute Description Type

commandToken A unique ID representing this command. uint

objectId The object to release. uint

Table 6: DeleteObject command attributes

[5.2.2-2] M: RVU-CAn RVU client shall respond to the DeleteObject command by returning the commandTokenand appropriate errCode, as described in the following tables.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

errCode See error code table below. string

Table 7: DeleteObject response attributes

Error Codes

Error Code Description

ERR_SUCCESS The operation succeeded.

ERR_BAD_ID The objectId is not allocated, is already deleted, or has a nullreference count.

Table 8: DeleteObject response error codes

The following is an example of deallocating/destroying a previously allocated RVUCanvasRendering2DContext Object:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<DeleteObjectcommandToken="3"objectId="45"/>

<Response commandToken="3"errCode="ERR_SUCCESS"/>

[5.2.2-3] M: RVU-SAn RVU server shall send the DeleteObject command to notify the RVU client that thereferenced object is not in use by the server.

[5.2.2-4] M: RVU-CAn RVU client shall only delete an object once it is not in use. Deleting an object will remove itfrom the count of currently allocated objects.

An object is still in use if it is referenced by some other object. The following is an example of aLinearGradient object being referenced by a CanvasRendering2DContext object as its fillStyle:

Page 11: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

11 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectMethodInvokecommandName="createLinearGradient"commandToken="3"objectId="45"idl:x0="5"idl:y0="5"idl:x1="50"idl:y1="50"/>

<Response commandToken="3"errCode="ERR_SUCCESS"returnType="object"returnValue="46"/>

<ObjectAttributeSetcommandToken="4"objectId="45"idlType:fillStyle="object"idl:fillStyle="46"/>

<Response commandToken="4"errCode="ERR_SUCCESS"/>

[5.2.2-5] M: RVU-C

An RVU client shall return ERR_BAD_ID in the event that a server references an object incommand operations that has previously been referenced in a DeleteObject command

5.3 ObjectMethodInvoke Command Details

The ObjectMethodInvoke command is used to invoke methods on an allocated object.

[5.3-1] M: RVU-S

An RVU server shall invoke a Canvas 2D Context method using the ObjectMethodInvokecommand as shown in the following table:

RVU Attribute Description Type

commandToken A unique ID representing this command. uint

commandName Name of the object method string

objectID object Id returned from the allocated object uint

idlType: This RVU attribute only to be used for object parameters that canbe of multiple types.

This RVU attribute name is constructed as “idlType” followed bythe IDL parameter name. See examples.

The value of this RVU attribute specifies the IDL type of theassociated “idl:” RVU attribute.

string

One of theHTML5 WebIDL Types ofTable 23.

Page 12: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

12 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

RVU Attribute Description Type

idl: This RVU attribute name is constructed as “idl:” followed by theIDL parameter name. See examples.

The value of this RVU attribute specifies the value of the IDLparameter.

Optional method parameters are optional RVU commandattributes

varies

Table 9: ObjectMethodinvoke command attributes for invoking canvas methods

Example:

Calling the Canvas 2D Context fillRect method:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectMethodInvokecommandToken="3"commandName="fillRect"objectId="45"idl:x="5"idl:y="5"idl:w="200"idl:h="100"/>

<Response commandToken="3"errCode="ERR_SUCCESS"/>

Example:

Calling the Canvas 2D Context createPattern method:

<AllocateBuffercommandToken="1" width="800” height="450" pixelFormat="ARGB-32"/>

<Response commandToken="1" errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS" returnType="object"returnValue="45"/>

<ObjectMethodInvoke commandToken="3" commandName="createPattern" objectId="45"idlType:image="HTMLCanvasElement" idl:image="100" idl:repetition="repeat"/>

<Response commandToken="3" errCode="ERR_SUCCESS" returnType="object"returnValue="46"/>

[5.3-2] M: RVU-CAn RVU client shall process the ObjectMethodInvoke command in accordance with the HTML5object’s specification of the method that is contained within the RVU commandName attribute.

[5.3-3] M: RVU-CAn RVU client shall respond to the ObjectMethodInvoke command by returning thecommandToken, appropriate errCode, attributes and attribute values as described in thefollowing tables.

Page 13: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

13 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

errCode See error code table below. string

idl:Exception –present if errCodeindicates exception

If errCode=ERR_IDL_EXCEPTION, then the value of thisattribute shall be a description of the Exception thrown.

string

returnType -present if Canvasmethod returns avalue

One of the HTML5 Web IDL Types of Table 23 string with valuethat is one of theHTML5 Web IDLTypes of Table23.

returnValue –present if Canvasmethod returns avalue

Value of the return value formatted as an RVU type thatmatches the IDL type, as defined in Table 23

varies peridlType in aboverow

Table 10: ObjectMethodInvoke response attributes for invoking canvas methods

Error Codes

Error Code Description

ERR_SUCCESS The operation succeeded.

ERR_FAIL The operation could not be performed.

ERR_BAD_ID The objectID is not allocated, is already deleted, or has a nullreference count

ERR_IDL_EXCEPTION The operation could not be performed. An idl:Exception attribute isreturned

Table 11: ObjectMethodInvokeresponse error codes

Success example:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectMethodInvokecommandToken="3"commandName="beginPath"objectId="45"/>

<Response commandToken="3"errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="4"commandName="moveTo"objectId="45"idl:x="50"idl:y="50"/>

<Response commandToken="4"errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="5"commandName="lineTo"objectId="45"idl:x="100"idl:y="50"/>

<Response commandToken="5"errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="6"commandName="lineTo"objectId="45"idl:x="100"idl:y="100"/>

<Response commandToken="6"errCode="ERR_SUCCESS"/>

Page 14: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

14 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

<ObjectMethodInvokecommandToken="7"commandName="lineTo"objectId="45"idl:x="50"idl:y="100"/>

<Response commandToken="7"errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="8"commandName="closePath"objectId="45"/>

<Response commandToken="8"errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="9"commandName="isPointInPath"commandToken="9"objectId="45"idl:x="75"idl:y="75" />

<ResponsecommandToken="9"errCode="ERR_SUCCESS"returnType="boolean"returnValue="true"/>

Failure example:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1" errCode="ERR_SUCCESS" bufId="100"/>

<AllocateCanvascommandToken="2" bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS" returnType="object" returnValue="45"/>

<ObjectMethodInvokecommandToken="3" commandName="beginPath" objectId="45"/>

<Response commandToken="3"errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="4" commandName="moveTo" objectId="45" idl:x="170"idl:y="80"/>

<Response commandToken="4" errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="5" commandName="arcTo" objectId="45" idl:x1="250"idl:y1="50" idl:x2="200" idl:y2="30" idl:radius="-20"/>

<Response commandToken="5" errCode="ERR_IDL_EXCEPTION" idl:Exception="IndexSizeError:Index or size is negative or greater than the allowed amount"/>

5.4 ObjectAttributeSet Command Details

The ObjectAttributeSet command is used to set object attributes.

[5.4-1] M: RVU-S

An RVU server shall set an object’s attribute using the ObjectAttributeSet command as shown inthe following table:

RVU Attribute Description Type

commandToken A unique ID representing this command. uint

objectID objectId returned from the allocated Canvas 2D Contextobject

uint

Page 15: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

15 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

RVU Attribute Description Type

idlType: This RVU attribute only to be used for object attributes thatcan be of multiple types.

This RVU attribute name is constructed as “idlType”followed by the IDL attribute name. See examples.

The value of this RVU attribute specifies the IDL type of theassociated “idl:” RVU attribute.

string with valuethat is one of theHTML5 Web IDLTypes of Table23.Table 23

idl: This RVU attribute name is constructed as “idl:” followed bythe IDL attribute name. See examples.

The value of this RVU attribute specifies the value to setthe object attribute.

varies peridlType in aboverow

Table 12: ObjectAttributeSet command attributes for setting object attributes

The following is an example of setting the Canvas Rendering Context 2D object’s globalAlphaattribute and strokeStyle attribute:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS"bufId="100"/>

<AllocateCanvascommandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS" returnType="object"returnValue="45"/>

<ObjectAttributeSetcommandToken="3" objectId="45" idlType:globalAlpha="double"idl:globalAlpha=".8"/>

<Response commandToken="3" errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="4" commandName="createLinearGradient" objectId="45"idl:x0="5" idl:y0="5" idl:x1="50" idl:y1="50"/>

<Response commandToken="4" errCode="ERR_SUCCESS" returnType="object"returnValue="46"/>

<ObjectAttributeSetcommandToken="5" objectId="45" idlType:strokeStyle="object"idl:strokeStyle="46"/>

<Response commandToken="5" errCode="ERR_SUCCESS"/>

[5.4-2] M: RVU-CAn RVU client shall process the ObjectAttributeSet command in accordance with the HTML5object’s specification regarding the attribute that is contained within the RVU attributeName.

[5.4-3] M: RVU-CAn RVU client shall respond to the ObjectAttributeSet command for setting an attribute byreturning the commandToken and appropriate errCode as described in the following tables.

Page 16: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

16 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

errCode See error code table below. string

Table 13: ObjectAttributeSet response attributes for setting object attributes

Error Codes

Error Code Description

ERR_SUCCESS The operation succeeded.

ERR_FAIL The operation could not be performed.

ERR_BAD_ID The objectID is not allocated, is already deleted, or has a nullreference count

Table 14: ObjectAttributeSet response error codes

5.5 ObjectAttributeGet Command Details

The ObjectAttributeGet command is used to get object attributes.

[5.5-1] M: RVU-S

An RVU server shall get a Canvas Attribute using the ObjectAttributeGet command as shown inthe following table:

RVU Attribute Description Type

commandToken A unique ID representing this command. uint

objectID Object Id returned from the allocated Canvas 2D Contextobject

uint

attributeName Canvas 2D Context attribute name string

Table 15: ObjectAttributeGetcommand attributes for getting object attributes

[5.5-2] M: RVU-CAn RVU client shall respond to the ObjectAttributeGet command for getting a Canvas 2DContext attribute by returning the commandToken and appropriate errCode as described in thefollowing tables.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

Page 17: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

17 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

RVU Attribute Description Type

idlType: This RVU attribute only to be used for object attributes thatcan be of multiple types.

This RVU attribute name is constructed as “idlType” followedby the IDL attribute name. See examples.

The value of this RVU attribute specifies the IDL type of theassociated “idl:” RVU attribute.

string with valuethat is one of theHTML5 Web IDLTypes of Table23

idl: This RVU attribute name is constructed as “idl:” followed bythe IDL attribute name. See examples.

The value of this RVU attribute specifies the value of theobject’s attribute.

varies peridlType in aboverow

errCode See error code table below. string

Table 16: ObjectAttributeGetresponse attributes for getting object attributes

Error Codes

Error Code Description

ERR_SUCCESS The operation succeeded.

ERR_FAIL The operation could not be performed.

ERR_BAD_ID The objectId is not allocated, is already deleted, or has a nullreference count

Table 17: ObjectAttributeGet response error codes

An example of getting the Canvas Rendering Context 2D object’s globalAlpha attribute:

<AllocateBuffercommandToken="1" width="800" height="450"/>

<Response commandToken="1" errCode="ERR_SUCCESS" bufId="100"/>

<AllocateCanvascommandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS" returnType="object"returnValue="45"/>

<ObjectAttributeGet commandToken="3" objectId="45" attributeName="globalAlpha"/>

<Response commandToken="3" errCode="ERR_SUCCESS" idlType:globalAlpha="double"idl:globalAlpha=".8"/>

<ObjectAttributeGet commandToken="4" objectId="45" attributeName="strokeStyle"/>

<Response commandToken="4" errCode="ERR_SUCCESS" idlType:strokeStyle="object"idl:strokeStyle="46"/>

Page 18: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

18 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

5.6 Additional Requirements for Specific Canvas 2D Context Methods

[5.6-1] M: RVU-C

An RVU client shall be capable of saving a minimum of 128 Canvas 2D Context save() methodstates stored on a stack.

[5.6-2] M: RVU-C

An RVU client shall be capable of supporting a minimum of 512subpaths using the Canvas 2DContext beginPath() method.

The following Canvas 2D Context methods are not implemented in RVU:

drawSystemFocusRing drawCustomFocusRing scrollPathIntoView getImageData putImageData

5.6.1 Unmanaged Objects

Unmanaged objects do not affect the managed interaction and referencing of other objects inuse. The following Canvas 2D Context methods create unmanaged objects:

measureText

[5.6.1-1] M: RVU-C

In response to methods that create unmanaged objects and in accordance with Table 18, theclient shall return a pair of RVU command response attributes constructed as “idlType:<attributename>” and “idl:<attribute name>” for each IDL attribute carried within the unmanaged object.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

errCode See error code Table 11 string

returnType Unmanaged object object

idlType: This RVU attribute name is constructed as “idlType:” followedby the IDL attribute name. See example.

Type of the unmanaged object’s attribute value.

string

idl: This RVU attribute name is constructed as “idl:” followed bythe IDL attribute name. See example.

Value of the unmanaged object’s attribute.

Per idlType inabove row

Repeat idLType: and idl: attributes as needed

Table 18. Client Response to Unmanaged Object Attributes

Page 19: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

19 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

As an example, the measureText() method creates an object with a width attribute:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1"errCode="ERR_SUCCESS" bufId="100"/>

<AllocateCanvas commandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS" returnType="object" returnValue="45"/>

<ObjectMethodInvoke commandName="measureText" commandToken="3" objectId="45"idl:text="Hello World!"/>

<Response commandToken="3" errCode="ERR_SUCCESS" returnType="object"idlType:width="double" idl:width="50"/>

Table 19 shows client RVU command response attributes to invocation of the measureText()method.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command. uint

errCode See error code Table 11 string

returnType Unmanaged object object

idlType:width Type of the unmanaged object’s width attribute value string

idl:width Value of the unmanaged object’s width attribute double

Table 19. measureText() Method Response Attributes

5.7 Fonts

5.7.1 SendFont

The SendFont command will send Font data in the WOFF 1.0 format specified by the W3C forHTML5:http://www.w3.org/TR/2011/CR-WOFF-20110804/ [Ref3].

The data will be transmitted on a specified RVU data channel as a new data type:FontDataWOFF. The command will also give a name to the font face. This name will be usedin the font attribute to refer to this font face. The Font is represented as an object and is subjectto the rules of object deletion via the DeleteObject command.

[5.7.1-1] M: RVU-SAn RVU server shall have the ability to send the SendFont command as described in thefollowing table.

Attribute Description Type

commandToken A unique ID representing this command. uint

channelId The channel ID of the data channel on which the content willbe sent.

uint

fontFamily The font family name of the font being transferred string

Page 20: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

20 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Table 20: SendFont command attributes

[5.7.1-2] M: RVU-S, RVU-CThe FontDataWOFF data shall consist of only the WOFF 1.0 compliant font file. A WOFF 1.0font file is a container for sfnt (spline font) font file formats.

[5.7.1-3] M: RVU-CAn RVU client shall process the SendFont command by storing the font data on the specifieddata channel and referring to it via the specified fontFamily value.

[5.7.1-4] M: RVU-CAn RVU client shall respond to the SendFont command by returning the commandToken, anobjectId value to reference the font and an appropriate errCode, as described in the followingtables.

RVU Attribute Description Type

commandToken The same commandToken ID sent in the command uint

errCode See error code table below string

objectId Object ID returned from the font object uint

Table 21: SendFont response attributes

Error Codes

Error Code Description

ERR_SUCCESS The operation succeeded.

ERR_FONT_FAMILY_IN_USE The specified fontFamily value is already in use.

ERR_FAIL The operation could not be performed.

Table 22: SendFont response error codes

5.8 HTML5 Web IDL Types

New types will be added to the RVU specification to account for the following HTML5 Web IDLtypes:

o boolean – a string with the value of either “true” or “false”.

o int64 – This is the same as a int type except the range is extended to a full 64 bitsigned value of −9223372036854775808to 9223372036854775807

o uint64 – This is the same as the uint type except the range is extended to a full64 bit signed value of 0 to 18446744073709551615

Page 21: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

21 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

5.8.1 Mapping of HTML5 Web IDL Types

The following table details how to map HTML5 Web IDL Types to RVU types. The HTML5 WebIDL Types are used as values when specifying an RVU Type command attribute. The value ofthe RVU Type command attribute is the name as defined in Table 23Table 22below.

HTML5 Web IDL Type RVU Type Comments

any varies Abstraction of any HTML5 WebIDL Type,determined based on usage.

boolean boolean

byte int

octet uint

short int

unsigned short uint

long Int

unsigned long uint

long long int64

unsigned long long uint64

float string The string must be formatted as input to theECMAScriptparseFloat function. See ref 4.

unrestricted float string The string must be formatted as input to theECMAScriptparseFloat function. See ref 4.

double string The string must be formatted as input to theECMAScriptparseFloat function. See ref 4.

unrestricted double string The string must be formatted as input to theECMAScriptparseFloat function. See ref 4.

DOMString UTF-8 string

object uint Used to reference any managed object.

Enumeration Types N/A Not used in Canvas or WebGL

Sequences N/A Not used in Canvas. Could be passed in the RVUcommand, possibly as a list of comma separatedvalues.

Arrays N/A Not used in Canvas. Could be passed as a buffervia the Data Channel.

UnionType N/A Not used in Canvas or WebGL

Date N/A Not used in Canvas or WebGL

HTMLCanvasElement uint In the HTML5 Canvas 2D Rendering Contextspecification, references to theHTMLCanvasElement will be treated as referencesto the underlying RVU 1 graphics buffer associatedto the Canvas Object. For example, when retrievingthe value of the “canvas” read only attribute of aCanvas object, the ID value of the graphics bufferassociated to the Canvas object is returned. Whenpassing a parameter to the createPattern ordrawImage methods, the idlType has a value of“object” and the idl value is the graphics buffer ID.

Page 22: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

22 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Table 23: Mapping of HTML5 Web IDL Types to RVU Types

5.9 Limitations of RVU 1.0 Graphics Boundary Clipping for Canvas Context 2D

RVU Canvas Context 2D commands are not constrained to the boundaries defined by thegraphics buffer dimensions. For example, when a server commands drawing a rectangle wherea portion is outside of the graphics buffer boundaries, a client cannot produce an error coderesponse attribute with a value of ERR_BOUNDING as can be returned with RVU version 1.0write, read and blit commands.

[5.9-1] M: RVU-CAn RVU client shall process all Canvas 2D Context commands for drawing graphics outside thegraphics buffer dimensions.

The following example demonstrates drawing a square at a negative offset outside of thegraphics buffer bounds to render only a rectangular portion of the square.

RVU:

<AllocateBuffercommandToken="1" width="400” height="400"/>

<Response commandToken="1"bufId="100"errCode="ERR_SUCCESS"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectMethodInvokecommandToken="3"commandName="fillRect"objectId="45"idl:x="-100"idl:y="-50"idl:w="200"idl:h="200"/>

Page 23: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

23 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Figure 5-1: Example Output of Drawing Square Outside the Graphics Boundaries

The following example demonstrates applying a rotation transform on the Canvas 2D Contextobject and then drawing a rectangle. Only a portion of the rectangle is visible in the bounds ofthe graphics buffer.

RVU:

<AllocateBuffercommandToken="1" width="400” height="400"/>

<Response commandToken="1"bufId="100"errCode="ERR_SUCCESS"/>

<AllocateCanvascommandToken="2"bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectMethodInvokecommandToken="3"commandName="rotate"objectId="45"idl:angle=".785"/>

<ObjectMethodInvokecommandToken="4"commandName="fillRect"objectId="45"idl:x="5"idl:y="5"idl:w="200"idl:h="100"/>

Page 24: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

24 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Figure 5-2: Example Output of Rotating Outside the Graphics Boundaries

5.10 Canvas2D Context Transformation, Transparency and Compositing Impacton RVU Version 1.0 Commands

RVU 1.0 graphics commands assume that the Canvas 2D Context graphics buffer is in itsdefault state (no transform matrix, no global alpha, no global composite operation value, etc…).Some RVU 1.0 graphics commands provide those values explicitly such as BlendBlit with theshadeRule parameter and implicitly such as the ResizeBlit with the destination position andsizes.

[5.10-1]M: RVU-C

An RVU 2.0 compliant client shall process RVU Version 1.0 graphics commands withoutapplying Canvas2D Context transparency/compositing attributes and/or transformationmethods.

[5.10-2]M: RVU-C

Page 25: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

25 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

There shall be no performance degradation when executing RVU 1.0 graphics commands on anRVU client with RVU Canvas 2D Context capability..

The following example illustrates how RVU 1.0 commands execute without effect from RVUCanvas 2D Context attributes and transformation methods.

RVU:

# Allocate a graphics buffer of dimension 800x450

<AllocateBuffer commandToken="1" width="800” height="450"/>

<Response commandToken="1" bufId="100" errCode="ERR_SUCCESS"/>

<AllocateCanvas commandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS" returnType="object"returnValue="45"/>

# Set the buffer’s transform matrix to rotate it by ~45 degrees clockwise

<ObjectMethodInvoke commandName="rotate" commandToken="3" objectId="45"idl:angle=".785"/>

# Set the buffer’s fill style to be the red color

<ObjectAttributeSet commandToken="4" objectId="45" idlType:fillStyle="DOMString"idl:fillStyle="#FF0000"/>

# Draw a red 100x100 square with top left corner at (300, 100)

# Note that it will be rotated ~45 degrees clockwise

<ObjectMethodInvoke commandName="fillRect" commandToken="5" objectId="45" idl:x="300"idl:y="100" idl:w="100" idl:h="100"/>

# Allocate another graphics buffer of dimension 100x100

<AllocateBuffer commandToken="6" width="100" height="100"/>

<Response commandToken="5" errCode="ERR_SUCCESS" bufId="101"/>

# Draw a black 100x100 square (filling the entire graphics buffer)

<FillBlit commandToken="6" bufId="101" dstX="0" dstY="0" width="100" height="100"color="ff000000"/>

# Resize the square to the 800x450 graphics buffer

# Note that it will be stretched to a black 200x100 rectangle at (200, 100)

<ResizeBlit commandToken="7" srcBufId="101" srcX="0" srcY="0" srcWidth="100"srcHeight="100" dstBufId="100" dstX="200" dstY="100" dstWidth="200" dstHeight="100"/>

Page 26: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

26 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

Figure 5-3: Example Output of Mixed RVU Commands

5.11 Canvas2D Methods/Attributes and RVU Version 1.0 Blitqueue

[5.11-1]M: RVU-C

RVU client processing of Canvas2D methods and attributes shall be subject to execution withinRVU version 1.0 BlitQueues utilizing BlitQueue, Dispatch, EmptyQueue and WaitVSynccommands.

5.12 Additional Examples

5.12.1 Example of creating an RVU Canvas Object and drawing a rectangle

Javascript:

<canvas width="800" height="450"></canvas>

<script>

var context = document.getElementsByTagName('canvas')[0].getContext('2d');

context.fillRect(5, 5, 200, 100);

</script>

RVU:

<AllocateBuffer commandToken="1" width="800" height="450"/>

<Response commandToken="1" errCode="ERR_SUCCESS" bufId="100"/>

Page 27: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

27 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

<AllocateCanvas commandToken="2" bufId="100”/>

<Response commandToken="2"errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectMethodInvoke commandName="fillRect" commandToken="3" objectId="45"idl:x="5"idl:y="5" idl:w="200" idl:h="100"/>

<Response commandToken="3" errCode="ERR_SUCCESS"/>

5.12.2 Example Setting the Canvas2D globalCompositeOperation attribute

Javascript:

<canvas width="800" height="450"></canvas>

<script>

var context = document.getElementsByTagName('canvas')[0].getContext('2d');

context.globalCompositeOperation = "source-over";

context.fillStyle = 'rgba(255, 0, 0, 1)';

context.fillRect(5, 5, 100, 100);

context.globalCompositeOperation = "lighter";

context.fillStyle = 'rgba(0, 0, 0, 1)';

context.fillRect(50, 50, 100, 100);

</script>

RVU:

<AllocateBuffercommandToken="1" width="800” height="450"/>

<Response commandToken="1" bufId="100" errCode="ERR_SUCCESS"/>

<AllocateCanvas commandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

<ObjectAttributeSet commandToken="3" objectId="45"idlType:globalCompositeOperation="DOMString" idl:globalCompositeOperation="source-over"/>

<Response commandToken="3" errCode="ERR_SUCCESS"/>

<ObjectAttributeSet commandToken="4" objectId="45" idlType:fillStyle="DOMString"idl:fillStyle="rgba(255, 0, 0, 1)"/>

<Response commandToken="4" errCode="ERR_SUCCESS"/>

<ObjectMethodInvoke commandName="fillRect" commandToken="5" objectId="45" idl:x="5"idl:y="5" idl:w="100" idl:h="100"/>

<Response commandToken="5" errCode="ERR_SUCCESS"/>

<ObjectAttributeSet commandToken="6" objectId="45"idlType:globalCompositeOperation="DOMString" idl:globalCompositeOperation="lighter"/>

<Response commandToken="6" errCode="ERR_SUCCESS"/>

<ObjectAttributeSet commandToken="7" objectId="45" idlType:fillStyle="DOMString"idl:fillStyle="rgba(0, 0, 0, 1)"/>

<Response commandToken="7" errCode="ERR_SUCCESS"/>

Page 28: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

28 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

<ObjectMethodInvoke commandName="fillRect" commandToken="8" objectId="45" idl:x="50"idl:y="50" idl:w="100" idl:h="100"/>

<Response commandToken="8" errCode="ERR_SUCCESS"/>

5.12.3 Example mapping of four Canvas path methods to their equivalent RVUcommands:

Javascript:

<canvas width="800" height="450"></canvas>

<script>

var context = document.getElementsByTagName('canvas')[0].getContext('2d');

context.beginPath();

context.moveTo(50, 50);

context.lineTo(100, 100);

context.stroke();

</script>

RVU:

<AllocateBuffer commandToken="1" width="800” height="450"/>

<Response commandToken="1" errCode="ERR_SUCCESS" bufId="100"/>

<AllocateCanvas commandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS" returnType="object"returnValue="45"/>

<ObjectMethodInvoke commandName="beginPath" commandToken="3" objectId="45"/>

<Response commandToken="3" errCode="ERR_SUCCESS"/>

<ObjectMethodInvoke commandName="moveTo" commandToken="4" objectId="45" idl:x="50"idl:y="50"/>

<Response commandToken="4" errCode="ERR_SUCCESS"/>

<ObjectMethodInvokecommandToken="5" commandName="lineTo" objectId="45" idl:x="100"idl:y="100"/>

<Response commandToken="5" errCode="ERR_SUCCESS"/>

<ObjectMethodInvoke commandToken="6" commandName="stroke"/>

<Response commandToken="6" errCode="ERR_SUCCESS"/>

5.12.4 Example of using HTMLCanvasElement in drawImage

Javascript:

<canvas id=”canvas1” width="800" height="450"></canvas>

<canvas id=”canvas2” width="50" height="50"></canvas>

<script>

var context = document. getElementById(“canvas1”)[0].getContext('2d');

var canvasElement = document. getElementById(“canvas2”);

Page 29: RVU Protocol Specification Version 2 0 Revision 1.1 IP ...Deals... · Intellectual Property Notice ... Any form of reproduction and/or distribution of this document is prohibited.

RVU Specification

Protocol List of Tables

29 of 29

Copyright 2014 © RVU Alliance. RVU Alliance Confidential.

Any form of reproduction and/or distribution of this document is prohibited.

context.drawImage(canvasElement, 5, 5);

</script>

RVU:

# Allocate the first HTMLCanvasElement

<AllocateBuffer commandToken="1" width="800” height="450"/>

<Response commandToken="1" bufId="100" errCode="ERR_SUCCESS"/>

# Allocate the Canvas 2D-Context

<AllocateCanvas commandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

# Allocate the second HTMLCanvasElement

<AllocateBuffer commandToken="3" width="50” height="50"/>

# the returned bufID has an implicit idlType of “HTMLCanvasElement”

<Response commandToken="3" errCode="ERR_SUCCESS" bufId="101"/>

# Call the drawImage method, where the second canvas is drawn onto the first canvas

<ObjectMethodInvoke commandToken="4" commandName="drawImage" objectId="45"idl:image="101" idl:x="5" idl:y="5"/>

<Response commandToken="4" errCode="ERR_SUCCESS"/>

Javascript:

<canvas id=”canvas1” width="800" height="450"></canvas>

<script>

var context = document. getElementById(“canvas1”)[0].getContext('2d');

var canvas_element = context.canvas;

</script>

RVU:

# Allocate the first HTMLCanvasElement

<AllocateBuffer commandToken="1" width="800” height="450"/>

<Response commandToken="1" bufId="100" errCode="ERR_SUCCESS"/>

# Allocate the Canvas 2D-Context

<AllocateCanvas commandToken="2" bufId="100”/>

<Response commandToken="2" errCode="ERR_SUCCESS"returnType="object"returnValue="45"/>

# Get the canvas attribute of the first Canvas Context, as an example

<ObjectAttributeGet commandToken="5" objectId="45" attributeName="canvas"/>

<Response commandToken="5" errCode="ERR_SUCCESS" idlType:canvas="HTMLCanvasElement"idl:canvas="100" />