问题标签 [quartz-graphics]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
3827 浏览

iphone - 更改图像时清除 CATiledLayers 缓存

我有一个带有单个子视图的 UIScrollView,一个由 CATiledLayer 支持的 UIView。除了一个例外,一切都运行良好:当我将图像从一个更改为另一个时,CATiledLayer 会缓存以前的图像缩放级别。滚动然后在更新的图像加载之前显示旧图像一瞬间。

有没有办法完全清除 CATiledLayer 的缓存,使其不显示旧图像?CATiledLayer 显然知道背景图像发生了变化,因为它要求它的代表提供新的瓷砖......

0 投票
2 回答
3585 浏览

iphone - 在 iPhone 上使 UIImageView 不透明的问题

尽可能少地进行 alpha 混合是 iPhone 上表格视图单元格的重要性能考虑因素。我有主要由一个大图像视图组成的表格单元格。我已经将 UIImageView 设置为不透明,无论是在 Interface Builder 中还是以编程方式,但 CoreAnimation 工具仍然显示它正在被 alpha 混合。

有没有办法让 UIImageViews 实际上不透明,还是我必须进行自定义绘图以防止混合?

0 投票
1 回答
1238 浏览

iphone - iPhone 对象分配,GeneralBlock-24 & GeneralBlock-48

启动 iPhone 应用程序后,我有 3 次内存泄漏。无论我在应用程序中做什么,这些都保持不变(不再泄漏)。

我的净对象分配不断增长。特别是有两个块,GeneralBlock-24 和 GeneralBlock-48。

当程序被使用时,Block-48 变得特别糟糕,占用了兆字节的内存。似乎在两个块中分配对象的库是 QuartzCore。

该应用程序引用了 QuartzCore 框架,但我删除了所有对它的引用。

ps:这都是在设备上,不是模拟器

0 投票
2 回答
1055 浏览

iphone - 如何使 iPhone 上的子视图为屏幕的一部分着色?

我想编写一个 UIView 子类,除其他外,将其下方的任何内容着色为某种颜色。这是我想出的,但不幸的是它似乎无法正常工作:

我希望“MyOtherView”在它重叠的地方将“MyView”涂成红色,但它只是在上面绘制一个不透明的红色块。但是,如果我从“MyOtherView”复制 -drawRect: 函数并将其附加到“MyView”中的函数,这似乎可以正常工作(这让我很头疼最终意识到)。有人知道我在做什么错吗?甚至有可能做到这一点,还是我应该以不同的方式接近它?

0 投票
2 回答
14505 浏览

iphone - Drawing woes with CALayer

First of all, im finding the iPhone online docs to be not-so-very thoroughly clear when it comes to the various ways of rendering a layer. I get the jist of it, but im not clear when to use which methods and which requires the layer to be added as a sub layer or not.

My project started off trivially with me loading images and simply drawing them to a UIView via [image drawAtPoint:] as well as [image drawInRect:]. These work fine using the current graphics context.

Then today i happened to read this concept of using layers so that animating my various images (implicitly) would in theory be a breeze!

For the record, i know the docs say subclassing CALayer is unecessary, but i did just that. Now I am incredibly confused about the different ways to supposedly render a layer.

  • drawLayer
  • displayLayer
  • display
  • drawInContext

Now for all of these methods, is it required to set the layer's frame size? Is it required to add a layer to a view's layer?

The only method that gives me visible results is the drawinContext method. But if i apply an implicit animation (e.g. image.opacity = 0) nothing happens, which makes me believe my layer is not properly set up.

Some one please bring order back to this chaos.

0 投票
1 回答
142 浏览

iphone - iphone和mac上quartz2d的区别

iphone和mac上的quartz2d有区别吗?我在哪里可以找到它的清单?我在亚马逊创建的每一本书都致力于在 mac 上编程石英。

0 投票
1 回答
549 浏览

iphone - CGMutablePathRef 内存管理

完成后是否需要发布 CGMutablePathRef?如果是这样,怎么做?

0 投票
4 回答
17987 浏览

iphone - 如何在尊重图像的 alpha 蒙版的同时在 UIImage 上绘制形状

我需要一个 UIImageView 可以根据标志以彩色或黑白方式绘制自己:

我试图通过在石英混合模式设置为颜色的原始图像上绘制一个黑色矩形来做到这一点。这有效,只是它不尊重图像的 alpha 蒙版。

参见插图: 替代文字 http://img214.imageshack.us/img214/1407/converttogreyscaleillo.png

搜索谷歌和 SO,我找到并尝试了几种解决方案,但也没有一个尊重面具。

这是生成上面“我得到的”图像的代码:

是否有一些我忘记设置的 Quartz 绘图模式?我已经查看了 Quartz Programming Guide,但是很难从重叠和超链接的主题中提取您需要的一点信息。

显然,我正在寻找一种适用于任何蒙面形状的图像的通用解决方案,而不仅仅是显示的圆圈。

0 投票
1 回答
389 浏览

iphone - 哪个更快?使用 Quartz & CGRects 与数组 UIImageViews

只是想知道天气会更快,如果你有很多(大约几百到一千)2D 图像,使用 Quartz 或 UIImageViews 数组。干杯!

0 投票
1 回答
77 浏览

graphics - 使图片看起来像插图

我想知道是否有人知道如何转换图像以使其看起来“嵌入”到上下文中?

我需要我正在编写的应用程序的效果,但我不确定实现上述效果的确切工作流程是什么。

最好的问候,海因里希