示例#1
0
    LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
    {
        switch(nmsg) {
          case WM_PAINT:
            Paint();
            break;

          default:
            return super::WndProc(nmsg, wparam, lparam);
        }

        return 0;
    }
示例#2
0
QPixmap CCJKShapeRect::Image( const QSize &size )
{
	QPixmap pixmap(size);
	pixmap.fill(Qt::transparent);
// 	pixmap.fill(Qt::white);
	QPainter painter(&pixmap);
	painter.setPen(QPen(Qt::black, 8));
	int width = qMax(10, size.width()-10);
	int height = qMax(10, size.height()-10);
	QRectF rect(5, 5, width, height);
	SetRect(rect);
	Paint(&painter);
	return pixmap;
}
示例#3
0
void EditView::GenerateLarge()
{
  if ( m_pcSmallBitmap == NULL ) {
    return;
  }

  delete m_pcLargeBitmap;
  m_pcLargeBitmap = new Bitmap( 32, 32, CS_RGB32, Bitmap::SHARE_FRAMEBUFFER );
  
  Scale( m_pcSmallBitmap, m_pcLargeBitmap, m_nFilterType, 0.0f );
//  m_pcLargeIconView->SetBitmap( m_pcLargeBitmap );
  Paint( GetBounds() );
  Flush();
}
示例#4
0
bool
GraphCanvas::CopyAsMetafile()
{
#ifdef _WIN32
	wxMetafileDC mdc;
	Paint(mdc);
	wxMetafile *meta = mdc.Close();
	bool ok = meta->SetClipboard();
	DESTROY(meta);
	return ok;
#else
	return false;
#endif
}
示例#5
0
void RichText::Paint(Draw& w, int x, int y, int cx, const PaintInfo& pinit) const
{
	Mutex::Lock __(mutex);
	SimplePageDraw pw(w);
	PaintInfo pi(pinit);
	pi.top = PageY(0, 0);
	pi.bottom = PageY(0, INT_MAX);
	pi.usecache = true;
	pi.sizetracking = false;
	pi.highlight = Null;
	w.Offset(x, y);
	Paint(pw, Size(cx / pi.zoom, INT_MAX), pi);
	w.End();
}
示例#6
0
void Pane::TunnelPaint(Surface* psurface, bool bPaintAll)
{
    if (m_pparent != NULL && !m_bOpaque) {
        psurface->Offset(-m_offset);
        m_pparent->TunnelPaint(psurface, false);    
        psurface->Offset(m_offset);
    }

    if (bPaintAll) {
        PaintAll(psurface);
    } else {
        Paint(psurface);
    }
}
示例#7
0
void MyFrame1::OnLeftUp(wxMouseEvent &event)
{
  //if (event.Moving())
  {
    wxCoord x, y;
    event.GetPosition(&x, &y);
    m_v2.x = (float)x;
    m_v2.y = (float)(m_panel1->GetSize().y - y);
    m_curPrimitive->AddVertex(m_v2);
    Controller::Get().AddPrimitive(m_curPrimitive);
    m_curPrimitive = NULL;
    Paint();
  }
}
示例#8
0
文件: Window.cpp 项目: acook/out_asio
void
SWindow::WmPaint(Org_Mes* OrgMes)
{
	if(OrgMes->ExecMessage/* && (ControlMode == ControlMode_Normal)*/) {
		PAINTSTRUCT	ps;
		HDC		hdc = BeginPaint(&ps);

		Paint(hdc);

		EndPaint(&ps);
	}

	DefaultProc(OrgMes);
}
示例#9
0
/// @brief Callback for the color picker dialog
/// @param col New color
void ColourButton::SetColour(agi::Color col) {
	colour = col;

	// Draw colour
	Paint();
	SetBitmapLabel(bmp);

	// Trigger a click event on this as some stuff relies on that to know
	// when the color has changed
	wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
	evt.SetClientData(this);
	evt.SetEventObject(this);
	AddPendingEvent(evt);
}
示例#10
0
void
gfxContext::FillWithOpacity(gfxFloat aOpacity)
{
  // This method exists in the hope that one day cairo gets a direct
  // API for this, and then we would change this method to use that
  // API instead.
  if (aOpacity != 1.0) {
    gfxContextAutoSaveRestore saveRestore(this);
    Clip();
    Paint(aOpacity);
  } else {
    Fill();
  }
}
示例#11
0
/**
 * Load from file, and set the associated document file name
 *
 * @param file the file name
 * @param a ReturnExt
 */
ReturnExt EditorWindow::LoadFromFile(const char* file)
{
	ReturnExt r = editor->LoadFromFile(file);
	if (!r) return r;

	char* s = strdup(file);
	char* b = basename(s);
	SetTitle(b);
	free(s);

	Paint();
	
	return ReturnExt(true);
}
示例#12
0
//Cleans up the heap by adding free blocks to the freelist and changing header colors
void sweepPhase() {
  printf("sweeping ...\n");
  word* heapPtr = heap;
  //Go through the heap as long as the heap pointer is less than afterheap, which is a pointer to the last element in the heap
  while(heapPtr < afterHeap){
    int length = Length(heapPtr[0]);
    int len;
    switch(Color(heapPtr[0])){
      case Black: //If the header is black
        heapPtr[0] = Paint(heapPtr[0], White);
        break;
      case White: //If the header is white
        len = 0;
        /* Sums up the length of the adjacent free blocks */
        while((heapPtr+len) < afterHeap && Color(heapPtr[len])==White){
          len+=Length(heapPtr[len]) + 1; //Adds the length of the current block
        }
        //Make new header if any adjacent free blocks or else paint the existing header blue
        if(len>length){
          heapPtr[0] = mkheader(0, len-1, Blue);
        }else{
          heapPtr[0] = Paint(heapPtr[0],Blue);
        }
        //Set first element in the free block to point to freelist
        //and set freelist to point to the header of the free block
        heapPtr[1] = (word)freelist;
        freelist = &heapPtr[0];
        break;
    }
    //Set heap pointer to next block
    if(len>length){
      heapPtr += len;
    }else{
      heapPtr += length+1;
    }
  }
}
示例#13
0
/*
	Load()

	Carica l'immagine dal file nel controllo, creando l'oggetto immagine con la libreria specificata.
*/
BOOL CDibCtrl::Load(LPCSTR lpszFileName,LPCSTR lpcszLibraryName,BOOL bRebuildPalette/*=TRUE*/,BOOL bClearBeforeDraw/*=TRUE*/)
{
	CWaitCursor cursor;
	m_bValidDib = FALSE;

	// controlla che sia un file
	if(!(::GetFileAttributes(lpszFileName) & FILE_ATTRIBUTE_DIRECTORY))
	{
		// verifica se e' stata specificata una libreria differente
		if(m_szLibraryName[0]=='\0')
			strcpyn(m_szLibraryName,lpcszLibraryName,sizeof(m_szLibraryName));
		if(stricmp(m_szLibraryName,lpcszLibraryName)!=0)
		{
			m_ImageFactory.Delete();
			m_pImage = NULL;
			strcpyn(m_szLibraryName,lpcszLibraryName,sizeof(m_szLibraryName));
		}

		// crea l'oggetto immagine
		if(!m_pImage)
			m_pImage = m_ImageFactory.Create(m_szLibraryName,sizeof(m_szLibraryName));
		
		// carica l'immagine nel controllo
		if(m_pImage)
		{
			if(m_pImage->IsSupportedFormat(lpszFileName))
				if(m_pImage->Load(lpszFileName))
				{
					m_bValidDib = TRUE;

					// usa lo stesso oggetto per ogni immagine, per cui occhio con il parametro per ricalcolare la paletta
					m_ImageDraw.SetImage(m_pImage);
					
					if(bRebuildPalette)
					{
						m_ImageDraw.BuildLogPalette();
						RealizePalette(FALSE);
					}

					Paint(bClearBeforeDraw);
				}
		}
	}

	if(!m_bValidDib)
		Clear();

	return(m_bValidDib);
}
示例#14
0
文件: Terminal.c 项目: byxob/calendar
static WM_RESULT _TERMINAL_Callback (/*const*/ WM_MESSAGE*pMsg) {
  TERMINAL_Handle hObj = pMsg->hWin;
  TERMINAL_Obj* pObj = TERMINAL_H2P(hObj);
  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_DEBUG_LOG("BUTTON: _Callback(WM_PAINT)\n");
    Paint(pObj/*, (GUI_RECT*)pMsg->Data.p*/);
    return;
  case WM_DELETE:
    GUI_DEBUG_LOG("EDIT: _Callback(WM_DELETE)\n");
    Delete(pObj);
    break;       /* No return here ... WM_DefaultProc needs to be called */
  }
  WM_DefaultProc(pMsg);
}
示例#15
0
void mitk::GLMapper::MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType  type )
{
  bool visible = true;

  GetDataNode()->GetVisibility(visible, renderer, "visible");

  if(!visible)
    return;

  // the if-condition ensures that Paint(renderer) is only called once, otherwise it will be called four times
  // it does not mean that OpenGL renders only an opaque scene
  if(type == mitk::VtkPropRenderer::Opaque)
    Paint(renderer);

}
示例#16
0
文件: radar.cpp 项目: Yurand/tw-light
void ZRadar::animate(Frame *space)
{
	STACKTRACE;

	//If the radar is disabled, don't do anything.
	if (active==FALSE) return;

	//Tell the frame to redraw this space
	space->add_box(0,0,Blank->w,Blank->h);

	//Copy the blank slate onto the temporary bitmap Painted
	if (Blank) blit(Blank, Painted, 0,0,0,0,Blank->w, Blank->h);
	else clear_bitmap(Painted);

	if (t!=NULL) {
		SpaceLocation *l = t->get_focus();
		Paint(Painted,l->pos);
		if (!t->exists()) t=NULL;
	}
	else        Paint(Painted, game->size/2.);

	//Copy Painted onto space->frame, which will then paint it on the screen.
	blit(Painted,space->surface,0,0,0,0,Blank->w,Blank->h);
}
示例#17
0
void MyFrame1::OnMouseMove(wxMouseEvent &event)
{
  if (event.LeftIsDown())
  {
    wxCoord x, y;
    event.GetPosition(&x, &y);
    m_v2.x = (float)x;
    m_v2.y = (float)(m_panel1->GetSize().y - y);
    m_curPrimitive->AddVertex(m_v2);
    Paint();  
    if (CanvasSetting::Get().GetType() != PT_Pencil)
    {
      m_curPrimitive->RemoveLastVertex();
    }
  }
}
示例#18
0
void CTweakSystem::Fill(XMLScoreWrapper& Score, CLayout *Layout, int ActivePage, int ActiveSystem)
{
    m_Layout=Layout;
    m_ActivePage=ActivePage;
    m_ActiveSystem=ActiveSystem;
    ui->ScoreView->SetXML(Score);
    ui->ScoreView->setLocked(false);
    ui->ScoreView->setFollowResize(false);
    ui->ScoreView->setNavigationVisible(true);
    ui->ScoreView->setSize(Layout->Options.ScaleSize*2.0);
    Paint();
    ui->ScoreView->adjustSize();
    ui->FadingWidget->adjustSize();
    ui->FadingWidget->setFixedSize(ui->FadingWidget->size());
    FillVoicesCombo(ui->ScoreView->ActiveStaff());
}
示例#19
0
int main(int argc, char **argv)
{
	if(SDL_Init(SDL_INIT_VIDEO) < 0)
		return 1;

	int videoflags = SDL_HWSURFACE | SDL_HWACCEL | SDL_FULLSCREEN | SDL_DOUBLEBUF;
	SDL_Surface * screen = OpenScreen(1024, 768, 32, videoflags);
	if(!screen)
		return 1;

	SDL_Event event;
	bool done = false;

	while(!done)
	{
		if(SDL_PollEvent(&event))
		{
			switch (event.type)
			{
				case SDL_KEYDOWN:
					if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
						break;
					if(event.key.keysym.sym == SDLK_RETURN)
					{
						videoflags ^= SDL_FULLSCREEN;
						screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
						if(!screen)
							done = true;
						break;
					}
				case SDL_QUIT:
					done = true;
					break;
				default:
					break;
			}
		}
		else
		{
			Paint(screen);
			SDL_Flip(screen);
		}
	}
	SDL_FreeSurface(screen);
	SDL_Quit();
	return 0;
}
LRESULT MainWindow::WndProc( UINT iMessage, WPARAM wParam, LPARAM lParam )
{
    switch (iMessage)
    {
	case WM_CREATE:
	    break;
        case WM_PAINT:
            Paint();
            break;
        case WM_DESTROY:
            PostQuitMessage( 0 );
            break;
        default:
            return DefWindowProc( hWnd, iMessage, wParam, lParam );
    }
    return 0;
}
示例#21
0
LRESULT ClockWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
	switch(nmsg) {
	  case WM_PAINT:
		Paint();
		break;

	  case WM_LBUTTONDBLCLK:
		launch_cpanel(_hwnd, TEXT("timedate.cpl"));
		break;

	  default:
		return super::WndProc(nmsg, wparam, lparam);
	}

	return 0;
}
示例#22
0
/**
 * This function is called when the Radar needs repainting.
 * @param canvas The canvas to paint on
 */
void
FlarmTrafficWindow::OnPaint(Canvas &canvas)
{
#ifdef ENABLE_OPENGL
  if (small) {
    const GLBlend blend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    canvas.SelectBlackPen();
    canvas.Select(Brush(look.background_color.WithAlpha(0xd0)));
    canvas.DrawCircle(radar_mid.x, radar_mid.y, radius);

  } else
#endif
    canvas.Clear(look.background_color);

  Paint(canvas);
}
void CalcDist::Init()
{
	
	m_cursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_CURSOR2));
	m_oldCursor = SetCursor(m_cursor);

	RECT rect;
	if (GetWindowRect(m_hWnd, &rect))
	{
		m_maxWidth = rect.right - rect.left;
		m_maxHeight = rect.bottom - rect.top;
	}
	m_maxWidth *= 2;
	m_maxHeight *= 2;

	Paint(NULL, NULL, NULL);
}
示例#24
0
void CCheckListBoxItem::DrawItem(COwnerDrawListBox* pList, LPDRAWITEMSTRUCT pDrawItemStruct)
{
	if (pDrawItemStruct->itemID != -1)
	{
		if ((pDrawItemStruct->itemAction & (ODA_DRAWENTIRE|ODA_SELECT|ODA_FOCUS)) != 0)
		{
			// Paint the item.
			Paint(pList, pDrawItemStruct);
		}
			
		if (IsFocused(pList, pDrawItemStruct))
		{
			 // This item is focused, preview it.
			Preview(pList, pDrawItemStruct);
		}
	}
}
示例#25
0
/**
 * This function is called when the Radar needs repainting.
 * @param canvas The canvas to paint on
 */
void
FlarmTrafficWindow::OnPaintBuffer(Canvas &canvas)
{
#ifdef ENABLE_OPENGL
  if (small) {
    const ScopeAlphaBlend alpha_blend;

    canvas.SelectBlackPen();
    canvas.Select(Brush(look.background_color.WithAlpha(0xd0)));
    canvas.DrawCircle(radar_mid.x, radar_mid.y, radius);

  } else
#endif
    canvas.Clear(look.background_color);

  Paint(canvas);
}
示例#26
0
void MASTER::Proceed(ELEMENT* starting_element)
{
	// listy u¿ywane podczas obliczeñ
	OUTPUT_LIST list1;
	OUTPUT_LIST list2;
	OUTPUT_LIST* current_list = &list1;
	OUTPUT_LIST* next_list = &list2;

	// utworzenie listy startowej
	InitProcessing(starting_element, elements_set, current_list);

	// g³ówna pêtla
	unsigned i;
	for (i = 0; i < elements_set.RetAmount() * 2; i++)
	{
		bool state_changed = false;

		// właściwe działanie elementów 
		// (dla NANDÓW jest to albo odczytanie stanów wejściowych i propagacja 
		// albo ustalenie stanu i wysłanie sygnału do nowych elementów (czyli dodanie ich do next_list)
		// dla pozostałych elementów jest to po prostu ustalenie stanu
		for (unsigned j = 0; j < current_list->retAmount(); j++)
		{
			state_changed |= (*current_list)[j]->element->Proceed(next_list);

			char u = (*current_list)[j]->element->RetId()+'0';
			//MessageBox(hwnd, &u, "debug", MB_OK);
		}

		// zamiana wskaźników
		SwitchLists(current_list, next_list);

		if (starting_element && !state_changed)
			break;
	}


	//if (i && i == elements_set.RetAmount() * 2 && !unstable_system_notification)
	//{
	//	MessageBox(hwnd, "Podany układ jest niestabilny.", "NAND2", MB_OK);
	//	unstable_system_notification = true;
	//}
	Paint();
	return;
}
示例#27
0
void wxOwnerDrawFrame::OnPaint(wxPaintEvent& event)
{
	wxPaintDC dc(this);
	wxASSERT(TRUE == dc.Ok());

	//avoid flicker
	wxMemoryDC memDC;
	memDC.SelectObject(mMemBitmap);

	memDC.SetBackground(*wxBLACK);
	memDC.Clear();

	Paint(memDC);

	dc.Blit(0, 0, mMemBitmap.GetWidth(), mMemBitmap.GetHeight(), &memDC, 0, 0);

	event.Skip();
}
示例#28
0
void EditView::GenerateSmall()
{
  if ( m_pcLargeBitmap == NULL ) {
    return;
  }

  delete m_pcSmallBitmap;
  m_pcSmallBitmap = new Bitmap( 16, 16, CS_RGB32, Bitmap::SHARE_FRAMEBUFFER );
  
  Scale( m_pcLargeBitmap, m_pcSmallBitmap, m_nFilterType, 0.0f );
  if ( m_bLargeSelected ) {
    m_pcScaleIconView->SetBitmap( m_pcLargeBitmap );
  } else {
    m_pcScaleIconView->SetBitmap( m_pcSmallBitmap );
  }
  Paint( GetBounds() );
  Flush();
}
示例#29
0
 void GboxInstance::HandleMessage(const pp::Var& var_message) {
   if (!var_message.is_string()) return;
   std::string message = var_message.AsString();
   pp::Var var_reply;
   if (message == kHelloString) {
     theLog.info("message: '%s'", message.c_str());
     Hello();
   } else if (message == kPaintMethodId) {
     Paint();
   } else if (message == kClockMethodId) {
     Clock();
   } else if (message == "quiet") {
     theLog.info("message: '%s'", message.c_str());
     Quiet();
   } else {
     theLog.info("other message: '%s'", message.c_str());
     Other(message);
   }
 }
示例#30
0
STDMETHODIMP_(void) ISubPicAllocatorPresenterImpl::SetPosition(RECT w, RECT v)
{
	bool fWindowPosChanged = !!(m_WindowRect != w);
	bool fWindowSizeChanged = !!(m_WindowRect.Size() != CRect(w).Size());

	m_WindowRect = w;

	bool fVideoRectChanged = !!(m_VideoRect != v);

	m_VideoRect = v;

	if(fWindowSizeChanged || fVideoRectChanged)
	{
		if(m_pAllocator)
		{
			m_pAllocator->SetCurSize(m_WindowRect.Size());
			m_pAllocator->SetCurVidRect(m_VideoRect);
		}

		if(m_pAllocator2)
		{
			m_pAllocator2->SetCurSize(m_WindowRect.Size());
			m_pAllocator2->SetCurVidRect(m_VideoRect);
		}
		if(m_pSubPicQueue)
		{
			m_pSubPicQueue->Invalidate();
		}
		if(m_pSubPicQueue2)
		{
			m_pSubPicQueue2->Invalidate();
		}
	}

	//CString szLog;
	//szLog.Format(_T("WVSize %d %d %d %d "), m_WindowRect.Width(), m_WindowRect.Height(), m_VideoRect.Width(), m_VideoRect.Height());
	//SVP_LogMsg(szLog);

	if(fWindowPosChanged || fVideoRectChanged)
		Paint(fWindowSizeChanged || fVideoRectChanged);

	m_sublib2.ResSetForcePos();
}