Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/display-module/display-module/src/LeafRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Debug } from '@leafer/debug'
export const LeafRender: ILeafRenderModule = {

__render(canvas: ILeaferCanvas, options: IRenderOptions): void {

if (options.shape) return this.__renderShape(canvas, options)

if (this.__worldOpacity) {

const data = this.__
Expand All @@ -19,11 +22,8 @@ export const LeafRender: ILeafRenderModule = {
const tempCanvas = canvas.getSameCanvas(true, true)
this.__draw(tempCanvas, options, canvas)

if (this.__worldFlipped) {
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true)
} else {
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode)
}
if (this.__worldFlipped) canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true)
else canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode)

tempCanvas.recycle(this.__nowWorld)

Expand All @@ -38,6 +38,14 @@ export const LeafRender: ILeafRenderModule = {
}
},

__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void {
if (this.__worldOpacity) {
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options))

this.__drawShape(canvas, options)
}
},

__clip(canvas: ILeaferCanvas, options: IRenderOptions): void {
if (this.__worldOpacity) {
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options))
Expand Down
4 changes: 3 additions & 1 deletion packages/display/src/Leaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,9 @@ export class Leaf implements ILeaf {

public __clip(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }

public __renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions, _ignoreFill?: boolean, _ignoreStroke?: boolean): void { }
public __renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }

public __drawShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }


public __updateWorldOpacity(): void { }
Expand Down
3 changes: 2 additions & 1 deletion packages/interface/src/display/ILeaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
__draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void

__clip(canvas: ILeaferCanvas, options: IRenderOptions): void
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
__drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void

__updateWorldOpacity(): void
__updateChange(): void
Expand Down
3 changes: 2 additions & 1 deletion packages/interface/src/display/module/ILeafRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export interface ILeafRender {
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void

__clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
__drawShape?(canvas: ILeaferCanvas, options: IRenderOptions): void

__updateWorldOpacity?(): void
__updateChange?(): void
Expand Down
5 changes: 5 additions & 0 deletions packages/interface/src/renderer/IRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export interface IRenderOptions {
inCamera?: boolean
dimOpacity?: number
exporting?: boolean // 是否通过 export() 导出渲染

// 只渲染外形
shape?: boolean
ignoreFill?: boolean, // 绘制外形时忽略fill
ignoreStroke?: boolean // 绘制外形时忽略stroke
}

export interface IRendererConfig {
Expand Down