Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-06-20 17:59:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d46f6e54462fe4ecbb1f005d400911877640ef87
d46f6e54
1 parent
90f33fb1
feat:优化早晚报背景色获取
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
d46f6e5
...
...
@@ -16,7 +16,7 @@ import { topicInfoView } from './topicInfoView';
import { DateFormatUtil, PlayerConstants, WDPlayerController } from 'wdPlayer';
import { AudioDataList } from 'wdBean/src/main/ets/bean/morningevening/AudioDataList';
import { image } from '@kit.ImageKit';
import {
getPicture, imageNet2PixelMap
} from '../../utils/ImageUtils';
import {
findMaxPixel, getPicture, imageNet2PixelMap, traverseAllPixel
} from '../../utils/ImageUtils';
import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
...
...
@@ -25,7 +25,7 @@ import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import {TrackConstants,TrackParamConvert}from 'wdTracking/Index'
import { ColorUtils } from '../../utils/ColorUtils';
import { Color
Hsv, ColorRgb, Color
Utils } from '../../utils/ColorUtils';
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent';
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
...
...
@@ -238,14 +238,20 @@ export struct MorningEveningPaperComponent {
private async pickColor(imageSource: image.ImageSource | undefined) {
if (imageSource) {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getMainColorSync();
console.log(TAG, "compInfoBean compStyle = " + color)
// color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
});
let allPixels: number[] = await traverseAllPixel(pixelMap);
let maxPixel: number = findMaxPixel(allPixels);
let rgb: ColorRgb = ColorUtils.numberToRgb(maxPixel);
let hsv: ColorHsv = ColorUtils.rgb2hsv(rgb);
rgb = ColorUtils.hsv2rgb(hsv);
this.mixedBgColor = "#" + rgb.red.toString(16) + rgb.green.toString(16) + rgb.blue.toString(16);
// effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
// let color = colorPicker.getMainColorSync();
// console.log(TAG, "compInfoBean compStyle = " + color)
// // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// // 将取色器选取的color示例转换为十六进制颜色代码
// this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
// console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
// });
}
}
...
...
Please
register
or
login
to post a comment