arctos-SDK For developsarctos-SDK For develops
Home
Okuma
arctos
Contact
  • English
  • 繁體中文
Home
Okuma
arctos
Contact
  • English
  • 繁體中文
  • Guide

    • get-started
  • Spec

    • Peer to Peer Direct
    • Relay based
  • Api

    • Overview
    • Auth
    • Task
    • Business
    • Room
  • Peer to Peer Direct

    • overview
    • installization
    • features

      • initial_setting
      • room
      • camera
      • conference
      • microphone
      • speaker
      • share_screen
      • paint_board
        • 啟動白板繪圖模式
        • 設定顏色
        • 設定筆觸寬度
        • 清除畫布
        • 停用畫筆
        • 類型
          • 枚舉類別
      • recording
      • layout
  • Relay based

    • overview
    • installization
    • features

      • initial_setting
      • camera
      • microphone
      • speaker
      • share_screen
      • paint_board
      • share_message
      • switch_template
      • video_filters

畫筆

ArctosLinks.Conference 提供了一套 API 來控制畫筆相關的操作;ArctosLinks.Media則提供畫筆的參數設定。

注意事項

1. 畫筆功能僅能在會議進行時由會議室主持人使用。
2. 畫面旋轉時會清除當前繪製的筆跡。

啟動白板繪圖模式

功能: 啟動白板繪圖功能,可在畫面上做自由繪圖。

返回值:如果成功啟動則完成,若是使用時發生例外狀況,則返回錯誤。

注意事項

iOS: 可繪製的畫布邊界等於視訊通話顯示區,因此使用此方法前應先執行[加入會議室](conference.md#加入會議室_joinroom),[設定顯示區域](layout.md#設定串流視圖位置)。
Swift
import ArctosLinks

private func startWhiteBoardDrawing() {
    ArctosLinks.Conference.hostStartWhiteBoardDrawing { result in
        switch result {
        case .success():
            break
        case .failure(let error):
            displayNotification(title: "🚨 Process ERROR", body: error.localizedDescription)
        }
    }
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks

private fun startWhiteboardDrawing() {
    runCatching {
        ArctosLinks.getInstance(Context).conferenceManager.hostStartWhiteboardDrawing()
            .getOrThrow()
    }.onSuccess {
        Log.d(TAG, "Successfully start Whiteboard Drawing")
    }.onFailure {
        Log.d(TAG, "Failed : ${it.message}")
    }
}
c++
#include "arctos_qt.h"

void startWhiteboardDrawing() {
    arctos_app.media()->setPaintingMode(true);
}

設定顏色

功能: 設定畫筆的顏色。

參數:

  • color: 要設定的畫筆顏色,型別為BrushColor。

返回值:如果成功設定則返回新的顏色,若是使用時發生例外狀況,則返回錯誤。

Swift
import ArctosLinks

func setBrushColorMenu() {
    var elements = [UIMenuElement]()
    for color in ArctosLinks.Media.BrushColor.allCases {
        elements.append(UIAction(title: color.title, handler: { _ in
            ArctosLinks.Conference.hostSetWhiteBoardBrushColor(color) { result in
                switch result {
                case .success(let color):
                    displayNotification(title: "Selected color: \(color.title)", body: "")
                case .failure(let error):
                    displayNotification(title: "🚨 Process ERROR", body: error.localizedDescription)
                }
            }
        }))
    }
    
    paletteButton.menu = UIMenu(options: .displayInline, children: elements)
    paletteButton.showsMenuAsPrimaryAction = true
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks

private fun setWhiteboardBrushColor(brushColor: ConferenceRoomInterface.BrushColor) {
    runCatching {
        ArctosLinks.getInstance(Context).conferenceManager.hostSetWhiteboardBrushColor(
            brushColor
        ).getOrThrow()
    }.onSuccess {            
        Log.d(TAG, "Successfully set Whiteboard Brush Color")
    }.onFailure {
        Log.d(TAG, "Failed : ${it.message}")
    }
}
c++
#include "arctos_qt.h"
// cpp API is closer to immediate mode for painting, therefore, please store desired "color code" in string format manually
void setWhiteboardBrushColor(const std::string& color_code) {
    my_color_code_ = color_code;
}

// later on
void paint(int x, int y) {
    arctos_app.media()->paint(x, y, my_color_code_, my_pen_width_);
}

設定筆觸寬度

功能: 設定畫筆的筆觸寬度。

參數:

  • stroke: 要設定的筆觸寬度,型別為BrushStroke。

返回值:如果成功設定則返回新的筆觸寬度,若是使用時發生例外狀況,則返回錯誤。

Swift
import ArctosLinks

func setStrokeMenu() {
    var elements = [UIMenuElement]()
    for stroke in ArctosLinks.Media.BrushStroke.allCases {
        elements.append(UIAction(title: stroke.title, handler: { _ in
            ArctosLinks.Conference.hostSetWhiteBoardStroke(to: stroke) { result in
                switch result {
                case .success(let width):
                    displayNotification(title: "Selected \(width.title) stroke", body: "")
                case .failure(let error):
                    displayNotification(title: "🚨 Process ERROR", body: error.localizedDescription)
                }
            }
        }))
    }
    
    strokeWidthButton.menu = UIMenu(options: .displayInline, children: elements)
    strokeWidthButton.showsMenuAsPrimaryAction = true
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks

private fun setWhiteboardStroke(stroke: ConferenceRoomInterface.BrushStroke) {
    runCatching {
        ArctosLinks.getInstance(Context).conferenceManager.hostSetWhiteboardStroke(
            stroke
        ).getOrThrow()
    }.onSuccess {
        Log.d(TAG, "Successfully set Whiteboard Stroke")            
    }.onFailure {
        Log.d(TAG, "Failed : ${it.message}")
    }
}
c++
#include "arctos_qt.h"
// cpp API is closer to immediate mode for painting, therefore, please store desired "width" in double manually
void setWhiteboardStroke(double width) {
    my_pen_width_ = width;
}

// later on
void paint(int x, int y) {
    arctos_app.media()->paint(x, y, my_color_code_, my_pen_width_);
}

清除畫布

功能: 清除白板上的所有繪圖。

返回值:如果成功清除則完成,若是使用時發生例外狀況,則返回錯誤。

Swift
import ArctosLinks

@IBAction func eraserButtonTouchUpInside(_ sender: UIButton) {
    ArctosLinks.Conference.hostClearWhiteBoard()
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks

private fun clearWhiteboard() {
    runCatching {
        ArctosLinks.getInstance(Context).conferenceManager.hostClearWhiteboard()
            .getOrThrow()
    }.onSuccess {
        Log.d(TAG, "Successfully clear Whiteboard")
    }.onFailure {
        Log.d(TAG, "Failed : ${it.message}")
    }
}
c++
#include "arctos_qt.h"

void clearWhiteboard() {
    arctos_app.media()->clearPaintingMask();
}

停用畫筆

功能: 停止白板的繪圖模式。

返回值:如果成功停用則完成,若是使用時發生例外狀況,則返回錯誤。

Swift
import ArctosLinks

private func stopDrawingButtonDidTouchUpInside() {
    ArctosLinks.Conference.hostStopWhiteBoardDrawing { result in
        switch result {
        case .success():
            break
        case .failure(let error):
            displayNotification(title: "🚨 Process ERROR", body: error.localizedDescription)
        }
    }
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks

private fun stopWhiteboardDrawing() {
    runCatching {
        ArctosLinks.getInstance(Context).conferenceManager.hostStopWhiteboardDrawing()
            .getOrThrow()
    }.onSuccess {
        Log.d(TAG, "Successfully stop Whiteboard Drawing")            
    }.onFailure {
        Log.d(TAG, "Failed : ${it.message}")
    }
}
c++
#include "arctos_qt.h"

void startWhiteboardDrawing() {
    arctos_app.media()->setPaintingMode(false);
}

類型

枚舉類別

畫筆顏色 (BrushColor)

功能:用於列舉啟用畫筆功能時,可以選擇的畫筆顏色,預設為紅色。

成員:

  • red: 紅色。
  • magenta: 半透明的洋紅色。
  • yellow: 半透明的黃色。
  • cyan: 青色。
  • green: 橄欖綠色。
  • black: 黑色。
  • white: 白色。

參數:

  • title: 顏色的英文描述。
Swift
/// Represents the color options available for the paint brush.
enum BrushColor: CaseIterable {
    /// Red color (#EA3323)
    case red
    /// Magenta color (#80EA33F7)
    case magenta
    /// Yellow color (#80FFFF55)
    case yellow
    /// Cyan color (#75FBFD)
    case cyan
    /// Green color (#78A75A)
    case green
    /// Black color (#000000)
    case black
    /// White color (#FFFFFF)
    case white

    /// The English name of the current color.
    public var title: String {
        switch self {
        case .red:
            return "Red"
        case .magenta:
            return "Magenta"
        case .yellow:
            return "Yellow"
        case .cyan:
            return "Cyan"
        case .green:
            return "Green"
        case .black:
            return "Black"
        case .white:
            return "White"
        }
    }
Kotlin
sealed class BrushColor {
    data object RED : BrushColor()
    data object MAGENTA : BrushColor()
    data object YELLOW : BrushColor()
    data object GREEN : BrushColor()
    data object CYAN : BrushColor()
    data object BLOCK : BrushColor()
    data object WHITE : BrushColor()
}
c++
// No predefined, supports all `QColor`, feel free to maintain own color set(s)

筆觸寬度 (BrushStroke)

功能:用於列舉啟用畫筆功能時,可以選擇的筆觸寬度,預設為粗線。

成員:

  • bold: 粗線
  • regular: 細線

參數:

  • title: 筆觸寬度的英文描述。
Swift
/// Represents the stroke width options available for the paint brush.
enum BrushStroke: CaseIterable {
    /// Bold stroke width.
    case bold
    /// Regular stroke width.
    case regular
    /// The English name of the current stroke width.
    public var title: String {
        switch self {
        case .bold:
            return "Bold"
        case .regular:
            return "Regular"
        }
    }
}
Kotlin
sealed class BrushStroke {
    data object REGULAR : BrushStroke()
    data object BOLD : BrushStroke()
}
c++
// No predefined, supports reasonable sizes in double, feel free to maintain own set(s)
Prev
share_screen
Next
recording