本文整理汇总了C++中paint函数的典型用法代码示例。如果您正苦于以下问题:C++ paint函数的具体用法?C++ paint怎么用?C++ paint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//Function executed at each frame
bool setMultiModelObjectTrajectory2D::draw(QImage **image) {
if(!paint(*image))
return false;
return true;
}
示例2: painter
void KoPACanvas::paintEvent( QPaintEvent *event )
{
QPainter painter(this);
paint(painter, event->rect());
painter.end();
}
示例3: paint
void QFrame::paintEvent(QPaintEvent *)
{
QPainter paint(this);
drawFrame(&paint);
}
示例4: paint
void DhQGraphicsItemGroup::Dvhpaint(QPainter* x1, const QStyleOptionGraphicsItem* x2, QWidget* x3) {
return paint(x1, x2, x3);
}
示例5: paint
void graphics<Canvas>::paint(const point& position,
const PixelMatrix& pixel_matrix,
const point& lt, const point& rb)
{
paint(position.x, position.y, pixel_matrix, lt, rb);
}
示例6: Rec
void Rec(int x,int y, int l,int w,int c)
{
int i;
for (i=x;i<n&&i<x+l;i++)
paint(i,y,min(m-1,y+w-1),c);
}
示例7: Tri
void Tri(int x,int y, int w,int c)
{
for (w=w/2;x<n&&w/2>=0;x++,w--)
paint(x,max(0,y-w),min(m-1,y+w),c);
}
示例8: abs
void
SequentialBrushStroke::mouse_moved(const NPoint& point, uint buttons)
{
if(painting())
{
struct func {
static coord abs(coord val) {return val < 0 ? -val : val;}
static coord sgn(coord val) {return val < 0 ? -1 : 1;}
};
coord x1 = m_prev_point.x, y1 = m_prev_point.y;
coord x2 = point.x, y2 = point.y;
coord dx = func::abs(x2 - x1);
coord dy = func::abs(y2 - y1);
coord sx = func::sgn(x2 - x1);
coord sy = func::sgn(y2 - y1);
coord x = x1;
coord y = y1;
if(dx >= dy)
{
coord d = -dx;
for(int i=0; i<=dx; ++i)
{
paint(NPoint(x, y));
x += sx;
d += dy * 2;
if(d >= 0)
{
y += sy;
d -= dx * 2;
}
}
}
else
{
coord d = -dy;
for(int i=0; i<=dy; ++i)
{
paint(NPoint(x, y));
y += sy;
d += dx * 2;
if(d >= 0)
{
x += sx;
d -= dy * 2;
}
}
}
m_prev_point = point;
}
BrushStroke::mouse_moved(point, buttons);
}
示例9: paint
void
DiscreteBrushStroke::mouse_down(const NPoint& point, uint buttons, bool dbl)
{
BrushStroke::mouse_down(point, buttons, dbl);
paint(point);
}
示例10: paint
void Annotation::paint(QPainter *painter) const
{
paint(painter, _rect);
}
示例11: main
//.........这里部分代码省略.........
* cogl_get_rectangle_indices() is a convenience function for
* accessing internal index buffers that can be shared.
*/
data.indices = cogl_get_rectangle_indices (ctx, 6 /* n_rectangles */);
data.prim = cogl_primitive_new_p3t2 (ctx, COGL_VERTICES_MODE_TRIANGLES,
G_N_ELEMENTS (vertices),
vertices);
/* Each face will have 6 indices so we have 6 * 6 indices in total... */
cogl_primitive_set_indices (data.prim,
data.indices,
6 * 6);
/* Load a jpeg crate texture from a file */
printf ("crate.jpg (CC by-nc-nd http://bit.ly/9kP45T) ShadowRunner27 http://bit.ly/m1YXLh\n");
data.texture = cogl_texture_new_from_file (COGL_EXAMPLES_DATA "crate.jpg",
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY,
&error);
if (!data.texture)
g_error ("Failed to load texture: %s", error->message);
/* a CoglPipeline conceptually describes all the state for vertex
* processing, fragment processing and blending geometry. When
* drawing the geometry for the crate this pipeline says to sample a
* single texture during fragment processing... */
data.crate_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_texture (data.crate_pipeline, 0, data.texture);
/* Since the box is made of multiple triangles that will overlap
* when drawn and we don't control the order they are drawn in, we
* enable depth testing to make sure that triangles that shouldn't
* be visible get culled by the GPU. */
cogl_depth_state_init (&depth_state);
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
cogl_pipeline_set_depth_state (data.crate_pipeline, &depth_state, NULL);
/* Setup a Pango font map and context */
data.pango_font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new (ctx));
cogl_pango_font_map_set_use_mipmapping (data.pango_font_map, TRUE);
data.pango_context =
pango_font_map_create_context (PANGO_FONT_MAP (data.pango_font_map));
data.pango_font_desc = pango_font_description_new ();
pango_font_description_set_family (data.pango_font_desc, "Sans");
pango_font_description_set_size (data.pango_font_desc, 30 * PANGO_SCALE);
/* Setup the "Hello Cogl" text */
data.hello_label = pango_layout_new (data.pango_context);
pango_layout_set_font_description (data.hello_label, data.pango_font_desc);
pango_layout_set_text (data.hello_label, "Hello Cogl", -1);
pango_layout_get_extents (data.hello_label, NULL, &hello_label_size);
data.hello_label_width = PANGO_PIXELS (hello_label_size.width);
data.hello_label_height = PANGO_PIXELS (hello_label_size.height);
data.swap_ready = TRUE;
has_swap_notify =
cogl_has_feature (ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT);
if (has_swap_notify)
cogl_onscreen_add_swap_buffers_callback (COGL_ONSCREEN (fb),
swap_notify_cb,
&data);
while (1)
{
CoglPollFD *poll_fds;
int n_poll_fds;
int64_t timeout;
if (data.swap_ready)
{
paint (&data);
cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
}
cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout);
if (!has_swap_notify)
{
/* If the winsys doesn't support swap event notification
then we'll just redraw constantly */
data.swap_ready = TRUE;
timeout = 0;
}
g_poll ((GPollFD *) poll_fds, n_poll_fds,
timeout == -1 ? -1 : timeout / 1000);
cogl_poll_dispatch (ctx, poll_fds, n_poll_fds);
}
return 0;
}
示例12: p
void AutoLockBox::paintEvent(QPaintEvent *e) {
Painter p(this);
if (paint(p)) return;
paintTitle(p, lang(lng_passcode_autolock), true);
}
示例13: paint
int CScreenSetup::exec(CMenuTarget* parent, const std::string &)
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
int res = menu_return::RETURN_REPAINT;
if (parent)
{
parent->hide();
}
x_box = 15*5;
y_box = frameBuffer->getScreenHeight(true) / 2;
int icol_w, icol_h;
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
BoxHeight = std::max(icol_h+4, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
BoxWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_SCREENSETUP_UPPERLEFT));
int tmp = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_SCREENSETUP_LOWERRIGHT));
if (tmp > BoxWidth)
BoxWidth = tmp;
BoxWidth += 10 + icol_w;
x_coord[0] = g_settings.screen_StartX;
x_coord[1] = g_settings.screen_EndX;
y_coord[0] = g_settings.screen_StartY;
y_coord[1] = g_settings.screen_EndY;
paint();
frameBuffer->blit();
selected = 0;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);
bool loop=true;
while (loop)
{
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd, true );
if ( msg <= CRCInput::RC_MaxRC )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);
switch ( msg )
{
case CRCInput::RC_ok:
// abspeichern
g_settings.screen_StartX = x_coord[0];
g_settings.screen_EndX = x_coord[1];
g_settings.screen_StartY = y_coord[0];
g_settings.screen_EndY = y_coord[1];
if(g_settings.screen_preset) {
g_settings.screen_StartX_lcd = g_settings.screen_StartX;
g_settings.screen_StartY_lcd = g_settings.screen_StartY;
g_settings.screen_EndX_lcd = g_settings.screen_EndX;
g_settings.screen_EndY_lcd = g_settings.screen_EndY;
} else {
g_settings.screen_StartX_crt = g_settings.screen_StartX;
g_settings.screen_StartY_crt = g_settings.screen_StartY;
g_settings.screen_EndX_crt = g_settings.screen_EndX;
g_settings.screen_EndY_crt = g_settings.screen_EndY;
}
if (g_InfoViewer) /* recalc infobar position */
g_InfoViewer->start();
loop = false;
break;
case CRCInput::RC_home:
if ( ( ( g_settings.screen_StartX != x_coord[0] ) ||
( g_settings.screen_EndX != x_coord[1] ) ||
( g_settings.screen_StartY != y_coord[0] ) ||
( g_settings.screen_EndY != y_coord[1] ) ) &&
(ShowMsg(LOCALE_VIDEOMENU_SCREENSETUP, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel))
break;
case CRCInput::RC_timeout:
loop = false;
break;
case CRCInput::RC_red:
case CRCInput::RC_green:
{
selected = ( msg == CRCInput::RC_green ) ? 1 : 0 ;
frameBuffer->paintBoxRel(x_box, y_box, BoxWidth, BoxHeight,
(selected == 0)?COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x_box, y_box + BoxHeight, BoxWidth, BoxHeight,
(selected ==1 )?COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);
paintIcons(selected);
break;
}
case CRCInput::RC_up:
{
//.........这里部分代码省略.........
示例14: getSceneRenderer
//.........这里部分代码省略.........
std::cout << "culling: AUTO" << std::endl;
}
}
else if ( propertyId == PID_Key_C )
{
if ( getValue<bool>( propertyId) )
{
bool enabled = !getSceneRenderer()->isCullingEnabled();
getSceneRenderer()->setCullingEnabled(enabled);
std::cout << "culling " << (enabled ? "enabled" : "disabled") << std::endl;
}
}
else if ( propertyId == PID_Key_B ) // Toggle Bindless
{
if ( getValue<bool>( propertyId ) )
{
m_engineBindless = !m_engineBindless;
updateSceneRendererEngine();
}
}
else if ( propertyId == PID_Key_G ) // attrib generic
{
if ( getValue<bool>( propertyId ) )
{
m_attributeType = AttributeType::GENERIC;
updateSceneRendererEngine();
}
}
else if ( propertyId == PID_Key_V ) // attrib VAO
{
if ( getValue<bool>( propertyId ) )
{
m_attributeType = AttributeType::VAO;
updateSceneRendererEngine();
}
}
else if ( propertyId == PID_Key_A ) // Toggle attrib VAB
{
if ( getValue<bool>( propertyId ) )
{
m_attributeType = AttributeType::VAB;
updateSceneRendererEngine();
}
}
else if ( propertyId == PID_Key_Escape )
{
if ( getValue<bool>( propertyId ) )
{
glutLeaveMainLoop();
}
}
else if ( propertyId == PID_Key_F9 )
{
if ( getValue<bool>( propertyId ) )
{
std::cout << "Setting shadermanager: " << "uniform" << std::endl;
m_shaderManager = dp::fx::Manager::UNIFORM;
}
}
else if ( propertyId == PID_Key_F10 )
{
if ( getValue<bool>( propertyId ) )
{
std::cout << "Setting shadermanager: " << "uniform buffer object" << std::endl;
m_shaderManager = dp::fx::Manager::UNIFORM_BUFFER_OBJECT_RIX;
}
}
else if ( propertyId == PID_Key_F11 )
{
if ( getValue<bool>( propertyId ) )
{
std::cout << "Setting shadermanager: " << "shaderbufferload" << std::endl;
m_shaderManager = dp::fx::Manager::SHADERBUFFER;
}
}
else if ( propertyId == PID_Key_F12 )
{
if ( getValue<bool>( propertyId ) )
{
std::cout << "Setting shadermanager: " << "shader storage buffer object" << std::endl;
m_shaderManager = dp::fx::Manager::SHADER_STORAGE_BUFFER_OBJECT;
}
}
else if ( propertyId == PID_Key_P )
{
if ( getValue<bool>( propertyId ) )
{
dp::util::FrameProfiler::instance().setEnabled( !dp::util::FrameProfiler::instance().isEnabled() );
}
}
else if ( propertyId == PID_Key_Space )
{
if ( getValue<bool>( propertyId ) )
{
paint();
}
}
}
示例15: paint
void Drawboard::paintEvent(QPaintEvent* event)
{
QPainter paint(this);
paint.drawPixmap(event->rect(), *buffer, event->rect());
drawTool(&paint);
}