//Function executed at each frame
bool setMultiModelObjectTrajectory2D::draw(QImage **image) {
    if(!paint(*image))
        return false;
    return true;
}
Beispiel #2
0
void KoPACanvas::paintEvent( QPaintEvent *event )
{
    QPainter painter(this);
    paint(painter, event->rect());
    painter.end();
}
Beispiel #3
0
void KstTopLevelView::paint(KstPainter::PaintType type) {
  paint(type, QRegion(geometry()));
}
Beispiel #4
0
void QFrame::paintEvent(QPaintEvent *)
{
    QPainter paint(this);
    drawFrame(&paint);
}
void DhQGraphicsItemGroup::Dvhpaint(QPainter* x1, const QStyleOptionGraphicsItem* x2, QWidget* x3) {
  return paint(x1, x2, x3);
}
Beispiel #6
0
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);
}
Beispiel #7
0
void graphics<Canvas>::paint(const PixelMatrix& pixel_matrix,
                             int lt_x, int lt_y, int rb_x, int rb_y)
{
    paint(0, 0, pixel_matrix, lt_x, lt_y, rb_x, rb_y);
}
Beispiel #8
0
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);
}
Beispiel #9
0
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);
}
Beispiel #10
0
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);
}
Beispiel #11
0
void
DiscreteBrushStroke::mouse_down(const NPoint& point, uint buttons, bool dbl)
{
	BrushStroke::mouse_down(point, buttons, dbl);
	paint(point);
}
Beispiel #12
0
void
DiscreteBrushStroke::mouse_moved(const NPoint& point, uint buttons)
{
	if(painting())
		paint(point);
}
Beispiel #13
0
void Annotation::paint(QPainter *painter) const
{
	paint(painter, _rect);
}
Beispiel #14
0
int
main (int argc, char **argv)
{
  CoglContext *ctx;
  CoglOnscreen *onscreen;
  CoglFramebuffer *fb;
  GError *error = NULL;
  Data data;
  PangoRectangle hello_label_size;
  float fovy, aspect, z_near, z_2d, z_far;
  CoglDepthState depth_state;
  CoglBool has_swap_notify;

  ctx = cogl_context_new (NULL, &error);
  if (!ctx) {
      fprintf (stderr, "Failed to create context: %s\n", error->message);
      return 1;
  }

  onscreen = cogl_onscreen_new (ctx, 640, 480);
  fb = COGL_FRAMEBUFFER (onscreen);
  data.fb = fb;
  data.framebuffer_width = cogl_framebuffer_get_width (fb);
  data.framebuffer_height = cogl_framebuffer_get_height (fb);

  data.timer = g_timer_new ();

  cogl_onscreen_show (onscreen);

  cogl_framebuffer_set_viewport (fb,
                                 0, 0,
                                 data.framebuffer_width,
                                 data.framebuffer_height);

  fovy = 60; /* y-axis field of view */
  aspect = (float)data.framebuffer_width/(float)data.framebuffer_height;
  z_near = 0.1; /* distance to near clipping plane */
  z_2d = 1000; /* position to 2d plane */
  z_far = 2000; /* distance to far clipping plane */

  cogl_framebuffer_perspective (fb, fovy, aspect, z_near, z_far);

  /* Since the pango renderer emits geometry in pixel/device coordinates
   * and the anti aliasing is implemented with the assumption that the
   * geometry *really* does end up pixel aligned, we setup a modelview
   * matrix so that for geometry in the plane z = 0 we exactly map x
   * coordinates in the range [0,stage_width] and y coordinates in the
   * range [0,stage_height] to the framebuffer extents with (0,0) being
   * the top left.
   *
   * This is roughly what Clutter does for a ClutterStage, but this
   * demonstrates how it is done manually using Cogl.
   */
  cogl_matrix_init_identity (&data.view);
  cogl_matrix_view_2d_in_perspective (&data.view, fovy, aspect, z_near, z_2d,
                                      data.framebuffer_width,
                                      data.framebuffer_height);
  cogl_framebuffer_set_modelview_matrix (fb, &data.view);

  /* Initialize some convenient constants */
  cogl_matrix_init_identity (&identity);
  cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);

  /* rectangle indices allow the GPU to interpret a list of quads (the
   * faces of our cube) as a list of triangles.
   *
   * Since this is a very common thing to do
   * 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;
}
Beispiel #15
0
void graphics<Canvas>::paint(const PixelMatrix& pixel_matrix)
{
    paint(0, 0, pixel_matrix);
}
Beispiel #16
0
void AutoLockBox::paintEvent(QPaintEvent *e) {
	Painter p(this);
	if (paint(p)) return;

	paintTitle(p, lang(lng_passcode_autolock), true);
}
Beispiel #17
0
void graphics<Canvas>::paint(const PixelMatrix& pixel_matrix,
                             const point& lt, const point& rb)
{
    paint(0, 0, pixel_matrix, lt, rb);
}
Beispiel #18
0
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:
			{

				int min = (selected == 0) ? 0 : 400;
				if (y_coord[selected] <= min)
					y_coord[selected] = min;
				else
				{
					unpaintBorder(selected);
					y_coord[selected]--;
					paintBorder(selected);
				}
				break;
			}
			case CRCInput::RC_down:
			{
				int max = (selected == 0 )? 200 : frameBuffer->getScreenHeight(true);
				if (y_coord[selected] >= max)
					y_coord[selected] = max;
				else
				{
					unpaintBorder(selected);
					y_coord[selected]++;
					paintBorder(selected);
				}
				break;
			}
			case CRCInput::RC_left:
			{
				int min = (selected == 0) ? 0 : 400;
				if (x_coord[selected] <= min)
					x_coord[selected] = min;
				else
				{
					unpaintBorder(selected);
					x_coord[selected]--;
					paintBorder( selected );
				}
				break;
			}
			case CRCInput::RC_right:
			{
				int max = (selected == 0) ? 200 : frameBuffer->getScreenWidth(true);
				if (x_coord[selected] >= max)
					x_coord[selected] = max;
				else
				{
					unpaintBorder(selected);
					x_coord[selected]++;
					paintBorder( selected );
				}
				break;
			}
			case CRCInput::RC_favorites:
			case CRCInput::RC_sat:
				break;

			default:
				if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
				{
					loop = false;
					res = menu_return::RETURN_EXIT_ALL;
				}
		}
		frameBuffer->blit();

	}

	hide();
	return res;
}
Beispiel #19
0
void graphics<Canvas>::paint(int x, int y, const PixelMatrix& pixel_matrix)
{
    paint(x, y,
          pixel_matrix, 0, 0, pixel_matrix.width(), pixel_matrix.height());
}
Beispiel #20
0
void GLUTMinimalCFR::onHIDEvent( dp::util::PropertyId propertyId )
{
  if ( propertyId == PID_Key_F1 )
  {
    if ( getValue<bool>( propertyId ) )
    {
      getSceneRenderer()->setCullingMode(dp::culling::Mode::CPU);
      std::cout << "culling: CPU" << std::endl;
    }
  }
  else if ( propertyId == PID_Key_F2 )
  {
    if ( getValue<bool>( propertyId ) )
    {
      getSceneRenderer()->setCullingMode(dp::culling::Mode::OPENGL_COMPUTE);
      std::cout << "culling: GL_COMPUTE" << std::endl;
    }
  }
  else if ( propertyId == PID_Key_F3 )
  {
    if ( getValue<bool>( propertyId ) )
    {
      getSceneRenderer()->setCullingMode(dp::culling::Mode::CUDA);
      std::cout << "culling: CUDA" << std::endl;
    }
  }
  else if ( propertyId == PID_Key_F4 )
  {
    if ( getValue<bool>( propertyId ) )
    {
      getSceneRenderer()->setCullingMode(dp::culling::Mode::AUTO);
      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();
    }
  }
}
Beispiel #21
0
void Drawboard::paintEvent(QPaintEvent* event)
{
    QPainter paint(this);
    paint.drawPixmap(event->rect(), *buffer, event->rect());
    drawTool(&paint);
}
Beispiel #22
0
void WKCACFLayerRenderer::setRootContentsAndDisplay(CGImageRef image)
{
    ASSERT(m_rootLayer);
    m_rootLayer->setContents(image);
    paint();
}
Beispiel #23
0
MRESULT Window::wndProc( HWND hWnd, ULONG iMessage, MPARAM mParam1, MPARAM mParam2)
{
  switch( iMessage )
  {
    case WM_COMMAND :
    {
      // A menu selection

      if( SHORT1FROMMP( mParam2 ) == CMDSRC_MENU )
      {
        processMenuEnd = TRUE;
        performMenuEvent( (int)mParam1 );
      }
      break;
    }
    case WM_INITMENU :
    {
      processMenuEnd = TRUE;
      break;
    }
    case WM_MENUSELECT :
    {
      if( SHORT2FROMMP( mParam1 ) )
        processMenuEnd = FALSE;
      break;
    }
    case WM_MENUEND :
    {
      if( processMenuEnd )
        performMenuEvent( MENU_CLOSE );
      break;
    }
    case WM_PAINT :
    {
      // Do not paint if subclassed window
      if( oldWndProc != NULL ) break;

      CURSORINFO cursorinfo;

      BOOL rc = WinQueryCursorInfo(HWND_DESKTOP, &cursorinfo);
      if( rc ) WinShowCursor( hWnd, 0 );

      RECTL rcl;
      HPS hps = WinBeginPaint( hWnd, NULLHANDLE, &rcl );
      Rect rect( rcl.xLeft, rcl.yBottom, rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom );
      Graphics *graph = new Graphics( hps );
      paint( &rect, graph );
      delete graph;
      WinEndPaint( hps );

      if( rc ) WinShowCursor( hWnd, 1 );
      return MPARAM(0);
    }
    case WM_ERASEBACKGROUND : return (MPARAM)FALSE;
  }

  BOOL returned = TRUE;
  MRESULT retVal = stdWndProc( hWnd, iMessage, mParam1, mParam2, &returned );

  if( !returned )
  {
    if( oldWndProc == NULL )
      return WinDefWindowProc( hWnd, iMessage, mParam1, mParam2 );
    else
      return oldWndProc( hWnd, iMessage, mParam1, mParam2 );
  }
  else
    return retVal;
}
Beispiel #24
0
void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*)
{
    paint();
}
void TestTriangulationWidget::paintEvent(QPaintEvent *)
{
    QPainter paint(this);
    QPen pen;
    QBrush brush;
    brush.setColor(Qt::blue);

    for(int i=0; i < points_.size(); i++)
    {
        if(i == selected_id0_)
        {
            pen.setColor(Qt::red);
        }
        else if(i == selected_id1_)
        {
            pen.setColor(Qt::green);
        }
        else
        {
            pen.setColor(Qt::blue);
        }
        pen.setWidth(3);
        paint.setPen(pen);
        QPoint tpos((int)points_[i][0],(int)points_[i][1]);
        paint.drawEllipse(tpos,5,5);
    }

    for(int i=0; i < edges_.size(); i++)
    {
        if(boundary_markers_[i])
        {
            pen.setColor(Qt::red);
        }
        else
        {
            pen.setColor(Qt::green);
        }
        pen.setWidth(3);
        Vec3 p0 = points_[edges_[i][0]];
        Vec3 p1 = points_[edges_[i][1]];
        paint.setPen(pen);
        paint.drawLine((int)p0[0],(int)p0[1],(int)p1[0],(int)p1[1]);
    }


    for(int i=0; i < new_points_.size(); i++)
    {
        pen.setColor(Qt::black);
        pen.setWidth(2);
        paint.setPen(pen);
        QPoint tpos((int)new_points_[i][0],(int)new_points_[i][1]);
        paint.drawEllipse(tpos,2,2);
    }

    for(int i=0; i < triangles_.size(); i++)
    {
        pen.setColor(Qt::blue);
        pen.setWidth(1);
        paint.setPen(pen);
        for(int j=0; j < 3; j++)
        {
            Vec3 p0 = new_points_[triangles_[i][j]];
            Vec3 p1 = new_points_[triangles_[i][(j+1)%3]];
            paint.setPen(pen);
            paint.drawLine((int)p0[0],(int)p0[1],(int)p1[0],(int)p1[1]);
        }
    }
}
Beispiel #26
0
 void MyBitmap::paintEvent(QPaintEvent *event)
 {
    QPainter paint( this );

    paint.drawImage( QPoint(0,0), *tempBitmap );
 }
Beispiel #27
0
 void paint(Map2d<int> *mmap,int c) {
   paint(mmap,c,0);
 }
Beispiel #28
0
void check(int currx,int curry){
    if(!status[currx][curry]){
        paint(currx,curry);
    }
}
Beispiel #29
0
bool KstTopLevelView::handlePress(const QPoint& pos, bool shift) {
  if (_activeHandler) {
    _activeHandler->handlePress(this, pos, shift);
    return true;
  }
  
  _mouseMoved = false;
  
  //kstdDebug() << "HANDLE PRESS" << endl;
  _pressDirection = -1;

  if (_mode != LayoutMode) {
    _pressTarget = 0L;
    return false;
  }  
  
  _pressTarget = findDeepestChild(pos, false);
  if (_pressTarget) {
    KstViewObjectPtr p = _pressTarget;
    while (p->_parent && (p->_parent->_container || kst_cast<KstPlotGroup>((KstViewObjectPtr)p->_parent)) && !kst_cast<KstTopLevelView>((KstViewObjectPtr)p->_parent)) {
      p = p->_parent;
    }
    if (p->_parent && !p->_parent->_container && !kst_cast<KstTopLevelView>((KstViewObjectPtr)p->_parent)) {
      _pressTarget = p->_parent;
    } else if (p && !p->_container) {
      _pressTarget = p;
    }
  }

  if (!_pressTarget) {
    _moveOffset = pos;
    return false;
  }

  _prevBand = QRect(-1, -1, 0, 0);
  _moveOffset = QPoint(-1, -1);
  _moveOffsetSticky = QPoint(0, 0);

  if (!_focusOn) {
    _pressTarget = 0L;
    _cursor.setShape(Qt::ArrowCursor);
    _w->setCursor(_cursor);
    _moveOffset = pos; // use _moveOffset to store our start point
    return true;
  }

  assert(_pressTarget);
  
  _pressDirection = _pressTarget->directionFor(pos);
  
  if (shift && _pressDirection < 1) {
    KstViewObjectList::Iterator it = _selectionList.find(_pressTarget);

    if (_pressTarget->isSelected()) {
      _pressTarget->setSelected(false);
      if (it != _selectionList.end()) {
        _selectionList.remove(it);
      }
    } else {
      _pressTarget->setSelected(true);
      if (it == _selectionList.end()) {
        _selectionList.append(_pressTarget);
      }
    }
    _pressTarget = 0L;
    _pressDirection = -1;
    _moveOffset = QPoint(-1, -1);
    _moveOffsetSticky = QPoint(0, 0);
    updateFocus(pos);
    paint(KstPainter::P_PAINT);
    return true;
  }

  if (_pressDirection == 0) {
    _moveOffset = pos - _pressTarget->position();
    _selectionList.clear();
    if (_pressTarget->isSelected()) {
      recursivelyQuery(&KstViewObject::isSelected, _selectionList, false);
    } else {
      recursively<bool>(&KstViewObject::setSelected, false);
    }
  } else {
    _selectionList.clear();
    recursively<bool>(&KstViewObject::setSelected, false);
  }
  
  // single click selects a single object if it is not part of the current list
  if (!_selectionList.contains(_pressTarget)) {
    _selectionList.clear();
    recursively<bool>(&KstViewObject::setSelected, false);
    _selectionList.append(_pressTarget);
  }
  _pressTarget->setSelected(true);

  _pressTarget->setFocus(false);
  paint(KstPainter::P_PAINT);
  return true;
}
Beispiel #30
0
void Frame::paintEvent(QPaintEvent *e)
{
    //kDebug()<<e;
    QPainter paint(this);
    drawFrame(&paint);
}