forked from floraachy/ImageKnife
1.svg的地址改为手动输入
Signed-off-by: zhoulisheng <635547767@qq.com>
This commit is contained in:
parent
9dd89db3e3
commit
ea566c3eeb
2
NOTICE
2
NOTICE
|
@ -148,7 +148,7 @@ http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
|
|||
|
||||
Java Author: Mario Klingemann <mario at quasimondo.com>
|
||||
http://incubator.quasimondo.com
|
||||
created Feburary 29, 2004
|
||||
created February 29, 2004
|
||||
port : Yahel Bouaziz <yahel at kayenko.com>
|
||||
http://www.kayenko.com
|
||||
ported april 5th, 2012
|
||||
|
|
|
@ -23,6 +23,7 @@ import worker from '@ohos.worker'
|
|||
@Component
|
||||
struct TestImageKnifeOptionChangedPage {
|
||||
|
||||
svgUrl:string = ''
|
||||
@State imageKnifeOption1: ImageKnifeOption =
|
||||
{
|
||||
loadSrc: $r('app.media.jpgSample'),
|
||||
|
@ -139,10 +140,28 @@ struct TestImageKnifeOptionChangedPage {
|
|||
errorholderSrc: $r('app.media.icon_failed')
|
||||
};
|
||||
}).margin({left:5}).backgroundColor(Color.Blue)
|
||||
|
||||
Text("请先设置SVG图片的url地址")
|
||||
TextArea({ placeholder: '请输入SVG图片的url地址' })
|
||||
.placeholderColor("rgb(0,0,35)")
|
||||
.placeholderFont({ size: 20, weight: 100, family: 'cursive', style: FontStyle.Italic })
|
||||
.textAlign(TextAlign.Center)
|
||||
.caretColor(Color.Blue)
|
||||
.height(40)
|
||||
.width(400)
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontFamily("sans-serif")
|
||||
.fontStyle(FontStyle.Normal)
|
||||
.fontColor(Color.Red)
|
||||
.onChange((value: string) => {
|
||||
this.svgUrl = value
|
||||
})
|
||||
|
||||
Button('svg')
|
||||
.onClick(()=>{
|
||||
this.imageKnifeOption1 = {
|
||||
loadSrc: 'http://124.222.187.78/download/test.svg',
|
||||
loadSrc: this.svgUrl,
|
||||
|
||||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed')
|
||||
|
|
|
@ -23,7 +23,7 @@ import { BusinessError } from '@ohos.base'
|
|||
@Entry
|
||||
@Component
|
||||
struct TestPreloadPage {
|
||||
|
||||
svgUrl:string = ''
|
||||
@State imageKnifeOption1: ImageKnifeOption =
|
||||
{
|
||||
loadSrc: $r('app.media.jpgSample'),
|
||||
|
@ -255,13 +255,28 @@ struct TestPreloadPage {
|
|||
|
||||
}
|
||||
.margin({ top: 15 })
|
||||
|
||||
Text("请先设置SVG图片的url地址")
|
||||
TextArea({ placeholder: '请输入SVG图片的url地址' })
|
||||
.placeholderColor("rgb(0,0,35)")
|
||||
.placeholderFont({ size: 20, weight: 100, family: 'cursive', style: FontStyle.Italic })
|
||||
.textAlign(TextAlign.Center)
|
||||
.caretColor(Color.Blue)
|
||||
.height(40)
|
||||
.width(400)
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontFamily("sans-serif")
|
||||
.fontStyle(FontStyle.Normal)
|
||||
.fontColor(Color.Red)
|
||||
.onChange((value: string) => {
|
||||
this.svgUrl = value
|
||||
})
|
||||
Flex({ direction: FlexDirection.Row }) {
|
||||
|
||||
Button('预加载网络资源svg')
|
||||
.onClick(() => {
|
||||
let request = new RequestOption();
|
||||
request.load('http://124.222.187.78/download/test.svg')
|
||||
request.load(this.svgUrl)
|
||||
.setImageViewSize({ width: 300, height: 300 })
|
||||
.addListener({callback:(err:BusinessError|string, data:ImageKnifeData) => {
|
||||
if (err) {
|
||||
|
@ -279,7 +294,7 @@ struct TestPreloadPage {
|
|||
Button('网络资源svg')
|
||||
.onClick(() => {
|
||||
this.imageKnifeOption = {
|
||||
loadSrc: 'http://124.222.187.78/download/test.svg',
|
||||
loadSrc: this.svgUrl,
|
||||
|
||||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed'),
|
||||
|
|
|
@ -443,7 +443,7 @@ export struct ImageKnifeComponent {
|
|||
LogUtil.log('ImageKnifeComponent default drawPlaceholder start!')
|
||||
|
||||
data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => {
|
||||
LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
|
||||
LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
|
||||
let scaleType = (typeof imageKnifeOption.placeholderScaleType == 'number') ? imageKnifeOption.placeholderScaleType : ScaleType.FIT_CENTER
|
||||
context.save();
|
||||
context.clearRect(0, 0, compWidth, compHeight)
|
||||
|
@ -498,7 +498,7 @@ export struct ImageKnifeComponent {
|
|||
LogUtil.log('ImageKnifeComponent default drawThumbSizeMultiplier start!')
|
||||
|
||||
data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => {
|
||||
LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
|
||||
LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
|
||||
let scaleType = (typeof imageKnifeOption.thumbSizeMultiplierScaleType == 'number') ? imageKnifeOption.thumbSizeMultiplierScaleType : ScaleType.FIT_CENTER
|
||||
context.save();
|
||||
context.clearRect(0, 0, compWidth, compHeight)
|
||||
|
@ -548,7 +548,7 @@ export struct ImageKnifeComponent {
|
|||
LogUtil.log('ImageKnifeComponent default drawErrorholder start!')
|
||||
|
||||
data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => {
|
||||
LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
|
||||
LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
|
||||
let scaleType = (typeof imageKnifeOption.errorholderSrcScaleType == 'number') ? imageKnifeOption.errorholderSrcScaleType : ScaleType.FIT_CENTER
|
||||
context.save();
|
||||
context.clearRect(0, 0, compWidth, compHeight)
|
||||
|
|
|
@ -27,13 +27,13 @@ export class LoadDataShareFileClient implements IDataFetch {
|
|||
onComplete(buf);
|
||||
fs.close(file.fd);
|
||||
}).catch((err:BusinessError) => {
|
||||
onError('LoadDataShareFileClient fs.read err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
|
||||
onError('LoadDataShareFileClient fs.read err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
|
||||
})
|
||||
}).catch((err:BusinessError) => {
|
||||
onError('LoadDataShareFileClient fs.stat err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
|
||||
onError('LoadDataShareFileClient fs.stat err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
|
||||
})
|
||||
}).catch((err:BusinessError) => {
|
||||
onError('LoadDataShareFileClient fs.open err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
|
||||
onError('LoadDataShareFileClient fs.open err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ export namespace fastBlur {
|
|||
//
|
||||
// Java Author: Mario Klingemann <mario at quasimondo.com>
|
||||
// http://incubator.quasimondo.com
|
||||
// created Feburary 29, 2004
|
||||
// created February 29, 2004
|
||||
// port : Yahel Bouaziz <yahel at kayenko.com>
|
||||
// http://www.kayenko.com
|
||||
// ported april 5th, 2012
|
||||
|
|
Loading…
Reference in New Issue