Working with Other Node Types II
【Working with Other Node Types II】
An SKCropNode object does not directly render content, like a sprite node. Instead, it alters the behavior of its children when they are rendered. A crop node crops out portions of the content rendered by the children.
Listing 6-8 shows a simple use of a mask. This code loads a mask image from a texture in the app bundle. A portion of the scene’s content is then rendered, using the mask to prevent it from overdrawing the portion of the screen that the game uses to show controls.
When the crop node is rendered, the mask is rendered before the descendants are drawn. Only the alpha component of the resulting mask is relevant. Any pixel in the mask with an alpha value of 0.05 or higher is rendered. All other pixels are cropped.
【Effect Nodes Apply Special Effects to Their Descendants】
An SKEffectNode object does not draw content of its own. Instead, each time a new frame is rendered using the effect node, the effect node follows these steps:
- Draws its children into a private framebuffer.
- Applies a Core Image effect to the private framebuffer. This stage is optional.
- Blends the contents of its private framebuffer into its parent’s framebuffer, using one of the standard sprite blend modes.
- Discards its private framebuffer.
You’ve learned a lot about the SKScene class already, but you may not have noticed that it is a subclass of SKEffectNode. This means that any scene can apply a filter to the contents. Although applying filters can be very expensive—not all filters are well designed for interactive effects—experimentation can help you find some interesting ways to use filters.
If the content of the effect node is static, you can set the node’s shouldRasterize property to YES. Setting this property causes the following changes in behavior:
- The framebuffer is not discarded at the end of rasterization. This also means that more memory is being used by the effect node, and rendering may take slightly longer.
- When a new frame is rendered, the framebuffer is rendered only if the content of the effect node’s descendants have changed.
- Changing the Core Image filter’s properties no longer causes the framebuffer to automatically be updated. You can force it to be updated by setting the shouldRasterize property to NO.
Working with Other Node Types II的更多相关文章
- Working with Other Node Types
[Working with Other Node Types] [Shape Nodes Draw Path-Based Shapes] The SKShapeNode class draws a s ...
- LeetCode:Populating Next Right Pointers in Each Node I II
LeetCode:Populating Next Right Pointers in Each Node Given a binary tree struct TreeLinkNode { TreeL ...
- [LeetCode 116 117] - 填充每一个节点的指向右边邻居的指针I & II (Populating Next Right Pointers in Each Node I & II)
问题 给出如下结构的二叉树: struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } ...
- Populating Next Right Pointers in Each Node I&&II ——II仍然需要认真看看
Populating Next Right Pointers in Each Node I Given a binary tree struct TreeLinkNode { TreeLinkNode ...
- 【leetcode】Populating Next Right Pointers in Each Node I & II(middle)
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *nex ...
- leetcode@ [116/117] Populating Next Right Pointers in Each Node I & II (Tree, BFS)
https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/ Follow up for problem ...
- LeetCode 题解:Populating Next Right Pointers in Each Node I & II 二有难度。考虑不全面。
每次应该把root同层的右侧节点传过来.如果没有,就传NULL. 同时,应该是先右后左. 感觉这次的代码还挺简洁的.. void construct(struct TreeLinkNode *root ...
- Populating Next Right Pointers in Each Node I, II——生成next树
1. Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode * ...
- tbb flow graph node types
随机推荐
- 线程——QQ邮件发送
一.造一个QQ邮件发送的窗体 二.开始编写关于邮件发送的代码,以及当点发送按钮的时候,给发送按钮单独造了一个新的线程.这样如果发送的附件太多的话,如果不给发送按钮造新的线程,便会卡住,但是如果给发送按 ...
- Spring MVC文件下载
方案一: // 文件下载 @RequestMapping(value = "/downloadFile") public ResponseEntity<byte[]> ...
- 涵盖网站基本使用的正则表达式的验证方法.cs
using System; using System.Text.RegularExpressions; using System.Text; using System.IO; using System ...
- BZOJ 1106 立方体大作战
BIT. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm&g ...
- BZOJ 1787 紧急集合
LCA.注意细节. #include<iostream> #include<cstdio> #include<cstring> #include<algori ...
- POJ 1201 Intervals (差分约束,最短路)
题意: 有一个集合Z,其元素都是整整数,但是数量未知.现有n个约束,形如 [a,b]=c 表示整数区间[a,b]中有c个元素在Z中出现.问集合Z最小可能含多少个元素? 思路: 对于所给的区间 cnt[ ...
- (四)Logistic Regression
1 线性回归 回归就是对已知公式的未知参数进行估计.线性回归就是对于多维空间中的样本点,用特征的线性组合去拟合空间中点的分布和轨迹,比如已知公式是y=a∗x+b,未知参数是a和b,利用多真实的(x,y ...
- 【解题报告】[动态规划] RQNOJ PID106 / 最大加权矩形
原题地址:http://www.rqnoj.cn/problem/106 解题思路: 一维的情况下求最大字串和的状态转移方程是:s[i]=max{s[i-1]+a[i],a[i]} 二维的情况下,只要 ...
- 标准IO库函数复习
打开文件,打开文件一定要成对写,养成好习惯很重要.比如 fopen()fclose<ol> <li>fopen()</li> <pre lang=" ...
- Fidder 监控WCF
Client端配置 <?xml version="1.0" encoding="utf-8" ?> <configuration> &l ...