제품 업데이트
Tencent Cloud 오디오/비디오 단말 SDK 재생 업그레이드 및 권한 부여 인증 추가
TRTC 월간 구독 패키지 출시 관련 안내
BaseBeautyStore is the module in AtomicXCore for management of basic beauty effects for portraits. Through it, you can easily add natural beauty effects to your live stream or call applications.BaseBeautyStore in the following table:Core Concepts | Type | Core Responsibilities and Description |
class | Represents the current status of the beauty module. It includes the intensity values of currently effective skin smoothing ( smoothLevel), whitening (whitenessLevel), and rosy (ruddyLevel). All attributes are ValueListenable<double> data type and support subscription listening. | |
class | This is the core management class for interacting with the basic beauty filter feature. It is a Global Singleton ( shared), responsible for ALL basic beauty parameter settings, reset and state synchronization. |
BaseBeautyStore and set a listener to get the current beauty effect parameter status in real time.BaseBeautyStore.shared to get the globally unique BaseBeautyStore instance.baseBeautyState properties via addListener to get beauty parameter updates in real time.import 'package:flutter/material.dart';import 'package:atomic_x_core/atomicxcore.dart';class BeautyManager {// 1. Get a singletonfinal _baseBeautyStore = BaseBeautyStore.shared;late final VoidCallback _smoothLevelChangedListener = _onSmoothLevelChanged;late final VoidCallback _whitenessLevelChangedListener = _onWhitenessLevelChanged;late final VoidCallback _ruddyLevelChangedListener = _onRuddyLevelChanged;// 2. Subscription statusvoid subscribeToBeautyState() {_baseBeautyStore.baseBeautyState.smoothLevel.addListener(_smoothLevelChangedListener);_baseBeautyStore.baseBeautyState.whitenessLevel.addListener(_whitenessLevelChangedListener);_baseBeautyStore.baseBeautyState.ruddyLevel.addListener(_ruddyLevelChangedListener);}void _onSmoothLevelChanged() {final level = _baseBeautyStore.baseBeautyState.smoothLevel.value;debugPrint('Skin smoothing strength adjustment: $level');}void _onWhitenessLevelChanged() {final level = _baseBeautyStore.baseBeautyState.whitenessLevel.value;debugPrint('Whitening strength adjustment: $level');}void _onRuddyLevelChanged() {final level = _baseBeautyStore.baseBeautyState.ruddyLevel.value;debugPrint('Rosy strength adjustment: $level');}// Execute dispose before logging out of the Appvoid dispose() {_baseBeautyStore.baseBeautyState.smoothLevel.removeListener(_smoothLevelChangedListener);_baseBeautyStore.baseBeautyState.whitenessLevel.removeListener(_whitenessLevelChangedListener);_baseBeautyStore.baseBeautyState.ruddyLevel.removeListener(_ruddyLevelChangedListener);}}
Slider). The parameter range accepted by the SDK API is 0-9, where 0 means disabling the effect and 9 indicates the most obvious effect. You need to map the value of the UI control (for example, 0.0 - 1.0 of the Slider) to the range of 0 - 9.setSmoothLevel(), setWhitenessLevel(), and setRuddyLevel() to set the intensity of skin smoothing, whitening, and rosy effect.extension BeautyManagerExtension on BeautyManager {/// Set the skin smoothing strength (input range 0.0 ~ 1.0, internal conversion to 0 ~ 9)void updateSmoothLevel(double uiLevel) {// Map the UI's 0.0 ~ 1.0 to the SDK's 0 ~ 9final sdkLevel = uiLevel * 9.0;_baseBeautyStore.setSmoothLevel(sdkLevel);}/// Set the whitening strength (input range 0.0 ~ 1.0, internal conversion to 0 ~ 9)void updateWhitenessLevel(double uiLevel) {final sdkLevel = uiLevel * 9.0;_baseBeautyStore.setWhitenessLevel(sdkLevel);}/// Set the ruddy level (input range 0.0 ~ 1.0, internal conversion to 0 ~ 9)void updateRuddyLevel(double uiLevel) {final sdkLevel = uiLevel * 9.0;_baseBeautyStore.setRuddyLevel(sdkLevel);}}
baseBeautyStore.reset() method to restore all beauty parameters to the default value (usually 0).extension BeautyManagerReset on BeautyManager {/// Reset ALL basic beauty effectsvoid resetBeautyEffects() {_baseBeautyStore.reset();}}
ValueListenableBuilder to build responsive UI, which auto-updates the interface when beauty effect parameters change:class BeautySliderWidget extends StatelessWidget {final beautyStore = BaseBeautyStore.shared;@overrideWidget build(BuildContext context) {return Column(children: [// Skin smoothing sliderValueListenableBuilder<double>(valueListenable: beautyStore.baseBeautyState.smoothLevel,builder: (context, smoothLevel, child) {return Row(children: [Text('Skin smoothing')Expanded(child: Slider(value: smoothLevel,min: 0,max: 9,divisions: 9,onChanged: (value) {beautyStore.setSmoothLevel(value);},),),Text('${smoothLevel.toInt()}'),],);},),// Whitening sliderValueListenableBuilder<double>(valueListenable: beautyStore.baseBeautyState.whitenessLevel,builder: (context, whitenessLevel, child) {return Row(children: [Text('Whitening')Expanded(child: Slider(value: whitenessLevel,min: 0,max: 9,divisions: 9,onChanged: (value) {beautyStore.setWhitenessLevel(value);},),),Text('${whitenessLevel.toInt()}'),],);},),// rosy sliderValueListenableBuilder<double>(valueListenable: beautyStore.baseBeautyState.ruddyLevel,builder: (context, ruddyLevel, child) {return Row(children: [Text('Rosy')Expanded(child: Slider(value: ruddyLevel,min: 0,max: 9,divisions: 9,onChanged: (value) {beautyStore.setRuddyLevel(value);},),),Text('${ruddyLevel.toInt()}'),],);},),],);}}
import 'package:flutter/material.dart';import 'package:atomic_x_core/atomicxcore.dart';class BeautySettingsPage extends StatelessWidget {final beautyStore = BaseBeautyStore.shared;@overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(title: Text('Beauty settings')),body: Padding(padding: EdgeInsets.all(16),child: Column(children: [// Skin smoothing_buildBeautySlider(title: 'Skin smoothing'valueListenable: beautyStore.baseBeautyState.smoothLevel,onChanged: (value) => beautyStore.setSmoothLevel(value),),SizedBox(height: 20),// Whitening_buildBeautySlider(title: 'Whitening',valueListenable: beautyStore.baseBeautyState.whitenessLevel,onChanged: (value) => beautyStore.setWhitenessLevel(value),),SizedBox(height: 20),// Rosy_buildBeautySlider(title: 'Rosy'valueListenable: beautyStore.baseBeautyState.ruddyLevel,onChanged: (value) => beautyStore.setRuddyLevel(value),),SizedBox(height: 40),// reset buttonElevatedButton(onPressed: () {beautyStore.reset();},child: Text('Reset beauty effect'),),],),),);}Widget _buildBeautySlider({required String title,required ValueListenable<double> valueListenable,required ValueChanged<double> onChanged,}) {return ValueListenableBuilder<double>(valueListenable: valueListenable,builder: (context, value, child) {return Column(crossAxisAlignment: CrossAxisAlignment.start,children: [Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [Text(title, style: TextStyle(fontSize: 16)),Text('${value.toInt()}', style: TextStyle(fontSize: 16)),],),Slider(value: value,min: 0,max: 9,divisions: 9,onChanged: onChanged,),],);},);}}
Comparison Item | Basic Beauty (BaseBeautyStore) | Advanced Beauty (TencentEffect, requires additional integration) |
Core Features | Skin smoothing, whitening, rosy | All basic beauty features, plus V-shaped face, eye distance, nose slimming, 3D stickers, filters, makeup, and more |
Pricing | Free (included with AtomicXCore license) | Paid (requires separate TencentEffect SDK license) |
Integration Method | Built-in by default, use BaseBeautyStore.shared directly | Requires additional integration of the TencentEffect component and authentication |
Recommended Scenarios | Use for simple beauty requirements or when you need to quickly enable basic beauty features | Use for advanced beauty requirements, including shaping, stickers, filters, and other enhanced effects |
TencentEffect, you can control ALL beauty effects through the API provided by TencentEffect.Property/Method | Type | Description |
shared | BaseBeautyStore | Singleton instance |
baseBeautyState | BaseBeautyState | Beauty effect status |
setSmoothLevel | void | Set the skin smoothing strength (0-9). |
setWhitenessLevel | void | Set the brightening strength (0-9). |
setRuddyLevel | void | Set the rosy strength (0-9). |
reset | void | Reset all beauty parameters to default value (0). |
Attribute | Type | Description |
smoothLevel | ValueListenable<double> | Skin smoothing strength (0-9). |
whitenessLevel | ValueListenable<double> | Brightening strength (0-9). |
ruddyLevel | ValueListenable<double> | Rosy strength (0-9). |
DeviceStore.shared.openLocalCamera()). Beauty effects are only applied to the video stream when the camera is active.피드백