示例#1
0
void SubtitlesPreview::SetText(wxString text) {
	wxString newText = L"{\\q2}" + text;
	if (newText != line->Text) {
		line->Text = newText;
		UpdateBitmap();
	}
}
void SymbolPanel::SetFontInfo( FontInfoPtr info, int symbolNumber )
{
	mFontInfo = info;
	mSymbolNumber = symbolNumber;
	UpdateBitmap();
	UpdateControlLines();
}
示例#3
0
void SubtitlesPreview::SetText(std::string const& text) {
	std::string new_text = "{\\q2}" + text;
	if (new_text != line->Text) {
		line->Text = new_text;
		UpdateBitmap();
	}
}
示例#4
0
void SubtitlesPreview::SetColour(agi::Color col) {
	if (col != back_color) {
		back_color = col;
		vid.reset(new DummyVideoProvider(0.0, 10, bmp->GetWidth(), bmp->GetHeight(), back_color, true));
		UpdateBitmap();
	}
}
示例#5
0
void CGraphicsView::OnFileOpen()
{
	// TODO:  在此添加命令处理程序代码
	CFileDialog dlg(TRUE, TEXT(".BMP"), TEXT("*.BMP"));

	if (dlg.DoModal() == IDOK)
	{
		CGraphicsDoc* pDoc = GetDocument();

		pDoc->LoadBitmap(dlg.GetPathName());
		Bitmap* pBitmap = pDoc->GetSrcBitmap();

// 		Bitmap* pPPM = pBitmap->Clone();
// 		pPPM->SwapChannel(0, 2);
// 		Save2PPM(pPPM, "f:\\1.ppm");
// 		delete pPPM;
#if 0
		m_pBitmap = new CBitmap;
		m_pBitmap->CreateCompatibleBitmap(GetDC(), pBitmap->biWidth, pBitmap->biHeight);
		m_pBitmap->ExtendAlpha(255);
		m_pBitmap->SetBitmapBits(pBitmap->size, pBitmap->bits);
#else
		m_pSrcBitmap = CreateBitmap(pBitmap);
#endif
// 		Bitmap* pResult = m_pProcesser->SmoothBitmap(pBitmap, sigma);
// 		m_pDstBitmap = CreateBitmap(pResult);
// 		pDoc->SetDstBitmap(pResult);
// 
// 		m_strText.Format(TEXT("smooth sigma = %f"), sigma);
//		SendMessage(WM_PAINT, 0, 0);
		UpdateBitmap(sigma);
	}
}
示例#6
0
void
PreviewView::AttachedToWindow()
{	
	BView::AttachedToWindow();
	SetViewColor(Parent()->ViewColor());
	UpdateBitmap();
}
示例#7
0
void SubtitlesPreview::SetStyle(AssStyle const& newStyle) {
	*style = newStyle;
	style->name = "Default";
	style->alignment = 5;
	memset(style->Margin, 0, 4 * sizeof(int));
	style->UpdateData();
	UpdateBitmap();
}
示例#8
0
void SubtitlesPreview::SetStyle(AssStyle const& new_style) {
	*style = new_style;
	style->name = "Default";
	style->alignment = 5;
	std::fill(style->Margin.begin(), style->Margin.end(), 0);
	style->UpdateData();
	UpdateBitmap();
}
示例#9
0
void UppPackageViewWindow::OnZoomOut(wxCommandEvent& WXUNUSED(event))
{
    if (min(m_bmp.GetWidth(), m_bmp.GetHeight()) <= MIN_SIZE)
        return;     // zooming out of the bitmap makes the bitmap smaller and smaller;
                    // when reaching an invalid size (width/height == 0) an assert
                    // would fail in UpdateBitmap(); avoid it
    UpdateBitmap(m_bmp.GetSize()*(1.0/1.5));
	m_fitting = m_bmp.GetSize() == GetClientSize();	
}
示例#10
0
void UppPackageViewWindow::OnZoomIn(wxCommandEvent& WXUNUSED(event))
{
    if (max(m_bmp.GetWidth(), m_bmp.GetHeight()) >= MAX_SIZE)
        return;     // zooming into the bitmap consumes memory; without this limit
                    // the app would crash at some point (depending on the user's system)
                    // because of some malloc() call returning NULL...
    UpdateBitmap(m_bmp.GetSize()*1.5);
	m_fitting = m_bmp.GetSize() == GetClientSize();
}
示例#11
0
void CBackgndImageDlg::OnBrowse() 
{
	CFileDialog dlg (TRUE, _T("bmp"), m_strFilePath, OFN_HIDEREADONLY, 
		_T("Bitmap Files (*.bmp)|*.bmp|All Files (*.*)|*.*||"), this);
	if (dlg.DoModal () == IDOK)
	{
		m_strFilePath = dlg.GetPathName ();
		UpdateData (FALSE);

		UpdateBitmap ();
	}
}
示例#12
0
BOOL CGraphicsView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
	// TODO:  在此添加消息处理程序代码和/或调用默认值
	if (zDelta > 0)
		sigma += 0.1f;
	else
		sigma -= 0.1f;

	if (sigma < 0.0f) sigma = 0.0f;

	UpdateBitmap(sigma);

	return CView::OnMouseWheel(nFlags, zDelta, pt);
}
示例#13
0
void CBackgndImageDlg::OnImageType() 
{
	UpdateData ();

	m_wndFilePath.EnableWindow (m_iImageType == 1);
	m_wndBrowse.EnableWindow (m_iImageType == 1);

	if (m_iImageType == 1)
	{
		m_wndFilePath.SetFocus ();
	}

	UpdateBitmap ();
}
示例#14
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::TabSChange(TObject *Sender)
{
	if( m_DisEvent ) return;

	m_DisEvent++;
	m_CurFile = -1;
	m_CurPage = pTabS->TabIndex;
	pCurPage = pFileV[m_CurPage];
	UD->Max = SHORT(pCurPage->m_MaxPage-1);
	UD->Position = SHORT(pCurPage->m_CurPage);
	if( (pCurPage->pList == NULL) || (pCurPage->pBitmapS == NULL) ){
		LoadImage();
	}
	UpdateBitmap();
	UpdateStat();
	m_DisEvent--;
}
示例#15
0
//---------------------------------------------------------------------------
int __fastcall CThumb::LoadThumb(int n, Graphics::TBitmap *pbmp, TRect rc, USHORT crc, int &size)
{
	if( pITBL == NULL ) return FALSE;
	if( pBitmap == NULL ) return FALSE;
//    if( rc.Bottom != m_SizeY ) return FALSE;
	if( (n < m_FileCount) && UpdateBitmap(n) ){
		if( crc == pITBL[n+1].crc ){
			int x = (n % THUMBWIND) * m_SizeX;
			TRect sc;
			sc.Left = x; sc.Top = 0;
			sc.Right = x + m_SizeX; sc.Bottom = m_SizeY;
			pbmp->Canvas->CopyRect(rc, pBitmap->Canvas, sc);
			size = pITBL[n+1].size;
			return TRUE;
		}
	}
	return FALSE;
}
示例#16
0
//---------------------------------------------------------------------------
void __fastcall CThumb::SaveThumb(int n, Graphics::TBitmap *pbmp, TRect rc, USHORT crc, int size)
{
	if( pITBL == NULL ) return;
	if( pBitmap == NULL ) return;
	if( n < m_FileCount ){
		if( (n / THUMBWIND) != m_Top ) UpdateBitmap(n);
		int x = (n % THUMBWIND) * m_SizeX;
		TRect tc;
		tc.Left = x; tc.Top = 0;
		tc.Right = x + m_SizeX; tc.Bottom = m_SizeY;
		pBitmap->Canvas->CopyRect(tc, pbmp->Canvas, rc);
		n++;
		pITBL[n].crc = crc;
		pITBL[n].size = size;
		m_UpdateBmp = 1;
		m_UpdateIdx = 1;
	}
}
示例#17
0
void CGraphicsView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// TODO:  在此添加消息处理程序代码和/或调用默认值
	if (nChar == 38)
	{
		sigma += 0.1f;
	}
	else if (nChar == 40)
	{
		sigma -= 0.1f;
	}

	if (sigma < 0.0f) sigma = 0.0f;

	UpdateBitmap(sigma);

	CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
示例#18
0
/// @brief Constructor 
/// @param parent   
/// @param id       
/// @param pos      
/// @param size     
/// @param winStyle 
/// @param col      
///
SubtitlesPreview::SubtitlesPreview(wxWindow *parent,int id,wxPoint pos,wxSize size,int winStyle,wxColour col)
: wxWindow(parent,id,pos,size,winStyle)
, style(new AssStyle)
, backColour(col)
, subFile(new AssFile)
, line(new AssDialogue)
{
	line->Text = "{\\q2}preview";

	SetStyle(*style);

	subFile->LoadDefault();
	subFile->InsertStyle(style);
	subFile->Line.push_back(line);

	SetSizeHints(size.GetWidth(), size.GetHeight(), -1, -1);
	wxSizeEvent evt(size);
	OnSize(evt);
	UpdateBitmap();
}
示例#19
0
void
PreviewView::SetRect(BRect rect)
{
	if (fCoordRect == rect)
		return;
		
	fCoordRect = rect;
	
	char str[16];
	snprintf(str, sizeof(str), "%d", (int)rect.left);
	fLeft->SetText(str);
	snprintf(str, sizeof(str), "%d", (int)rect.top);
	fTop->SetText(str);
	snprintf(str, sizeof(str), "%d", (int)rect.right);
	fRight->SetText(str);
	snprintf(str, sizeof(str), "%d", (int)rect.bottom);
	fBottom->SetText(str);
	
	fChanged = true;
	
	UpdateBitmap();
}
示例#20
0
void SubtitlesPreview::OnSize(wxSizeEvent &evt) {
	if (bmp.get() && evt.GetSize() == bmp->GetSize()) return;

	int w = evt.GetSize().GetWidth();
	int h = evt.GetSize().GetHeight();

	bmp.reset(new wxBitmap(w, h, -1));
	vid.reset(new DummyVideoProvider(0.0, 10, w, h, backColour, true));
	try {
		provider.reset(SubtitlesProviderFactory::GetProvider());
	}
	catch (...) {
		wxMessageBox(
			"Could not get any subtitles provider for the preview box. Make "
			"sure that you have a provider installed.",
			"No subtitles provider", wxICON_ERROR | wxOK);
	}

	subFile->SetScriptInfo("PlayResX", wxString::Format("%i", w));
	subFile->SetScriptInfo("PlayResY", wxString::Format("%i", h));

	UpdateBitmap();
}
示例#21
0
SubtitlesPreview::SubtitlesPreview(wxWindow *parent, wxSize size, int winStyle, agi::Color col)
: wxWindow(parent, -1, wxDefaultPosition, size, winStyle)
, style(new AssStyle)
, back_color(col)
, sub_file(agi::util::make_unique<AssFile>())
, line(new AssDialogue)
{
	line->Text = "{\\q2}preview";

	SetStyle(*style);

	sub_file->LoadDefault();
	sub_file->InsertLine(style);
	sub_file->Line.push_back(*line);

	SetSizeHints(size.GetWidth(), size.GetHeight(), -1, -1);
	wxSizeEvent evt(size);
	OnSize(evt);
	UpdateBitmap();

	Bind(wxEVT_PAINT, &SubtitlesPreview::OnPaint, this);
	Bind(wxEVT_SIZE, &SubtitlesPreview::OnSize, this);
}
示例#22
0
void
NetPulseView::Update()
{
	BNetworkInterface interface(fCookie);

	if ((interface.Flags() & IFF_UP) != 0) {
		ifreq_stats stats;
		if (interface.GetStats(stats) == B_OK) {
			fInputRate = fDecayRate * (stats.receive.bytes - fInputBytes)
				+ (1 - fDecayRate) * fInputRate;
			fOutputRate = fDecayRate * (stats.send.bytes - fOutputBytes)
				+ (1 - fDecayRate) * fOutputRate;

			fInputBytes = stats.receive.bytes;
			fOutputBytes = stats.send.bytes;
		}

		fMaxInputRate = fInputRate >= fMaxInputRate
			? fInputRate
			: 0.9 * fMaxInputRate;
		fMaxOutputRate = fOutputRate >= fMaxOutputRate
			? fOutputRate
			: 0.9 * fMaxOutputRate;

		if (!fEnable || fMaxInputRate > 0 || fMaxOutputRate > 0) {
			UpdateBitmap();
			Draw(Bounds());
		}
	} else {
		fInputRate = fOutputRate = 0;
		fMaxInputRate = fMaxOutputRate = 0;
		if (fEnable)
			Draw(Bounds());
	}
	fEnable = ((interface.Flags() & IFF_UP) != 0);
}
示例#23
0
void SubtitlesPreview::OnSize(wxSizeEvent &evt) {
	if (bmp.get() && evt.GetSize() == bmp->GetSize()) return;

	int w = evt.GetSize().GetWidth();
	int h = evt.GetSize().GetHeight();

	bmp = agi::util::make_unique<wxBitmap>(w, h, -1);
	vid.reset(new DummyVideoProvider(0.0, 10, w, h, back_color, true));
	try {
		if (!provider)
			provider = SubtitlesProviderFactory::GetProvider();
	}
	catch (...) {
		wxMessageBox(
			"Could not get any subtitles provider for the preview box. Make "
			"sure that you have a provider installed.",
			"No subtitles provider", wxOK | wxICON_ERROR | wxCENTER);
	}

	sub_file->SetScriptInfo("PlayResX", std::to_string(w));
	sub_file->SetScriptInfo("PlayResY", std::to_string(h));

	UpdateBitmap();
}
示例#24
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::LoadImage(void)
{
	if( !m_Max ) return;
	if( pCurPage->pList == NULL ) LoadFileList();
	m_CurFile = -1;
	UpdateStat();

	CWaitCursor wait;
	MultProc();
	SetCurrentDirectory(pCurPage->m_Folder.c_str());
	Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
	pBitmap->PixelFormat = pf24bit;
	pBitmap->Width = 16;
	pBitmap->Height = 16;

	MultProc();
	int i;
	int n = pCurPage->m_CurPage * m_Max;
	SetBitmapSize();
	for( i = 0; i < m_Max; i++, n++ ){
		TRect rc;
		GetRect(rc, i);
		if( n < pCurPage->pList->Count ){
			USHORT crc;
			LPCSTR pn = pCurPage->pList->Get(crc, n);
			if( !pCurPage->m_Thumb.LoadThumb(n, pCurPage->pBitmapS, rc, crc, pCurPage->m_Size[i]) ){
				LoadFile(pBitmap, pn);
				pCurPage->m_Size[i] = (pBitmap->Height << 16) + pBitmap->Width;
				Graphics::TBitmap *pBitmapT = CreateBitmap(m_RectS.Right, m_RectS.Bottom, -1);
				::SetStretchBltMode(pBitmapT->Canvas->Handle, HALFTONE);
				MultProcA();
				if( sys.m_FileViewKeep ){
					FillBitmap(pBitmapT, clGray);
					if( ((pBitmap->Width <= pBitmapT->Width) && (pBitmap->Height <= pBitmapT->Height)) ){
						pBitmapT->Canvas->Draw(0, 0, pBitmap);
					}
					else {
						KeepAspectDraw(pBitmapT->Canvas, pBitmapT->Width, pBitmapT->Height, pBitmap);
					}
				}
				else {
					pBitmapT->Canvas->StretchDraw(m_RectS, pBitmap);
				}
				pCurPage->m_Thumb.SaveThumb(n, pBitmapT, m_RectS, crc, pCurPage->m_Size[i]);
				pCurPage->pBitmapS->Canvas->CopyRect(rc, pBitmapT->Canvas, m_RectS);
				if( pBox[i] != NULL ){
					pBox[i]->Canvas->Draw(0, 0, pBitmapT);
				}
				delete pBitmapT;
			}
		}
		else {
			pCurPage->pBitmapS->Canvas->Brush->Style = bsSolid;
			pCurPage->pBitmapS->Canvas->Brush->Color = clWhite;
			pCurPage->pBitmapS->Canvas->FillRect(rc);
		}
		MultProc();
	}
	delete pBitmap;
	UpdateBitmap();
}
示例#25
0
BOOL MyBitmapButton::SetBitmapID(int id)
{
    fBitmapID = id;
    UpdateBitmap();
    return TRUE;
}
示例#26
0
void MyBitmapButton::OnSysColorChange(void)
{
    LOGD("MyBitmapButton 0x%p tracking color change", this);
    UpdateBitmap();
}
示例#27
0
void BitmapViewer::Set(const wxImage& image)
{
    m_orig_image = image;
    UpdateBitmap();
}
示例#28
0
void CBackgndImageDlg::OnChangeFilePath() 
{
	UpdateBitmap ();
}
示例#29
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::UDClick(TObject *Sender, TUDBtnType Button)
{
	pCurPage->m_CurPage = UD->Position;
	LoadImage();
	UpdateBitmap();
}
示例#30
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::UpdateList(void)
{
	LoadFileList();
	LoadImage();
	UpdateBitmap();
}