rgba

What does a correct call to CGImageCreate look like if the data provider for it uses an array created by the app?

风格不统一 提交于 2019-12-06 19:31:31
问题 I'm trying to create a bitmap in memory as part of a pattern function that a drawLayer:inContext: method (this method is part of the CALayer delegate protocol) will call. The pattern function looks similar to this: static const size_t kComponentsPerPixel = 4; static const size_t kBitsPerComponent = sizeof(unsigned char) * 8; NSInteger layerHeight = 160; NSInteger layerWidth = 160; CGContextSaveGState(context); CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); size_t bufferLength =

How do you calculate overlapping rgba values?

不问归期 提交于 2019-12-06 17:33:28
Let's say I have this: .example { background-color: rgba(0, 0, 0, 0.5); border-color: rgba(0, 0, 0, 0.5); } The background-color and border-color have the same rgba value, but are different colors because the border-color is calculated on top of the background-color. (simple example: http://jsfiddle.net/BBdB3/ ) What transparency value for the border-color would make it match the background-color? What's the math here? Edit: thanks guys, using rgba(0, 0, 0, 0) or transparency is sufficient for my first example, but I still have a problem. ( http://jsfiddle.net/CPK7L/2/ ). In this case I need

Calculate source RGBA value from overlay

≡放荡痞女 提交于 2019-12-06 14:52:06
The title looks a bit weird, so here is a sample: You will probably be familiar with the Windows 7 Explorer. When you select something with the pressed left mouse button, you get a blue half transparent rectangle. So the question is now: It is possible to calculate the source RGBA color that was used to draw this rectangle? The only things I know is the RGB value from the background and the RGB value with the blue overlay. Here is a screenshot from what I mean: No, it ist not possible from a single image. You need the target data over a black and a white image (best case). After that, you need

Use HEX or RGBA

别说谁变了你拦得住时间么 提交于 2019-12-06 09:33:06
I've a simple question: If I'm not going to use Alpha on RGBA, for some colors, should I use HEX on these colors? Is there something HEX has that RGBA doesn't? Like browser compatibility, for example? Or is it just fine to use RGBA all the time? I find it better, cause if I would want to use Alpha, I could. Thanks in advance. Both should be compatible with any standards-compliant browser. Edit: There might be some buggy behavior in IE (suprise!): http://css-tricks.com/ie-background-rgb-bug/ When using RGBA, I believe the correct syntax is to use R, G, B values. Hence the name. I've not tried

RGBa in Internet Explorer

↘锁芯ラ 提交于 2019-12-06 05:37:04
问题 I know that IE does not support RGBa. I also know that you can use the follow methods: /* For IE 5.5 - 7*/ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000); /* For IE 8*/ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)"; The first two Numbers in the "Colorstr" is the value for the opacity. with 99 being a .6 opacity. For other levels of opacity what are the number values? I cannot find

What is PixelFormat.RGBX_888

左心房为你撑大大i 提交于 2019-12-05 10:02:17
As the title said, anyone know what is RGBX_8888 pixel format? and what is the difference with RGBA_8888? Is RGBA_8888 offers an alpha channel but RGBX_8888 does not? The android documentation does not give much information on this unfortunately. Thanks. RGBX means, that the pixel format still has an alpha channel, but it is ignored, and is always set to 255. Some reference: Blackberry PixelFormat (It is not android, however I guess that the naming conventions stay same across platforms.) The RGBX 32 bit RGB format is stored in memory as 8 red bits, 8 green bits, 8 blue bits, and 8 ignored

How to handle alpha in a manual “Overlay” blend operation?

浪尽此生 提交于 2019-12-05 02:03:44
问题 I'm playing with some manual (walk-the-pixels) image processing, and I'm recreating the standard "overlay" blend. I'm looking at the "Photoshop math" macros here: http://www.nathanm.com/photoshop-blending-math/ (See also here for more readable version of Overlay) Both source images are in fairly standard RGBA (8 bits each) format, as is the destination. When both images are fully opaque (alpha is 1.0), the result is blended correctly as expected: But if my "blend" layer (the top image) has

What does a correct call to CGImageCreate look like if the data provider for it uses an array created by the app?

我的梦境 提交于 2019-12-05 00:52:26
I'm trying to create a bitmap in memory as part of a pattern function that a drawLayer:inContext: method (this method is part of the CALayer delegate protocol) will call. The pattern function looks similar to this: static const size_t kComponentsPerPixel = 4; static const size_t kBitsPerComponent = sizeof(unsigned char) * 8; NSInteger layerHeight = 160; NSInteger layerWidth = 160; CGContextSaveGState(context); CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); size_t bufferLength = layerWidth * layerHeight * kComponentsPerPixel; unsigned char *buffer = malloc(bufferLength); // The real

iPhone App - Display pixel data present in buffer on screen

蓝咒 提交于 2019-12-04 23:29:49
I have the source code for a video decoder application written in C, which I'm now porting on iphone. My problem is as follows: I have RGBA pixel data for a frame in a buffer that I need to display on the screen. My buffer is of type unsigned char. (I cannot change it to any other data type as the source code is too huge and not written by me.) Most of the links I found on the net say about how to "draw and display pixels" on the screen or how to "display pixels present in an array", but none of then say how to "display pixel data present in a buffer". I'm planning to use quartz 2D. All I need

Why do browsers render rgba differently on OSX?

走远了吗. 提交于 2019-12-04 13:37:05
问题 I was trying to code up some color manipulation code and was stuck for a long time with alpha, then I (2 hours later) realized browsers render rgba differently. I created this test: http://jsbin.com/adekez/2/ add /edit to look at the code Here are the results in 4 browsers in OSX Lion: http://imgur.com/g2iqu That is an element with a background of rgba(0,0,0,0.5) on top of white. My hex calculator says: FF÷2 = 7F.8 which means Safari at #808080 is correct Firefox at #7F7F7F is off by 1 Opera