Beispiel #1
0
static void transform_to_distance(heman_image* img)
{
    int width = img->width;
    int height = img->height;
    int size = width * height;
    HEMAN_FLOAT* ff = NEW(HEMAN_FLOAT, size);
    HEMAN_FLOAT* dd = NEW(HEMAN_FLOAT, size);
    HEMAN_FLOAT* zz = NEW(HEMAN_FLOAT, (height + 1) * (width + 1));
    uint16_t* vv = NEW(uint16_t, size);
    uint16_t* ww = NEW(uint16_t, size);

#pragma omp parallel for
    for (int x = 0; x < width; ++x) {
        HEMAN_FLOAT* f = ff + height * x;
        HEMAN_FLOAT* d = dd + height * x;
        HEMAN_FLOAT* z = zz + (height + 1) * x;
        uint16_t* v = vv + height * x;
        uint16_t* w = ww + height * x;
        for (int y = 0; y < height; ++y) {
            f[y] = TEXEL(x, y);
        }
        edt(f, d, z, v, w, height);
        for (int y = 0; y < height; ++y) {
            TEXEL(x, y) = d[y];
        }
    }

#pragma omp parallel for
    for (int y = 0; y < height; ++y) {
        HEMAN_FLOAT* f = ff + width * y;
        HEMAN_FLOAT* d = dd + width * y;
        HEMAN_FLOAT* z = zz + (width + 1) * y;
        uint16_t* v = vv + width * y;
        uint16_t* w = ww + width * y;
        for (int x = 0; x < width; ++x) {
            f[x] = TEXEL(x, y);
        }
        edt(f, d, z, v, w, width);
        for (int x = 0; x < width; ++x) {
            TEXEL(x, y) = d[x];
        }
    }

    free(ff);
    free(dd);
    free(zz);
    free(vv);
    free(ww);
}
Beispiel #2
0
LRESULT EncryptionPage::onBrowsePrivateKey(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	tstring target = Text::toT(SETTING(TLS_PRIVATE_KEY_FILE));
	CEdit edt(GetDlgItem(IDC_TLS_PRIVATE_KEY_FILE));

	BrowseDlg dlg(m_hWnd, BrowseDlg::TYPE_NOSAVE, BrowseDlg::DIALOG_SELECT_FILE);
	dlg.setPath(target, true);
	if (dlg.show(target)) {
		edt.SetWindowText(&target[0]);
	}
	return 0;
}
Beispiel #3
0
LRESULT EncryptionPage::onBrowseTrustedPath(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	tstring target = Text::toT(SETTING(TLS_TRUSTED_CERTIFICATES_PATH));
	CEdit edt(GetDlgItem(IDC_TLS_TRUSTED_CERTIFICATES_PATH));

	BrowseDlg dlg(m_hWnd, BrowseDlg::TYPE_NOSAVE, BrowseDlg::DIALOG_SELECT_FOLDER);
	dlg.setPath(target, true);
	if (dlg.show(target)) {
		edt.SetWindowText(&target[0]);
	}
	return 0;
}
Beispiel #4
0
void SeqToolBarView::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case AmToolBar::TOOL_BAR_OBS: {
			CacheDrawingInfo();
			int32	action;
			/* If a tool was just replaced (i.e. AM_CHANGED),
			 * I can get away with just redrawing myself.
			 * Otherwise, my window needs to know about the change.
			 * This is a bit hacky.
			 */
			if (msg->FindInt32("action", &action) == B_OK
					&& action != AM_CHANGED) {
				Window()->PostMessage(AmGlobalsI::TOOL_BAR_OBS);
			} else Invalidate();
		} break;
		case PROPERTIES_MSG: {
			const char*			toolKey;
			AmToolRef			toolRef;
			AmToolRoster*		roster = AmToolRoster::Default();
			if (msg->FindString("tool_key", &toolKey) == B_OK
					&& roster && (toolRef = roster->FindTool(toolKey)).IsValid() ) {
				// READ TOOL LOCK
				BString			n;
				const AmTool*	tool = toolRef.ReadLock();
				if (tool) n = tool->Label();
				toolRef.ReadUnlock(tool);
				// END READ TOOL BLOCK
				if (n.Length() > 0) n << " ";
				n << "Tool";
				BWindow*		win = new SeqPipelinePropertyWindow(AmPipelineMatrixRef(toolRef),
																	NULLINPUTOUTPUT_PIPELINE,
																	n.String(), Window() );
				if (win) win->Show();
			}
		} break;
		case EDIT_MSG: {
			const char*		toolKey;
			const char*		path;
			if (msg->FindString("tool_key", &toolKey) == B_OK
					&& msg->FindString("path", &path) == B_OK) {
				BMessage	edt(SHOW_EDIT_TOOL_MSG);
				edt.AddString("tool_key", toolKey);
				edt.AddString("path", path);
				be_app->PostMessage(&edt);
			}
		} break;
		case REMOVE_FROM_TOOL_BAR_MSG: {
			const char*		toolKey;
			if (msg->FindString("tool_key", &toolKey) == B_OK) {
				BString		str(toolKey);
				// WRITE TOOL BAR LOCK
				AmToolBar*		toolBar = mToolBarRef.WriteLock();
				if (toolBar) toolBar->RemoveTool(str);
				mToolBarRef.WriteUnlock(toolBar);
				// END WRITE TOOL BAR BLOCK
			}
		} break;
		case AM_DRAG_TOOL_MSG: {
			const char*		toolName;
			if (msg->FindString("tool_name", &toolName) == B_OK)
				HandleToolDrop(toolName);
		} break;
		default:
			inherited::MessageReceived(msg);
	}
}