本文整理汇总了C++中render_context类的典型用法代码示例。如果您正苦于以下问题:C++ render_context类的具体用法?C++ render_context怎么用?C++ render_context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了render_context类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: apply
bool paint::apply(const element* parent, render_context& ctx) const
{
switch(color_attrib_) {
case ColorAttrib::NONE:
// Nothing to do if there is no color.
return false;
case ColorAttrib::CURRENT_COLOR: {
auto cc = ctx.get_current_color();
ASSERT_LOG(cc != NULL, "Current color specified as color source, but there is no current color value.");
cairo_set_source_rgb(ctx.cairo(), cc->r(), cc->g(), cc->b());
return true;
}
case ColorAttrib::FUNC_IRI:
ASSERT_LOG(false, "XXX: todo: lookup FUNC_IRI to get color value");
return true;
case ColorAttrib::ICC_COLOR:
ASSERT_LOG(false, "XXX: todo: ICC_COLOR to get color value");
return true;
case ColorAttrib::INHERIT:
// XXX: Nothing to do?
return true;
case ColorAttrib::VALUE:
double opacity = ctx.opacity_top();
cairo_set_source_rgba(ctx.cairo(), color_value_.r(), color_value_.g(), color_value_.b(), opacity);
return true;
}
return false;
}
开发者ID:AsKorysti,项目名称:anura,代码行数:28,代码来源:svg_paint.cpp
示例2: handle_apply
void handle_apply(render_context& ctx) override {
if(std::abs(cx_) < DBL_EPSILON && std::abs(cy_) < DBL_EPSILON) {
cairo_rotate(ctx.cairo(), angle_);
} else {
cairo_translate(ctx.cairo(), cx_, cy_);
cairo_rotate(ctx.cairo(), angle_);
cairo_translate(ctx.cairo(), -cx_, -cy_);
}
}
开发者ID:sweetkristas,项目名称:mercy,代码行数:9,代码来源:svg_transform.cpp
示例3: if
void
uniform_image_sampler_base::apply_value(const render_context& context, const program& p)
{
const opengl::gl_core& glapi = context.opengl_api();
#if SCM_GL_CORE_USE_EXT_DIRECT_STATE_ACCESS
if (_bound_unit >= 0) {
glapi.glProgramUniform1i(p.program_id(), _location, _bound_unit);
}
else if ( glapi.extension_ARB_bindless_texture
&& _resident_handle != 0ull)
{
glapi.glProgramUniformHandleui64ARB(p.program_id(), _location, _resident_handle);
}
#else
if (_bound_unit >= 0) {
glapi.glUniform1i(_location, _bound_unit);
}
else if ( glapi.extension_ARB_bindless_texture
&& _resident_handle != 0ull)
{
glapi.glUniformHandleui64ARB(_location, _resident_handle);
}
#endif
gl_assert(glapi, leaving uniform_1f::apply_value());
}
开发者ID:4og,项目名称:schism,代码行数:26,代码来源:uniform.cpp
示例4:
void
uniform_vec4ui::apply_value(const render_context& context, const program& p)
{
const opengl::gl_core& glapi = context.opengl_api();
glapi.glUniform4uiv(_location, _elements, (_value.front().data_array));//_value.data_array);
gl_assert(glapi, leaving uniform_vec4ui::apply_value());
}
开发者ID:4og,项目名称:schism,代码行数:7,代码来源:uniform.cpp
示例5: assert
void
transform_feedback::end(render_context& in_context)
{
assert(state().ok());
gl_assert(in_context.opengl_api(), entering transform_feedback:end());
const opengl::gl_core& glapi = in_context.opengl_api();
if (active()) {
glapi.glEndTransformFeedback();
}
unbind(in_context);
_active = false;
gl_assert(in_context.opengl_api(), leaving transform_feedback:end());
}
开发者ID:4og,项目名称:schism,代码行数:17,代码来源:transform_feedback.cpp
示例6: assert
void
sync::server_wait(const render_context& in_context,
scm::uint64 in_timeout) const
{
const opengl::gl_core& glapi = in_context.opengl_api();
assert(0 != object());
glapi.glWaitSync(object(), 0, sync_timeout_ignored);
gl_assert(glapi, leaving sync::server_wait());
}
开发者ID:4og,项目名称:schism,代码行数:11,代码来源:sync.cpp
示例7: assert
void
query::end(const render_context& in_context) const
{
const opengl::gl_core& glapi = in_context.opengl_api();
assert(0 != query_id());
assert(0 != query_type());
glapi.glEndQuery(query_type());
gl_assert(glapi, leaving query::end());
}
开发者ID:4og,项目名称:schism,代码行数:11,代码来源:query.cpp
示例8: render
std::string outside_section::render(
render_context& ctx, const token& token)
{
using flag = render_node::flag;
switch (token.token_type()) {
case token::type::section_open:
ctx.set_state<in_section>(in_section::type::normal, token);
break;
case token::type::inverted_section_open:
ctx.set_state<in_section>(in_section::type::inverted, token);
break;
case token::type::variable:
return visit(render_node(ctx, flag::escape_html), ctx.get_node(token.name()));
case token::type::unescaped_variable:
return visit(render_node(ctx, flag::none), ctx.get_node(token.name()));
case token::type::text:
return token.raw();
case token::type::partial:
return ctx.render_partial(token.name(), token.partial_prefix());
default:
break;
}
return "";
}
开发者ID:PlexChat,项目名称:mstch,代码行数:24,代码来源:outside_section.cpp
示例9: handle_set_source
void linear_gradient::handle_set_source(render_context& ctx) const
{
cairo_pattern_t* pattern = cairo_pattern_create_linear(
x1_.value_in_specified_units(svg_length::SVG_LENGTHTYPE_NUMBER),
y1_.value_in_specified_units(svg_length::SVG_LENGTHTYPE_NUMBER),
x2_.value_in_specified_units(svg_length::SVG_LENGTHTYPE_NUMBER),
y2_.value_in_specified_units(svg_length::SVG_LENGTHTYPE_NUMBER));
apply_stops(ctx, pattern);
auto status = cairo_pattern_status(pattern);
ASSERT_LOG(status == CAIRO_STATUS_SUCCESS, "Linear Gradient pattern couldn't be created: " << cairo_status_to_string(status));
pattern_.reset(pattern, [](cairo_pattern_t* p) { cairo_pattern_destroy(p); });
apply_transforms(pattern);
cairo_set_source(ctx.cairo(), pattern);
}
开发者ID:AsKorysti,项目名称:anura,代码行数:15,代码来源:svg_gradient.cpp
示例10: render
void parse::render(render_context& ctx) const
{
cairo_set_source_rgb(ctx.cairo(), 0.0, 0.0, 0.0);
cairo_set_line_cap(ctx.cairo(), CAIRO_LINE_CAP_BUTT);
cairo_set_line_join(ctx.cairo(), CAIRO_LINE_JOIN_MITER);
cairo_set_miter_limit(ctx.cairo(), 4.0);
cairo_set_fill_rule(ctx.cairo(), CAIRO_FILL_RULE_WINDING);
cairo_set_line_width(ctx.cairo(), 1.0);
ctx.fill_color_push(paint_ptr(new paint(0,0,0,255)));
ctx.stroke_color_push(paint_ptr(new paint()));
ctx.opacity_push(1.0);
ctx.letter_spacing_push(0);
ctx.fa().push_font_size(12);
for(auto p : svg_data_) {
p->render(ctx);
}
ctx.letter_spacing_pop();
ctx.opacity_pop();
ctx.stroke_color_pop();
ctx.fill_color_pop();
}
开发者ID:sweetkristas,项目名称:svg_parser,代码行数:23,代码来源:svg_parse.cpp
示例11:
void
rasterizer_state::apply(const render_context& in_context,
const float in_line_width,
const float in_point_size,
const rasterizer_state& in_applied_state,
const float in_applied_line_width,
const float in_applied_point_size) const
{
const opengl::gl_core& glapi = in_context.opengl_api();
if (_descriptor._fill_mode != in_applied_state._descriptor._fill_mode) {
glapi.glPolygonMode(GL_FRONT_AND_BACK, util::gl_fill_mode(_descriptor._fill_mode));
gl_assert(glapi, rasterizer_state::apply() after glPolygonMode);
}
if (_descriptor._cull_mode != in_applied_state._descriptor._cull_mode) {
if (_descriptor._cull_mode == CULL_NONE) {
glapi.glDisable(GL_CULL_FACE);
}
else {
glapi.glEnable(GL_CULL_FACE);
glapi.glCullFace(util::gl_cull_mode(_descriptor._cull_mode));
}
gl_assert(glapi, rasterizer_state::apply() after glCullFace);
}
if (_descriptor._front_face != in_applied_state._descriptor._front_face) {
glapi.glFrontFace(util::gl_polygon_orientation(_descriptor._front_face));
gl_assert(glapi, rasterizer_state::apply() after glFrontFace);
}
if (_descriptor._multi_sample != in_applied_state._descriptor._multi_sample) {
if (_descriptor._multi_sample) {
glapi.glEnable(GL_MULTISAMPLE);
}
else {
glapi.glDisable(GL_MULTISAMPLE);
}
gl_assert(glapi, rasterizer_state::apply() after GL_MULTISAMPLE);
}
if (SCM_GL_CORE_OPENGL_CORE_VERSION >= SCM_GL_CORE_OPENGL_CORE_VERSION_400) {
if ( _descriptor._multi_sample
&& _descriptor._sample_shading)
{
glapi.glEnable(GL_SAMPLE_SHADING);
}
else {
glapi.glDisable(GL_SAMPLE_SHADING);
}
gl_assert(glapi, rasterizer_state::apply() after GL_SAMPLE_SHADING);
glapi.glMinSampleShading(math::clamp(_descriptor._min_sample_shading, 0.0f, 1.0f));
gl_assert(glapi, rasterizer_state::apply() after glMinSampleShading);
}
if (_descriptor._scissor_test != in_applied_state._descriptor._scissor_test) {
if (_descriptor._scissor_test) {
glapi.glEnable(GL_SCISSOR_TEST);
}
else {
glapi.glDisable(GL_SCISSOR_TEST);
}
gl_assert(glapi, rasterizer_state::apply() after GL_SCISSOR_TEST);
}
if (_descriptor._smooth_lines != in_applied_state._descriptor._smooth_lines) {
if (_descriptor._smooth_lines) {
glapi.glEnable(GL_LINE_SMOOTH);
}
else {
glapi.glDisable(GL_LINE_SMOOTH);
}
gl_assert(glapi, rasterizer_state::apply() after GL_LINE_SMOOTH);
}
if (in_line_width != in_applied_line_width) { // i do no care about float compare at this point
glapi.glLineWidth(math::max<float>(0.0f, in_line_width));
gl_assert(glapi, rasterizer_state::apply() after glLineWidth);
}
if (in_point_size != in_applied_point_size) { // i do no care about float compare at this point
glapi.glPointSize(math::max<float>(0.0f, in_point_size));
gl_assert(glapi, rasterizer_state::apply() after glPointSize);
}
if (_descriptor._point_state != in_applied_state._descriptor._point_state) {
if (_descriptor._point_state._shader_point_size) {
glapi.glEnable(GL_PROGRAM_POINT_SIZE);
}
else {
glapi.glDisable(GL_PROGRAM_POINT_SIZE);
}
glapi.glPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE, math::max<float>(0.0f, _descriptor._point_state._point_fade_threshold));
glapi.glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, util::gl_origin_mode( _descriptor._point_state._point_origin_mode));
gl_assert(glapi, rasterizer_state::apply() after glPointParameter);
}
gl_assert(glapi, leaving rasterizer_state::apply());
}
开发者ID:4og,项目名称:schism,代码行数:94,代码来源:rasterizer_state.cpp
注:本文中的render_context类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论