菜单

manbetx网页手机登录版倒影效果,给风景照做水中倒影效果教程

2019年5月13日 - UNIXSolaris
const CGFloat kReflectPercent = -0.25f;
const CGFloat kReflectOpacity = 0.3f;
const CGFloat kReflectDistance = 10.0f;
+ (void) addSimpleReflectionToView: (UIView *) theView
{
    CALayer *reflectionLayer = [CALayer layer];
    reflectionLayer.contents = [theView layer].contents;
    reflectionLayer.opacity = kReflectOpacity;
    reflectionLayer.frame = CGRectMake(0.0f, 0.0f,
        theView.frame.size.width, 
        theView.frame.size.height * kReflectPercent);
    CATransform3D stransform = CATransform3DMakeScale(1.0f, -1.0f, 1.0f);
    CATransform3D transform = CATransform3DTranslate(stransform, 0.0f,
        -(kReflectDistance + theView.frame.size.height), 0.0f);
    reflectionLayer.transform = transform;
    reflectionLayer.sublayerTransform = reflectionLayer.transform;
    [[theView layer] addSublayer:reflectionLayer];
}

+ (CGImageRef) createGradientImage: (CGSize)size
{
    CGFloat colors[] = {0.0, 1.0, 1.0, 1.0};
    // Create gradient in gray device color space
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
    CGContextRef context = CGBitmapContextCreate(nil, size.width,
        size.height, 8, 0, colorSpace, kCGImageAlphaNone);
    CGGradientRef gradient =
        CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2);
    CGColorSpaceRelease(colorSpace);
    // Draw the linear gradient
    CGPoint p1 = CGPointZero;
    CGPoint p2 = CGPointMake(0, size.height);
    CGContextDrawLinearGradient(context, gradient, p1, p2,
        kCGGradientDrawsAfterEndLocation);
    // Return the CGImage
    CGImageRef theCGImage = CGBitmapContextCreateImage(context);
    CFRelease(gradient);
    CGContextRelease(context);
    return theCGImage;
}
// Create a shrunken frame for the reflection
+ (UIImage *) reflectionOfView: (UIView *)theView
    withPercent: (CGFloat) percent
{
    // Retain the width but shrink the height
    CGSize size = CGSizeMake(theView.frame.size.width,
    theView.frame.size.height * percent);
    // Shrink the view
    UIGraphicsBeginImageContext(size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [theView.layer renderInContext:context];
    UIImage *partialimg =
    UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    // build the mask
    CGImageRef mask = [ImageHelper createGradientImage:size];
    CGImageRef ref = CGImageCreateWithMask(partialimg.CGImage, mask);
    UIImage *theImage = [UIImage imageWithCGImage:ref];
    CGImageRelease(ref);
    CGImageRelease(mask);
    return theImage;
}
const CGFloat kReflectDistance = 10.0f;
+ (void) addReflectionToView: (UIView *) theView
{
    theView.clipsToBounds = NO;
    UIImageView *reflection = [[UIImageView alloc] initWithImage:
    [ImageHelper reflectionOfView:theView withPercent: 0.45f]];
    CGRect frame = reflection.frame;
    frame.origin = CGPointMake(0.0f, theView.frame.size.height +
        kReflectDistance);
    reflection.frame = frame;
    // add the reflection as a simple subview
    [theView addSubview:reflection];
    [reflection release];
}
//该片段来自于http://outofmemory.cn

本条水中倒影效果首要由PS的自带滤镜制作出来,方法也很轻便,复制原图一部分反而,然后用滤镜制作出水波纹效果即可,方法差不离,效果相当好,分享给大家学习啊。先看下最终效果图:

manbetx网页手机登录版 1

<原图>

manbetx网页手机登录版 2

一.怎样成立三个水中倒影 步骤1

咱俩的教学是在ps cc
2017版本下制作的,首先张开你供给管理的景物照片,复制背景图层。

manbetx网页手机登录版 3

步骤2

运用矩形选框工具(M),选拔须要处理成倒影的部份,Ctrl+c,Ctrl+v复制粘贴产生新的图层。

manbetx网页手机登录版 4

步骤3

慎选图像-画布大小,调治画布的万丈。然后编辑-变化-垂直翻转。

manbetx网页手机登录版 5

manbetx网页手机登录版 6

步骤4

转到编辑>变化>透视对图层进行调换。抓住左下角的把手,然后向左拖动。
请注意,右角也会活动,使图层具备透视效果。 按回车键确认调换。

manbetx网页手机登录版 7

manbetx网页手机登录版 8

课程未完,请看下1页!

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图