-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from valb3r/feature/FBP-231-save-diagram-as-png
Feature/fbp 231 save diagram as png
- Loading branch information
Showing
8 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...-plugin-core/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/core/actions/DiagramToPng.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.valb3r.bpmn.intellij.plugin.core.actions | ||
|
||
import com.intellij.openapi.fileChooser.FileChooserFactory | ||
import com.intellij.openapi.fileChooser.FileSaverDescriptor | ||
import com.intellij.openapi.project.Project | ||
import com.valb3r.bpmn.intellij.plugin.core.render.currentCanvas | ||
import javax.imageio.ImageIO | ||
|
||
fun saveDiagramToPng(project: Project) { | ||
val canvas = currentCanvas(project) | ||
val image = canvas.renderToBitmap() ?: return | ||
val descriptor = FileSaverDescriptor("Save Diagram To", "Save diagram to file", "png") | ||
val dialog = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, project) | ||
val dest = dialog.save(null, "diagram") ?: return | ||
ImageIO.write(image, "png", dest.file) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+426 Bytes
bpmn-intellij-plugin-core/src/main/resources/icons/actions/save-to-png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.61 KB
bpmn-intellij-plugin-core/src/main/resources/icons/actions/save-to-png_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters