Skip to content

Commit dc3b24f

Browse files
committed
inpaint history
1 parent d71547a commit dc3b24f

File tree

2 files changed

+19
-48
lines changed

2 files changed

+19
-48
lines changed

electron_app/src/components/Inpainting.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ export default {
8888
return {
8989
prompt: "",
9090
inp_img : "",
91-
91+
input_img_orig : "", // the first input image after reset
9292
backend_error : "",
9393
done_percentage : -1,
9494
is_stopping : false,
9595
undo_history : [],
9696
retry_params: undefined,
9797
stroke_size_no : "30",
98+
"history_key" : "",
9899
};
99100
},
100101
methods: {
@@ -165,6 +166,18 @@ export default {
165166
on_img(img_path){
166167
that.inp_img = img_path
167168
that.$refs.inp_img_canvas.clear_inpaint()
169+
170+
if(that.history_key ){
171+
let p = {
172+
"prompt": "Inpainting: " + that.prompt , "key":that.history_key , "imgs" : [img_path] , "inp_img": that.input_img_orig,
173+
"model_version": that.stable_diffusion.model_version , "guidence_scale" : that.guidence_scale ,
174+
}
175+
Vue.set(that.app_state.app_data.history, that.history_key , p );
176+
}
177+
178+
179+
180+
168181
},
169182
on_progress(p){
170183
that.done_percentage = p;
@@ -185,6 +198,8 @@ export default {
185198
set_inp_image(img_path){
186199
this.inp_img = img_path;
187200
this.undo_history = []
201+
this.input_img_orig = img_path
202+
this.history_key = Math.random()+"inp"
188203
189204
if(this.$refs.inp_img_canvas){
190205
this.$refs.inp_img_canvas.clear_inpaint()
@@ -239,6 +254,8 @@ export default {
239254
this.inp_img = ""
240255
this.undo_history = []
241256
this.prompt = ""
257+
this.input_img_orig = ""
258+
this.history_key = ""
242259
this.retry_params = undefined
243260
},
244261

electron_app/src/components/Outpainting.vue

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<LoaderModal :loading_percentage="done_percentage" loading_title="Generating" :loading_desc="stable_diffusion.generation_state_msg"></LoaderModal>
4444
</div>
4545

46+
<p style="opacity:0.5; zoom:0.8"> Please describe image you want to draw in the box. </p>
4647

4748
</div>
4849
</template>
@@ -418,54 +419,7 @@ export default {
418419
this.add_img_to_stage(img_path, true)
419420
},
420421
421-
422-
423-
// get_mask_of_box(){
424-
// let s = this.stage.scale().x
425-
// let data_uri = this.images_layer.toDataURL({
426-
// pixelRatio: 3 ,
427-
// x: this.box.x() * s ,
428-
// y: this.box.y() * s ,
429-
// width: this.box.width() * s ,
430-
// height: this.box.height() * s } );
431-
432-
// let canvas = document.createElement('canvas');
433-
// canvas.width = this.box.width() * s * 3
434-
// canvas.height = this.box.height() * s *3
435-
436-
// let ctx = canvas.getContext("2d");
437-
438-
// ctx.filter = ' grayscale(1) brightness(10000) contrast(10000)'; // blur('+filt_w+'px)
439-
// ctx.fillStyle = "black";
440-
// ctx.fillRect(0, 0, canvas.width, canvas.height);
441-
442-
// let myImage = new Image();
443-
// myImage.src = data_uri;
444-
445-
// myImage.onload = function() {
446-
// ctx.drawImage(myImage , 0, 0);
447-
// data_uri = canvas.toDataURL();
448-
// let img_url = window.ipcRenderer.sendSync('save_b64_image', data_uri , true );
449-
// console.log(img_url)
450-
// };
451-
// },
452-
453422
do_undo(){
454-
// if(! this.prev_canvas_b64)
455-
// return;
456-
// let myImage = new Image();
457-
// myImage.src = this.prev_canvas_b64 ;
458-
// let that = this;
459-
// myImage.onload = function() {
460-
// var kimg = new Konva.Image({
461-
// x: 0,
462-
// y: 0,
463-
// image: myImage,
464-
// width: 300,
465-
// height: 300,
466-
// });
467-
// that.images_layer.add(kimg)
468-
// }
469423
this.freeze_last_resizable_img()
470424
let im = this.undo_history.pop()
471425
im.img.destroy()

0 commit comments

Comments
 (0)