Code Monkey home page Code Monkey logo

bcmeshtransformview's People

Contributors

choefele avatar ciechan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcmeshtransformview's Issues

Big image transformation

Hi, I want to apply mesh to big image (ex: 2000x2000), but I got crash:
Failed to bind EAGLDrawable: <CAEAGLLayer: 0x281e7c080> to GL_RENDERBUFFER 1
Failed to make complete framebuffer object 8cd6
What can I do?, tnx

Image not Load Properly (BCMeshTransformView)

Hey
I am using this Library last 2 years but recently I am facing some issues like when I try to load the image on BCMeshTransformView it shows me a white screen & sometimes it's working Perfectly, please let me know whats the issue & how can I solve this issue.

IMG_0106
Perfect Image

IMG_0107
Image With Issue.

Did the view refresh every second?

Hello,
When I add the UITableView to the BCMeshTransformView, the UITableView become very slow.
So I want to know if the BCMeshTransformView refresh the view every second.

Add antialiasing

The curtain demo is great but also it demonstrates the need for antialiasing in this framework.

Frame change while apply transformation

When i'm trying to apply mesh transformation on image, some part get modified but image's frame is also changed with it.
Can you suggest me way that doesn't change frame of image while applying mesh transform.

Simulator Screen Shot - iPhone Xส€ - 2019-09-06 at 10 59 04

increase curtain folding depth

thanks for developing this great framework.

I want to add more depth to curtain folds and change position of top and bottom of curtain to keep on with pan more.

I want to mimic like this video:
https://vine.co/v/Mh5qd0HEpnt

<iframe src="https://vine.co/v/Mh5qd0HEpnt/embed/simple" width="480" height="480" frameborder="0"></iframe><script src="https://platform.vine.co/static/scripts/embed.js"></script>

how can I achieve?

thanks

glReadPixel

Hi, I'm an newbie to gl. I wanna render to an image(not snapshot). I googled and found that glReadPixel meets my requirements. However it has some to do with FrameBuffer and I can't not find any trace of FrameBuffer in BCMeshTransformView.

Nothings showing

Hi,
I wanted to use your library into my swift project. I've created an empty swift project and added your library via cocoa pods.

Here's my ViewController class:

import UIKit
import BCMeshTransformView

class ViewController: UIViewController {
    
    var transformView:BCMeshTransformView!
    var imageView:UIImageView!
    var transform:BCMutableMeshTransform!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        transformView = BCMeshTransformView(frame: self.view.bounds)
        transformView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        
        imageView = UIImageView(image: UIImage(named: "picture.jpg")!)
        imageView.center = CGPoint(x: transformView.contentView.bounds.midX, y: transformView.contentView.bounds.midY)
        
        transformView.contentView.addSubview(imageView)
        
        transformView.diffuseLightFactor = 0.0
        
        transform = BCMutableMeshTransform.identityMeshTransform(withNumberOfRows: 20, numberOfColumns: 20)
        
        transform.mapVertices { (vertex, vertexIndex) -> BCMeshVertex in
            return BCMeshVertex(from: vertex.from, to: vertex.to)
        }
        
        transformView.meshTransform = transform
        
        self.view.addSubview(transformView)
    }

}

When I'm running the app nothing is showing. It's entirely white.

Removing this code:

transform = BCMutableMeshTransform.identityMeshTransform(withNumberOfRows: 20, numberOfColumns: 20)
        
transform.mapVertices { (vertex, vertexIndex) -> BCMeshVertex in
    return BCMeshVertex(from: vertex.from, to: vertex.to)
}
        
transformView.meshTransform = transform

doesn't change anything.

But when in xcode I'm switching to "Show UI hierarchy" I can see an image:

https://imgur.com/a/gLg66

Here's a whole sample project:

http://www116.zippyshare.com/v/IUTXbKJg/file.html

Why I cannot see anything? I tried making an example as simple as possible.

How to reverse ellipseMeshTransform vertex point?

In you example demo, you create a ellipseMeshTransform to map square to circular. So how can I get the square point from circular point?

+ (instancetype)ellipseMeshTransform
{
    BCMutableMeshTransform *transform = [BCMutableMeshTransform identityMeshTransformWithNumberOfRows:30 numberOfColumns:30];
    
    [transform mapVerticesUsingBlock:^BCMeshVertex(BCMeshVertex vertex, NSUInteger vertexIndex) {
        float x = 2.0 * (vertex.from.x - 0.5f);
        float y = 2.0 * (vertex.from.y - 0.5f);
        
        vertex.to.x = 0.5f + 0.5 * x * sqrt(1.0f - 0.5 * y * y);
        vertex.to.y = 0.5f + 0.5 * y * sqrt(1.0f - 0.5 * x * x);
        return vertex;
        
    }];
    
    return transform;
}

Take an screenshot

iOS 8 support

Does not appear to compile in xcode 6. Will there be an update?

GLKView: disable clipping to bounds

I have a problem with BCMeshTransformView, especially with GLKView inside, which renders this view. In my case MeshTransform vertices can be outside view bounds, but GLKView clips view to it's bounds. I've tried setting clipsToBounds to false in GLKView, BCMeshTransformView and contentView, but it's still clipping the content. Is there any way to fix this? The only thing I can imagine right now is to set frame to the parent frame, but it'll break tons of stuff in my code, because I'm extending BCMeshTransformView, make calculations based on it's frame, using gestures etc.

Render Transform View Hierarchy Offscreen

Hi,

I'm trying to use BCMeshTransformView to obtain a modified UIImage from an existing UIImage. My code looks like this:

- (UIImage *)addSmile:(UIImage *)inputImage {
    float scale = inputImage.scale;
    CGRect imageRect =  CGRectMake(0.f, 0.f, inputImage.size.width, inputImage.size.height );

    UIImageView *imageView = [[UIImageView alloc] initWithImage:inputImage];

    BCMeshTransformView *transformView = [[BCMeshTransformView alloc] initWithFrame:imageRect];
    transformView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    transformView.diffuseLightFactor = 0.0;
    transformView.meshTransform = [BCMutableMeshTransform buldgeMeshTransformAtPoint:CGPointMake(100, 100) withRadius:120.0 boundsSize:transformView.bounds.size];
    [transformView.contentView addSubview:imageView];

    UIView *containerView = [[UIView alloc] initWithFrame:imageRect];
    [containerView addSubview:transformView];

    UIGraphicsBeginImageContextWithOptions(workingImage.size, YES, scale);
      [containerView.layer renderInContext:UIGraphicsGetCurrentContext()];
      UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return outputImage;
}

When the references to the BCMeshTransformView are removed, outputImage is a copy of inputImage as expected. With the code above, outputImage is just a black rectangle with teh dimensions of inputImage.

Is BCMeshTransformView supposed to work in an offscreen context, or should I use a different approach to obtain a transformed UIImage?

Thanks very much!

Possible to have transform extend beyond BCMeshTransformView's bounds?

I am currently trying to have my mesh transform 'flex' or bend using bezier curves. I am able to have my 'flex inwards' happen, but if I try to flex the view upwards, it is clipped by the bounds of the view. In looking through the code, I see that contentViewWrapperView has it's clipsToBounds set to YES. Setting this value to NO seems to have the mesh transform not be applied. I was hoping for some insight on why this happens, and if there is a way to allow the mesh transform to not be clipped.

I do not believe this matters, but for clarification I am applying this flex using the animations added by this fork : https://github.com/KevinDoughty/BCMeshTransformView

Mesh transform on rotating control as in Apple's Camera app

Thanks for the great project Ciechan

I'm trying to create a rotating control as in at the bottom of Apple's Camera app:

screen shot 2014-09-22 at 09 46 13

However, I'm not able to get the math right. I guess it is similar to buldgeMeshTransformAtPoint although it doesen't buldge out in the center, but caves in towards the edges. Do you know the solution to this?

-Mathias

Circular Reference To BCMeshTransformView

It looks like the following line in BCMeshTransformView::CommonInit causes _display_link to hold a reference to the containing BCMeshTransformView. As a result, the transform view is never deallocated.

_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkTick:)];

I'm temporarily working around this by exposing a method that allows me to call:

[_display_link invalidate]

when I'm done with the transform view. It is then deallocated when I'm done referencing it.

If there's a better way to handle this, please make a suggestion and I'll code it up and open a pull request.

Thanks again for this very useful project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.