连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

532 lines
16 KiB

3 months ago
//
// zego-whiteboard-canvas-oc.h
//
// Copyright © Shenzhen Zego Technology Company Limited
//
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
//#import "../zego-api-whiteboard-constant.h"
#pragma mark - whitebaord canvas notify delegate
@protocol ZegoWhiteboardCanvasDelegate <NSObject>
@optional
/**
@param whiteboardId ID
@param errorCode
*/
- (void)onLoaded:(unsigned long long)whiteboardId error:(int)errorCode;
/**
@param whiteboardId ID
@param operatorId ID
@param operatorName
*/
- (void)onCleared:(unsigned long long)whiteboardId
byOperator:(NSString *)operatorId
name:(NSString *)operatorName;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"size": 4, // 图元大小
"pos": (x, y), // 图元位置NSValue
"color": 4294263590, // 图元颜色
"zOrder": 1918378406, // z轴偏移
"points": [] // 图元点集合NSValue
"creatorId": "99975923", // 图元创建者ID
}
*/
- (void)onPathUpdatedWithJson:(NSDictionary *)json
whiteboardId:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"size": 4, // 图元大小
"pos": (x, y), // 图元位置NSValue
"color": 4294263590, // 图元颜色
"zOrder": 1918378406, // z轴偏移
"text":"文本" //图元文案
"points": [] // 图元点集合NSValue
"creatorId": "99975923", // 图元创建者ID
}
*/
- (void)onTextUpdatedWithJson:(NSDictionary *)json
whiteboardId:(unsigned long long)whiteboardId;
/**
线
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"size": 4, // 图元大小
"pos": (x, y), // 图元位置NSValue
"color": 4294263590, // 图元颜色
"zOrder": 1918378406, // z轴偏移
"points": [] // 图元点集合NSValue
"timeout" : 2121212 //失活时间
"creatorId": "99975923", // 图元创建者ID
}
*/
- (void)onLineUpdatedWithJson:(NSDictionary *)json
whiteboardId:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"size": 4, // 图元大小
"pos": (x, y), // 图元位置NSValue
"color": 4294263590, // 图元颜色
"zOrder": 1918378406, // z轴偏移
"points": [] // 图元点集合NSValue
"creatorId": "99975923", // 图元创建者ID
}
*/
- (void)onRectangleUpdatedWithJson:(NSDictionary *)json
whiteboardId:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"size": 4, // 图元大小
"pos": (x, y), // 图元位置NSValue
"color": 4294263590, // 图元颜色
"zOrder": 1918378406, // z轴偏移
"points": [] // 图元点集合NSValue
"creatorId": "99975923", // 图元创建者ID
}
*/
- (void)onEllipseUpdatedWithJson:(NSDictionary *)json
whiteboardId:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"size": 4, // 图元大小
"pos": (x, y), // 图元位置NSValue
"color": 4294263590, // 图元颜色
"zOrder": 1918378406, // z轴偏移
"points": [] // 图元点集合NSValue
"creatorId": "99975923", // 图元创建者ID
}
*/
-(void)onLaserUpdatedWithJson:(NSDictionary *)json
whiteboardId : (unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"pos": (x, y), // 图元位置NSValue
"zOrder": 1918378406, // z轴偏移
"url": "http://", //图片url
"hash":"sadasdsad" //图片hash
"points": [] // 图元点集合NSValue
"creatorId": "99975923", // 图元创建者ID
}
*/
-(void)onImageUpdatedWithJson:(NSDictionary *)json
whiteboardId : (unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"operatorId": "99975923", // 图元修改者ID
"graphicId": 3019181292, // 图元ID
"operatorName": xiaoqiang, // 图元创建者名字
"progress" : 0.01 //进度
"path ": "http://asdsad" //图片链接
"hash" : "sdadas" //图片hash
"whiteboardViewImageFitMode": 1 //图片填充模式
"creatorId": "99975923", // 图元创建者ID
}
*/
-(void)onBackgroundUpdatedWithJson:(NSDictionary *)json
whiteboardId : (unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param json
{
"graphicId" = graphic_id;
"points" = pointArray;
"url" = url;
"pos" = start_Pos;
"cursor_type" = cursor_type;
"cursorText": "zego"
"cursorTextBold": false, //粗体
"cursorTextItalic":false, //斜体
"cursorTextSize":1, //文本的size
"cursorTextColor":0xfff, //文本颜色
"cursorTextBgColor":0xfff, //文本背景色
"cursorTextPos":0, //文本的位置,左上、左下、右上、右下 // ZegoWhiteboardCursorPosition
}
*/
-(void)onCursorUpdatedWithJson:(NSDictionary *)json
whiteboardId : (unsigned long long)whiteboardId;
/**
@param graphicId ID
@param operatorId ID
@param operatorName
@param whiteboardId ID
*/
- (void)onDeleted:(unsigned long long)graphicId
byOperator:(NSString *)operatorId
name:(NSString *)operatorName
onWhiteboard:(unsigned long long)whiteboardId;
/**
zOrder
@param zOrder zorder
@param graphicId zOrder ID
@param whiteboardId ID
*/
- (void)onZOrderChanged:(unsigned long long)zOrder
ofGraphic:(unsigned long long)graphicId
onWhiteboard:(unsigned long long)whiteboardId;
@end
#pragma mark - whiteboard canvas interface
@interface ZegoWhiteboardCanvas : NSObject
/** 设置画布、图元更新通知 delegate */
- (void)setDelegate:(id<ZegoWhiteboardCanvasDelegate>)delegate;
/**
@param whiteboardId ID
@note delegate onLoadFinished
@note delegate update
*/
- (void)load:(unsigned long long)whiteboardId;
/**
SDK
@param whiteboardId ID
@note
*/
- (void)loadCache:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@note UI层自行清除所有绘制
*/
- (void)clear:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@note delegate update
*/
- (void)undo:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@note delegate update
*/
- (void)redo:(unsigned long long)whiteboardId;
/*******************************************************************************
[[whiteboard sharedCanvasManager] beginDraw:]; // 手指触碰屏幕等
[[whiteboard sharedCanvasManager] drawPath:]; // 手指在屏幕滑动,产生点坐标
......
[[whiteboard sharedCanvasManager] endDraw:]; // 手指离开屏幕等
使
*******************************************************************************/
/**
idzego_whiteboard_canvas_end_draw配对使用
@param graphicType
@param pos UI层原始坐标即可
@param whiteboardId ID
@return ID
*/
- (unsigned long long)beginDraw:(int)graphicType
pos:(CGPoint)pos
onWhiteboard:(unsigned long long)whiteboardId;
/**
beginDraw: pos: atWhiteboard: 使
@param whiteboardId ID
*/
- (void)endDraw:(unsigned long long)whiteboardId;
/**
endUpdate: pos: atWhiteboard: 使
@param whiteboardId ID
*/
-(void)beginUpdate:(unsigned long long)whiteboardId;
/**
beginUpdate: pos: atWhiteboard: 使
@param whiteboardId ID
*/
-(void)endUpdate:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param pos
*/
- (void)drawPath:(CGPoint)pos onWhiteboard:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@param text
*/
- (void)drawText:(NSString *)text
onWhiteboard:(unsigned long long)whiteboardId;
/**
@param text
@param graphicId ID
@param whiteboardId ID
*/
- (void)editText:(NSString *)text
ofGraphic:(unsigned long long)graphicId
onWhiteboard:(unsigned long long)whiteboardId;
/**
@param url url
@param hash hash
@param pos
@param whiteboardId ID
*/
-(void)addImage:(NSString *)url
ofImageHash : (NSString *)hash
ofEndPoint : (CGPoint)pos
onWhiteboard : (unsigned long long)whiteboardId;
/**
@param pos
@param epos
@param graphicId ID
@param whiteboardId ID
*/
-(void)editImage:(CGPoint)pos
ofEndPoint : (CGPoint)epos
ofGraphic : (unsigned long long)graphicId
onWhiteboard : (unsigned long long)whiteboardId;
/**
@param url url
@param hash hash
@param whiteboardViewImageFitMode
@param whiteboardId ID
*/
-(void)setBackGround:(NSString *)url
ofBackgroundHash : (NSString *)hash
ofwhiteboardViewImageFitMode : (int)whiteboardViewImageFitMode
onWhiteboard :(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
*/
-(void)cleanBackGround:(unsigned long long)whiteboardId;
/**
线
@param pos 线
@param whiteboardId ID
*/
- (void)drawLine:(CGPoint)pos onWhiteboard:(unsigned long long)whiteboardId;
/**
@param pos
@param whiteboardId ID
*/
- (void)drawRectangle:(CGPoint)pos onWhiteboard:(unsigned long long)whiteboardId;
/**
@param pos
@param whiteboardId ID
*/
- (void)drawEllipse:(CGPoint)pos onWhiteboard:(unsigned long long)whiteboardId;
/**
@param cursorType
@param pos (x,y)
@param whiteboardId ID
@return ID
*/
- (unsigned long long)setCursor:(int)cursorType
startPosition:(CGPoint)pos
onWhiteboard:(unsigned long long)whiteboardId;
/**
@param cursorType
@param cursorInfo
{
"url": "", //光标的url
"pox_x": 1; //偏移量x
"pox_y": 2; //偏移量y
//光标附带文本的属性
"text_style":
{
"text": "zego" //文本内容(限制 64 字节)
"bold": false, //粗体
"italic": false, //斜体
"size":1, //文本的size
"color":0xfff, //文本颜色
"bg_color":0, //文本背景色
"pos":0, //文本的位置,左上、左下、右上、右下 //ZegoWhiteboardCursorPosition
}
}
*/
- (void)setCursorAttribute:(int)cursorType cursorInfo:(NSString *)cursorInfo;
/**
@param pos
@param whiteboardId ID
*/
- (void)moveCursor:(CGPoint)pos onWhiteboard:(unsigned long long)whiteboardId;
/**
@param graphicId ID beginDraw:
@param pos
@param whiteboardId ID
*/
- (void)moveGraphic:(unsigned long long)graphicId
toPosistion:(CGPoint)pos
onWhiteboard:(unsigned long long)whiteboardId;
/**
@param moveInfo ID NSNumber * unsigned long longNSValue * CGPoint
@param whiteboardId ID
*/
- (void)moveGraphics:(NSDictionary<NSNumber *, NSValue *> *)moveInfo
onWhiteboard:(unsigned long long)whiteboardId;
/**
@param graphicId ID beginDraw:
@param whiteboardId ID
*/
- (void)deleteGraphic:(unsigned long long)graphicId
onWhiteboard:(unsigned long long)whiteboardId;
/**
@param items ID NSNumber * unsigned long long
*/
- (void)deleteGraphics:(NSArray<NSNumber *> *)items
onWhiteboard:(unsigned long long)whiteboardId;
@end