#ifndef SkDeviceProperties_DEFINED
#define SkDeviceProperties_DEFINED
//TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and remove this import.
#include "SkFontLCDConfig.h"
struct SkDeviceProperties {
struct Geometry {
/** The orientation of the pixel specifies the interpretation of the
* layout. If the orientation is horizontal, the layout is interpreted as
* left to right. It the orientation is vertical, the layout is
* interpreted top to bottom (rotated 90deg cw from horizontal).
*/
enum Orientation {
kUnknown_Orientation = 0x0,
kKnown_Orientation = 0x2,
kHorizontal_Orientation = 0x2, //!< this is the default
kVertical_Orientation = 0x3,
kOrientationMask = 0x3,
};
/** The layout of the pixel specifies its subpixel geometry.
*
* kUnknown_Layout means that the subpixel elements are not spatially
* separated in any known or usable fashion.
*/
enum Layout {
kUnknown_Layout = 0x0,
kKnown_Layout = 0x8,
kRGB_Layout = 0x8, //!< this is the default
kBGR_Layout = 0xC,
kLayoutMask = 0xC,
};
Orientation getOrientation() {
return static_cast<Orientation>(fGeometry & kOrientationMask);
}
Layout getLayout() {
return static_cast<Layout>(fGeometry & kLayoutMask);
}
bool isOrientationKnown() {
return SkToBool(fGeometry & kKnown_Orientation);
}
bool isLayoutKnown() {
return SkToBool(fGeometry & kKnown_Layout);
}
private:
//TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and replace these calls with constants.
static Orientation fromOldOrientation(SkFontLCDConfig::LCDOrientation orientation) {
switch (orientation) {
case SkFontLCDConfig::kHorizontal_LCDOrientation: return kHorizontal_Orientation;
case SkFontLCDConfig::kVertical_LCDOrientation: return kVertical_Orientation;
default: return kUnknown_Orientation;
}
}
static Layout fromOldLayout(SkFontLCDConfig::LCDOrder order) {
switch (order) {
case SkFontLCDConfig::kRGB_LCDOrder: return kRGB_Layout;
case SkFontLCDConfig::kBGR_LCDOrder: return kBGR_Layout;
default: return kUnknown_Layout;
}
}
public:
static Geometry MakeDefault() {
Orientation orientation = fromOldOrientation(SkFontLCDConfig::GetSubpixelOrientation()); //kHorizontal_Orientation
Layout layout = fromOldLayout(SkFontLCDConfig::GetSubpixelOrder()); //kRGB_Layout
Geometry ret = { SkToU8(orientation | layout) };
return ret;
}
static Geometry Make(Orientation orientation, Layout layout) {
Geometry ret = { SkToU8(orientation | layout) };
return ret;
}
uint8_t fGeometry;
};
static SkDeviceProperties MakeDefault() {
SkDeviceProperties ret = { Geometry::MakeDefault(), SK_GAMMA_EXPONENT };
return ret;
}
static SkDeviceProperties Make(Geometry geometry, SkScalar gamma) {
SkDeviceProperties ret = { geometry, gamma };
return ret;
}
/** Each pixel of an image will have some number of channels.
* Can the layout of those channels be exploited? */
Geometry fGeometry;
/** Represents the color space of the image. This is a woefully inadequate beginning. */
SkScalar fGamma;
};
#endif
没有合适的资源?快使用搜索试试~ 我知道了~
xt_string.rar_Separated
共2个文件
c:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 83 浏览量
2022-09-19
22:10:56
上传
评论
收藏 2KB RAR 举报
温馨提示
TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel and remove this import.kUnknown_Layout means that the subpixel elements are not spatially separated in any known or usable fashion.
资源推荐
资源详情
资源评论
收起资源包目录
xt_string.rar (2个子文件)
SkDeviceProperties.c 4KB
xt_string.c 1KB
共 2 条
- 1
资源评论
小波思基
- 粉丝: 72
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功