// Algorithm 3.5 in NW06 void SolversLS::LinesearchStrongWolfe(void) { double prestepsize = 0, fpre = f1, newslopepre = initialslope; integer times = 0; LSstatus = SUCCESS; while (1) { f2 = h(); if (f2 > f1 + LS_alpha * stepsize * initialslope) { Zoom(prestepsize, fpre, newslopepre, stepsize, f2); return; } newslope = dh(); if (fabs(newslope) <= -LS_beta * initialslope) { return; } if (newslope >= 0) { Zoom(stepsize, f2, newslope, prestepsize, fpre); return; } prestepsize = stepsize; fpre = f2; newslopepre = newslope; if (stepsize == Maxstepsize) { LSstatus = MAXSTEPSIZE; return; } stepsize = (2 * stepsize < Maxstepsize) ? 2 * stepsize : Maxstepsize; } };
void GraphEditor::keyPressEvent(QKeyEvent *k) {key_pressed = k->key(); if(key_pressed == Qt::Key_Up)Zoom(1); else if(key_pressed == Qt::Key_Down)Zoom(-1); else if(key_pressed == Qt::Key_Home)Zoom(0); else k->ignore(); }
void DrawLab::zoom_based(MPoint base,Coord delta) { if( !delta ) return; Pane clip=Pane(Null,normal.getSize()); ulen len=dots.getLen(); Ratio zoom=Zoom(delta); DynArray<Smooth::Dot> new_dots(len); for(ulen i=0; i<len ;i++) { Smooth::Dot dot=dots[i]; dot.point=Zoom(dot.point,base,zoom); if( !clip.contains(dot.point.toPoint()) ) return; new_dots[i]=dot; } Swap(dots,new_dots); redraw(); }
void FractalCreator::run(string filename) { addZoom(Zoom(_width/2, _height/2, 4.0/_width)); addZoom(Zoom(295, _height - 202, 0.1)); addZoom(Zoom(312, _height - 304, 0.1)); calculateIteration(); calculateRangeTotal(); drawFractal(); writeBitmap(filename); }
void QTFDisplayCCls::Paint(Draw& draw, const Rect& r, const Value& v, Color ink, Color paper, dword style) const { String s; s << "[@(" << ink.GetR() << "." << ink.GetG() << "." << ink.GetB() << ") " << v; RichText rtext = ParseQTF(s); rtext.ApplyZoom(GetRichTextStdScreenZoom()); draw.DrawRect(r, paper); draw.Clipoff(r); int cy = rtext.GetHeight(Zoom(1, 1), r.Width()); rtext.Paint(Zoom(1, 1), draw, 0, max(0, (r.Height() - cy) / 2), r.Width()); draw.End(); }
HelpViewer::HelpViewer() { // adds toolbar AddFrame(toolBar); // setups splitter and its contents Add(splitter); splitter.Horz(tocPane, contentsPane).SetPos(2500); contentsPane.AutoHideSb(); contentsPane.SetZoom(Zoom(1,1)); contentsPane.HMargins(20); tocPane.Add(mainTocTree.NoRoot().SizePos()); // setup TOC link callback mainTocTree.WhenSel = THISBACK(tocLinkCb); contentsPane.WhenLink << THISBACK(contentLinkCb); // initialize link stack stack.Clear(); tos = -1; Sizeable().Zoomable(); // loads toolbar toolBar.Set(THISBACK(toolBarCb)); }
void AudacityProject::OnZoomIn(wxEvent & event) { double origLeft = mViewInfo.h; double origWidth = mViewInfo.screen; Zoom(mViewInfo.zoom *= 2.0); TP_ScrollWindow(origLeft + (origWidth - mViewInfo.screen) / 2 ); }
AboutDlg() { Size isz = MakeLogo(*this, ctrl); int cx = min(isz.cx * 2, GetWorkArea().GetWidth()); SetRect(0, 0, cx, isz.cy); about.SetQTF(GetTopic("ide/app/About$en-us"), Zoom(DPI(120), 1024)); about.SetZoom(Zoom(1, 1)); about.RightPos(0, cx - isz.cx - DPI(1)).VSizePos(); about.HMargins(Zx(4)); about.SetFrame(NullFrame()); about.NoLazy(); Background(PaintRect(ColorDisplay(), SColorPaper())); Add(about); // separator.Color(Gray()); // Add(separator.RightPos(cx - isz.cx, DPI(1)).VSizePos()); Title("About TheIDE"); }
void CCamera::AdjustCamera( vec3_t pos , vec3_t angles ) { int flag; vec3_t point; m_characterAngle = angles[ YAW ]; VectorCopy( m_characterPos , pos ); VectorCopy( point , pos ); point[2] = point[2] + CAMERA_VIEW_HEIGHT; if( !m_isThirdPerson ) { VectorCopy( m_position , pos ); m_position[2] = m_position[2] + CAMERA_VIEW_HEIGHT; return; } flag = CheckCameraPos( point , m_distance , m_angles ); if( !flag ) { Zoom(15*5); if( m_distance >= -40.0f ) m_distance = -30.0f; flag = CheckCameraPos( point , m_distance , m_angles ); } }
void CWeaponTranquilizer::ToggleZoom( void ) { if ( m_bInZoom ) UnZoom(); else Zoom(); }
void RenderParameters::ResetGraphLayout() { filter_wrap_width = RenderParameters::def_wrap_width; filter_x_gap = RenderParameters::def_x_gap; filter_y_gap = RenderParameters::def_y_gap; Zoom(def_zoom); }
bool MayaCamera::MouseDrag(int button, int x, int y, const ModifierKeys& mods) { if (mods.alt) { int dx = x - prevx; int dy = y - prevy; if (button == MOUSE_LEFT_BUTTON) { OrbitLeft(-dx * orbitSpeed); OrbitUp(dy * orbitSpeed); } else if (button == MOUSE_MIDDLE_BUTTON) { DollyLeft(dx * dollySpeed); DollyUp(dy * dollySpeed); } else if (button == MOUSE_RIGHT_BUTTON) { int val = (abs(dx) > abs(dy) ? dx : dy); Zoom(val * zoomSpeed); } prevx = x; prevy = y; return true; } return false; }
void Orbit(float dx, float dy) { if(Params.Zoom) Zoom(dy*0.01 + 1); else camera.Orbit(dx*0.005,dy*0.005); }
//腐蚀 void Erode(double *src,int s_width,int s_height,double *dst,int d_width,int d_height,double *se,int se_width,int se_height,Position *center){ if(center==NULL){ Position temp; temp.x=se_width/2; temp.y=se_height/2; center=&temp; } MoveDirection m; double *temp=(double *)malloc(sizeof(double)*d_width*d_height); double *tempdst=(double *)malloc(sizeof(double)*d_width*d_height); double *realdst=(double *)malloc(sizeof(double)*d_width*d_height); Zero(realdst, d_width, d_height); Zoom(src,s_width,s_height,temp,d_width,d_height); for(int i=0;i<se_width;i++){ for(int j=0;j<se_height;j++){ if(se[j*se_width+i]>100.0){ m.x=center->x-i; m.y=center->y-j; Translation(temp,tempdst,d_width,d_height, &m); And(tempdst, realdst, realdst,d_width,d_height); } } } matrixCopy(realdst, dst, d_width, d_height); free(temp); free(realdst); free(tempdst); }
Zoom RichTextView::GetZoom() const { int szcx = GetSize().cx; if(!sb.IsShown() && sb.IsAutoHide()) szcx -= ScrollBarSize(); return IsNull(zoom) ? Zoom(szcx - margin.left - margin.right, cx) : zoom; }
void ViewCtrl::reset(){ Zoom(1.0); int i; for(i=0; i<16; i++) InitialModelMatrix[i]=(i%4==i/4)?1.0:0.0; memcpy(InvMVMat,InitialModelMatrix,sizeof(InvMVMat)); glInvMat(InvMVMat); }
String GatherTpp::QtfAsHtml(const char *qtf, Index<String>& css, const VectorMap<String, String>& links, const VectorMap<String, String>& labels, const String& outdir, const String& fn) { return EncodeHtml(ParseQTF(qtf), css, links, labels, outdir, fn, Zoom(8, 40), escape, 40); }
void View1TO1() { int x, y, res, ratio; LFIXED fixed; HDC hDC; HWND hWnd; LPDISPLAY lpDisplay; LPIMAGE lpImage; if (hWnd = GetActiveDoc()) { lpImage = GetImagePtr(hWnd); lpDisplay = GetDisplayPtr(hWnd); hDC = GetDC( PictPubApp.Get_hWndAstral() ); x = GetDeviceCaps( hDC, HORZRES ); // in pixels ReleaseDC( PictPubApp.Get_hWndAstral(), hDC ); fixed = FGET( FUNITY, Control.ScreenWidth ); if (res = FMUL( x, fixed)) // in pixels/inch { ratio = ( 100L * res ) / FrameResolution(ImgGetBaseEditFrame(lpImage)); x = ( lpDisplay->FileRect.left + lpDisplay->FileRect.right ) / 2; y = ( lpDisplay->FileRect.top + lpDisplay->FileRect.bottom ) / 2; Zoom( hWnd, x, y, ratio, NO, View.ZoomWindow ); } } }
void COrbitController::MyMouseMove(int dx, int dy, int rdx, int rdy, int button) { switch (button) { case SDL_BUTTON_LEFT: { rotation = cRotation - (dx * orbitSpeedFact); elevation = cElevation - (dy * orbitSpeedFact); } break; case SDL_BUTTON_RIGHT: { distance = cDistance - (dy * zoomSpeedFact); } break; } if (elevation > 89.0f) elevation = 89.0f; if (elevation < -89.0f) elevation = -89.0f; if (distance < 1.0f) distance = 1.0f; switch (button) { case SDL_BUTTON_LEFT: { Orbit(); } break; case SDL_BUTTON_MIDDLE: { Pan(rdx, rdy); } break; case SDL_BUTTON_RIGHT: { Zoom(); } break; } }
FractalCreator::FractalCreator(int width, int height) : m_width(width), m_height(height), m_histogram( new int[Mandelbrot::MAX_ITERATIONS] { 0 }), m_fractal( new int[m_width * m_height] { 0 }), m_bitmap(m_width, m_height), m_zoomList( m_width, m_height) { // TODO Auto-generated constructor stub m_zoomList.add(Zoom(m_width / 2, m_height / 2, 4.0 / m_width)); }
void CAMERA::Update(MOUSE &mouse, float timeDelta) { //Restrict focus movment to the xz-plane m_right.y = m_look.y = 0.0f; D3DXVec3Normalize(&m_look, &m_look); D3DXVec3Normalize(&m_right, &m_right); //Move Focus (i.e. Scroll) if(mouse.x < mouse.m_viewport.left + 10) Scroll(-m_right * timeDelta * 30.0f); if(mouse.x > mouse.m_viewport.right - 10) Scroll(m_right * timeDelta * 30.0f); if(mouse.y < mouse.m_viewport.top + 10) Scroll(m_look * timeDelta * 30.0f); if(mouse.y > mouse.m_viewport.bottom - 10) Scroll(-m_look * timeDelta * 30.0f); //Move Camera (i.e. Change Angle) if(KEYDOWN(VK_LEFT))Yaw(-timeDelta); if(KEYDOWN(VK_RIGHT))Yaw(timeDelta); if(KEYDOWN(VK_UP))Pitch(timeDelta); if(KEYDOWN(VK_DOWN))Pitch(-timeDelta); //Zoom (i.e. change fov) if(KEYDOWN(VK_ADD))Zoom(-timeDelta); if(KEYDOWN(VK_SUBTRACT))Zoom(timeDelta); //Change m_radius if(mouse.WheelUp()) ChangeRadius(-1.0f); if(mouse.WheelDown())ChangeRadius(1.0f); //Calculate Eye Position float sideRadius = m_radius * cos(m_beta); float height = m_radius * sin(m_beta); m_eye = D3DXVECTOR3(m_focus.x + sideRadius * cos(m_alpha), m_focus.y + height, m_focus.z + sideRadius * sin(m_alpha)); if(m_pDevice != NULL) { D3DXMATRIX view = GetViewMatrix(); D3DXMATRIX projection = GetProjectionMatrix(); m_pDevice->SetTransform(D3DTS_VIEW, &view); m_pDevice->SetTransform(D3DTS_PROJECTION, &projection); CalculateFrustum(view, projection); } }
void AudacityProject::OnZoomSel(wxEvent & event) { if (mViewInfo.sel1 <= mViewInfo.sel0) return; Zoom(mViewInfo.zoom * mViewInfo.screen / (mViewInfo.sel1 - mViewInfo.sel0)), TP_ScrollWindow(mViewInfo.sel0); }
RichTextCtrl::RichTextCtrl() { SetZoom(Zoom(1, 1)); Transparent(); Background(Null); SetFrame(NullFrame()); AutoHideSb(); }
int main() { FractalCreator fractalCreator(800, 600); fractalCreator.addRange(0.0, RGB(0, 0, 0)); fractalCreator.addRange(0.3, RGB(255, 0, 0)); fractalCreator.addRange(0.5, RGB(255, 255, 0)); fractalCreator.addRange(1.0, RGB(255, 255, 255)); fractalCreator.addZoom(Zoom(295, 202, 0.1)); fractalCreator.addZoom(Zoom(312, 304, 0.1)); fractalCreator.run("test.bmp"); std::cout << "Finished" << std::endl; return 0; }
void BookViewPreview::SetZoomFactor(float factor) { SettingsStore settings; settings.setZoomPreview(factor); SetCurrentZoomFactor(factor); Zoom(); emit ZoomFactorChanged(factor); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFHunterRifle::HandleZooms( void ) { // Get the owning player. CTFPlayer *pPlayer = ToTFPlayer( GetOwner() ); if ( !pPlayer ) return; // Handle the zoom when taunting. if ( pPlayer->m_Shared.InCond( TF_COND_TAUNTING ) ) { if ( pPlayer->m_Shared.InCond( TF_COND_AIMING ) ) { ToggleZoom(); } //Don't rezoom in the middle of a taunt. ResetTimers(); } if ( m_flUnzoomTime > 0 && gpGlobals->curtime > m_flUnzoomTime ) { if ( m_bRezoomAfterShot ) { ZoomOutIn(); m_bRezoomAfterShot = false; } else { ZoomOut(); } m_flUnzoomTime = -1; } if ( m_flRezoomTime > 0 ) { if ( gpGlobals->curtime > m_flRezoomTime ) { ZoomIn(); m_flRezoomTime = -1; } } if ( ( pPlayer->m_nButtons & IN_ATTACK2 ) && ( m_flNextSecondaryAttack <= gpGlobals->curtime ) ) { // If we're in the process of rezooming, just cancel it if ( m_flRezoomTime > 0 || m_flUnzoomTime > 0 ) { // Prevent them from rezooming in less time than they would have m_flNextSecondaryAttack = m_flRezoomTime + TF_WEAPON_HUNTERRIFLE_ZOOM_TIME; m_flRezoomTime = -1; } else { Zoom(); } } }
/** * \brief Handle custom events * \param event The custom event */ void GallerySlideView::customEvent(QEvent *event) { if ((MythEvent::Type)(event->type()) == MythEvent::MythEventMessage) { MythEvent *me = (MythEvent *)event; QString message = me->Message(); QStringList extra = me->ExtraDataList(); if (message == "IMAGE_METADATA" && !extra.isEmpty()) { int id = extra[0].toInt(); ImagePtrK selected = m_view->GetSelected(); if (selected && selected->m_id == id) m_infoList.Display(*selected, extra.mid(1)); } else if (message == "THUMB_AVAILABLE") { if (!extra.isEmpty() && m_view->Update(extra[0].toInt())) ShowSlide(0); } } else if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent *)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); if (resultid == "metadatamenu") { switch (buttonnum) { case 0: Transform(kRotateCW); break; case 1: Transform(kRotateCCW); break; case 2: Transform(kFlipHorizontal); break; case 3: Transform(kFlipVertical); break; case 4: Transform(kResetToExif); break; case 5: Zoom(10); break; case 6: Zoom(-10); break; } } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponOICW::Drop(const Vector &velocity) { if (m_bZoomed) { Zoom(); } BaseClass::Drop(velocity); }
void DrawSmartText(Draw& draw, int x, int y, int cx, const char *text, Font font, Color ink, int accesskey) { if(*text == '\1') { RichText txt = ParseQTF(text + 1, accesskey); txt.ApplyZoom(GetRichTextStdScreenZoom()); txt.Paint(Zoom(1, 1), draw, x, y, cx); return; } DrawTLText(draw, x, y, cx, ToUnicode(text, CHARSET_DEFAULT), font, ink, accesskey); }
void OverheadCamera::MousePressed(int button, int, int, bool) { const float zoomSpeed = inputHandler->GetKeySensitivity() * 10.0f * sensMultiplier; switch (button) { case SDL_BUTTON_WHEELDOWN: { if (ctrlPressed) Rotate(-5.0f); else Zoom(+1, zoomSpeed); } break; case SDL_BUTTON_WHEELUP: { if (ctrlPressed) Rotate(+5.0f); else Zoom(-1, zoomSpeed); } break; } }