为什么和pthread_t是不透明类型?(Why and in what sense is pthread_t an opaque type?)
这里的帖子表明,
pthread_t
是一个不透明的类型,不是一个数字,当然不是一个线索索引,你不应该直接比较pthread_t等。问题:
为什么? 是否真的有意支持线程没有数字标识的系统? 当pthread_t实现简单时
typedef unsigned long int pthread_t;
?
怎么样? 在上面的一行之前有一条评论,所以它实际上是
/* Thread identifiers. The structure of the attribute type is not exposed on purpose. */ typedef unsigned long int pthread_t;
在
pthreadtypes.h
是什么意思? 什么属性类型? 这不是一个全局线程表的索引吗?Posts here on SO suggest that
pthread_t
is an opaque type, not a number, certainly not a thread index, that you shouldn't directly compare pthread_t's, etc. etc.Questions:
Why? Is there really the intent to support systems with no numeric IDs for threads? When the pthread_t implementation is simply
typedef unsigned long int pthread_t;
?
How? There's a comment before the above line, so it's actually
/* Thread identifiers. The structure of the attribute type is not exposed on purpose. */ typedef unsigned long int pthread_t;
in
pthreadtypes.h
what does that mean? What attribute type? Isn't this an index into some global table of threads?
原文:https://stackoverflow.com/questions/33285562
最满意答案
转到“报告属性”>“代码”并添加以下自定义代码:
Public Function hsl2htmlColor(ByVal h as Double, ByVal s as Double, ByVal l as Double) as string dim r as Double dim g as Double dim b as Double If s = 0 Then r = g = b = l Else dim q as Double If l < 0.5 Then q = l * (1 + s) Else q = l + s - l * s End If dim p as Double = 2 * l - q r = hue2rgb(p, q, h + 1/3) g = hue2rgb(p, q, h) b = hue2rgb(p, q, h - 1/3) End If return "#" & right("00" & Hex(r * 255) , 2) & right("00" & Hex(g * 255) , 2) & right("00" & Hex(b * 255) , 2) End Function Public Function hue2rgb(ByVal p as Double, ByVal q as Double, ByVal t as Double) as Double If t < 0 Then t += 1 If t > 1 Then t -= 1 If t < 1/6 Then return p + (q - p) * 6 * t If t < 1/2 Then return q If t < 2/3 Then return p + (q - p) * (2/3 - t) * 6 return p End Function
(示例)转到文本框属性并将以下表达式添加到“字体”>“颜色”。 每个参数的比例从0到1。
=Code.hsl2htmlColor(0.268 , 0.389 , 0.476)
Go to "Report Properties" > Code and add following custom code:
Public Function hsl2htmlColor(ByVal h as Double, ByVal s as Double, ByVal l as Double) as string dim r as Double dim g as Double dim b as Double If s = 0 Then r = g = b = l Else dim q as Double If l < 0.5 Then q = l * (1 + s) Else q = l + s - l * s End If dim p as Double = 2 * l - q r = hue2rgb(p, q, h + 1/3) g = hue2rgb(p, q, h) b = hue2rgb(p, q, h - 1/3) End If return "#" & right("00" & Hex(r * 255) , 2) & right("00" & Hex(g * 255) , 2) & right("00" & Hex(b * 255) , 2) End Function Public Function hue2rgb(ByVal p as Double, ByVal q as Double, ByVal t as Double) as Double If t < 0 Then t += 1 If t > 1 Then t -= 1 If t < 1/6 Then return p + (q - p) * 6 * t If t < 1/2 Then return q If t < 2/3 Then return p + (q - p) * (2/3 - t) * 6 return p End Function
(example) Go to your text box properties and add following expression to Font > Color. The scale for each argument is from 0 to 1.
=Code.hsl2htmlColor(0.268 , 0.389 , 0.476)
相关问答
更多-
HSL转换是否准确?(Is HSL conversion exact?)[2023-05-27]
nm是正确的 - “HSL可以代表每种RGB颜色,但HSL舍入到最接近的整数不能。” 我最后用我正在编写的颜色类做的是在内部将颜色存储为未连接的HSL。 然后,RGB和HSL的getter方法在调用时将它们舍入。 这样就可以改变色调和饱和度,甚至可以改变RGB颜色,而不会产生不准确的转换。 仍然无法准确转换圆形RGB和圆形HSL,因此解决方案是简单地永远不会将圆形RGB转换为圆形HSL。 n.m. is correct—"HSL can represent every RGB color, but HSL ... -
Garry Tan在他的博客上发布了一个Javascript解决方案(他归因于一个现在已经失效的mjijackson.com, 但存档在这里 , 原作者有一个要点 - 感谢user2441511)。 代码重新发布如下: HSL到RGB: /** * Converts an HSL color value to RGB. Conversion formula * adapted from http://en.wikipedia.org/wiki/HSL_color_space. * Assumes h, ...
-
动画中的HSL颜色模型(HSL color models in animation)[2022-07-25]
颜色插值在SVG规范中定义。 基本上,距离是RGB颜色空间中颜色之间的标准矢量距离。 即使您现在可以在大多数UA中指定HSL中的结束状态,您也不会获得HSL插值。 您的HSL端点颜色将转换为RGB,然后插值将在RGB颜色空间中进行。 interpolation of colours is defined in the SVG specification. Basically distance is the standard vector distance between the colours in the ... -
Javascript - 匹配并使用Regex解析Hsl颜色字符串(Javascript - Match and parse Hsl color string with Regex)[2023-03-27]
这可能是我处理它的方式 /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g This is probably how I'd handle it /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g -
从HSL获取颜色名称(Get color name from HSL)[2024-03-03]
你可以尝试使用这样的东西? yourColor = 0xFF0000; System.Drawing.Color myColor = System.Drawing.Color.FromArgb(yourColor); You could try using something like this? yourColor = 0xFF0000; System.Drawing.Color myColor = System.Drawing.Color.FromArgb(yourColor); -
如何通过HSL颜色着色?(How to colorize via HSL colors?)[2023-06-30]
我假设,无论你最终使用的是什么样的地图,你都希望将黑色映射为黑色,将白色映射为白色并将灰色映射为灰色。 添加剂映射 H'= H +(H 靶 - H 碱 ) (使用环绕)你用于色调确实可能没问题。 对于饱和度,保留灰度值的需要表明乘法映射 S'= S *(S target / S base ), 值超过100%的饱和度被削减。 但是,对于亮度,线性贴图不会这样做,因为您想要在调整中间值时同时修复0%和100%亮度。 一个自然的选择可能是伽马型地图,即 L'= pow(L,log(L target )/ log ... -
SSRS HSL颜色表达(SSRS HSL color expression)[2022-02-06]
转到“报告属性”>“代码”并添加以下自定义代码: Public Function hsl2htmlColor(ByVal h as Double, ByVal s as Double, ByVal l as Double) as string dim r as Double dim g as Double dim b as Double If s = 0 Then r = g = b = l Else dim q as Double ... -
经过一夜的调试,我已经成立了我的问题答案。 感谢国王萨勒莫从这个话题 图表正在执行的算法,执行以下步骤: 获得他们感兴趣的基色RGB(例如Accent 3) 转换为HSL 将L分量乘以lumMod 将lumOff添加到L组件 转换回RGB 相同的逻辑也适用于satMod,satOff,hueMod和hueOff。 但对于rgb-color,它只有一个值适用于所有级别(如(255,255,255)或(123,123,123))我将lumMod更改为lumMod = lumMod - 0.04(+-0.005) ...
-
转换为线性RGB没有多大意义,因为HSL是根据伽马编码值定义的。 相反,编写自己的函数将sRGB转换为HSL,用这些值调整饱和度(允许可能超出色域饱和度值),然后转换回sRGB,超出sRGB范围的钳位强度(或不允许饱和度变化无法在sRGB中编码)。 It doesn't make much sense to convert to linear RGB, since HSL is defined in terms of gamma encoded values. Instead, write your own ...
-
jQuery颜色插件HSL模型(jQuery colors plugin HSL model)[2023-06-19]
从源头来看,Hue的预期范围确实在0-360之间。 “Hue可以设置为0到100,它不接受超出此范围的值” 那是因为验证码中存在错误 。 该行应该是: if ((a == 1 && result[a] <= 360) || (a > 1 && result[a] <= 100)) { a[1]保持第一个正则表达式模式的捕获值(匹配第一个arg, H ),而不是a[0] 。 为了说明,这里有一个小提琴: http : //jsfiddle.net/vMLZ2/ ps我已经提交了修复的拉取请求 。 与此同时, ...