adamwulf / JotUI

OpenGL based drawing view built for and used by Loose Leaf for iPad
http://getlooseleaf.com/opensource/
MIT License
268 stars 28 forks source link

When I get screenshot, I get every line drawn in only 1 brush image but I have used different brushes image #10

Closed KrLikeblue closed 7 years ago

KrLikeblue commented 7 years ago

Hello,

I have used 4 different images as brush and I am passing brush images in "+ (UIImage*)circleBrushTexture" function when user select different brush images.

So I can draw lines with different brush images. perfect and all credit goes to you :)

But when I try to save JotView , it save the image, but in saved image what i can see is all lines are drawn using last brush which i have used.

I debug "- (JotSharedBrushTexture*)brushTexture" function and what i found is, it uses last JotGLContext while saving.

So any idea, how to get lines drawn by their respective brushes in screenshot ?

I have not created different class for different brush. I am just passing brush image in "+ (UIImage*)circleBrushTexture" function.

I am using only Pen(Pen.h and Pen.m) tool for drawing.

Will I have to create different classes for different brush images ? If yes can you explain me step by step how to achieve that and how many classes I will have to generate ?

Thanks.

KrLikeblue commented 7 years ago

I am sorry Adam, if I am annoying you but I really want to understand how your code works. I am working 15 hours a day to just understand your code and solving bugs. So thanks for helping me.

adamwulf commented 7 years ago

By all means, keep the questions coming as they pop up :) This library has been used by only a few other folks by this point, so the more feedback I get the better I can help make it for a wider variety of use cases

To change the texture of the stroke, you'll need to create a JotBrushTexture object for each different brush type. You can mirror it on how JotHighlighterBrushTexture uses a png file as it's brush type.

Then, return that new texture object in JotView's delegate -[textureForStroke] method, and it'll save each texture per stroke.

KrLikeblue commented 7 years ago

It worked. It worked. It worked :) :) :) :)

You are amazing Adam.. awesome..It worked... I was thinking same but I thought let me ask you first.

Really awesome Brother!!!

Thanks

adamwulf commented 7 years ago

glad to hear it! :)