Showing
3 changed files
with
16 additions
and
16 deletions
| @@ -238,20 +238,20 @@ export struct MorningEveningPaperComponent { | @@ -238,20 +238,20 @@ export struct MorningEveningPaperComponent { | ||
| 238 | private async pickColor(imageSource: image.ImageSource | undefined) { | 238 | private async pickColor(imageSource: image.ImageSource | undefined) { |
| 239 | if (imageSource) { | 239 | if (imageSource) { |
| 240 | const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); | 240 | const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource); |
| 241 | - let allPixels: number[] = await traverseAllPixel(pixelMap); | ||
| 242 | - let maxPixel: number = findMaxPixel(allPixels); | ||
| 243 | - let rgb: ColorRgb = ColorUtils.numberToRgb(maxPixel); | ||
| 244 | - let hsv: ColorHsv = ColorUtils.rgb2hsv(rgb); | ||
| 245 | - rgb = ColorUtils.hsv2rgb(hsv); | ||
| 246 | - this.mixedBgColor = "#" + rgb.red.toString(16) + rgb.green.toString(16) + rgb.blue.toString(16); | ||
| 247 | - // effectKit.createColorPicker(pixelMap, (err, colorPicker) => { | ||
| 248 | - // let color = colorPicker.getMainColorSync(); | ||
| 249 | - // console.log(TAG, "compInfoBean compStyle = " + color) | ||
| 250 | - // // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) | ||
| 251 | - // // 将取色器选取的color示例转换为十六进制颜色代码 | ||
| 252 | - // this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); | ||
| 253 | - // console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor) | ||
| 254 | - // }); | 241 | + // let allPixels: number[] = await traverseAllPixel(pixelMap); |
| 242 | + // let maxPixel: number = findMaxPixel(allPixels); | ||
| 243 | + // let rgb: ColorRgb = ColorUtils.numberToRgb(maxPixel); | ||
| 244 | + // let hsv: ColorHsv = ColorUtils.rgb2hsv(rgb); | ||
| 245 | + // rgb = ColorUtils.hsv2rgb(hsv); | ||
| 246 | + // this.mixedBgColor = "#" + rgb.red.toString(16) + rgb.green.toString(16) + rgb.blue.toString(16); | ||
| 247 | + effectKit.createColorPicker(pixelMap, (err, colorPicker) => { | ||
| 248 | + let color = colorPicker.getMainColorSync(); | ||
| 249 | + console.log(TAG, "compInfoBean compStyle = " + color) | ||
| 250 | + // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) | ||
| 251 | + // 将取色器选取的color示例转换为十六进制颜色代码 | ||
| 252 | + this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); | ||
| 253 | + console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor) | ||
| 254 | + }); | ||
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | 257 |
| @@ -39,8 +39,8 @@ export default struct MinePageUserSimpleInfoUI { | @@ -39,8 +39,8 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 39 | //头像 | 39 | //头像 |
| 40 | Stack(){ | 40 | Stack(){ |
| 41 | 41 | ||
| 42 | - Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head')) | ||
| 43 | - .alt($r('app.media.default_head')) | 42 | + Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head_userPage'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head_userPage')) |
| 43 | + .alt($r('app.media.default_head_userPage')) | ||
| 44 | .width(`${this.calcHeight(120)}lpx`) | 44 | .width(`${this.calcHeight(120)}lpx`) |
| 45 | .height(`${this.calcHeight(120)}lpx`) | 45 | .height(`${this.calcHeight(120)}lpx`) |
| 46 | .objectFit(ImageFit.Cover) | 46 | .objectFit(ImageFit.Cover) |
-
Please register or login to post a comment