/******************************************************************************************** > BOOL MaskedFilterExportOptions::CopyFromMasked(MaskedFilterExportOptions *pOther) Author: Stefan_Stoykov (Xara Group Ltd) <*****@*****.**> Created: 15/07/97 Inputs: pOther - the other MaskedFilterExportOptions object to copy the data from Purpose: Sets the contents of this object from the passed object. This differs form the more general function in that it doesn't require the two objects to be of the same class. Used to convert from/to PNG options and MakeBitmapExportOptions. See Also: BitmapExportOptions::MakeCopy() ********************************************************************************************/ BOOL MaskedFilterExportOptions::CopyFromMasked(MaskedFilterExportOptions *pOther) { if (pOther == NULL) return FALSE; //BitmapExportOptions members m_SelectionType = pOther->m_SelectionType; m_OutputSize = pOther->m_OutputSize; m_PixelOutputSize = pOther->m_PixelOutputSize; m_pBmpDlgParam = pOther->m_pBmpDlgParam; m_NumColsInPalette = pOther->m_NumColsInPalette; m_UseSystemColours = pOther->m_UseSystemColours; m_bSeparateLayerFiles = pOther->m_bSeparateLayerFiles; m_bTempFileFlag = pOther->m_bTempFileFlag; SetDPI(pOther->GetDPI()); SetDepth(pOther->GetDepth()); SetTransparencyIndex(pOther->GetTransparencyIndex()); if (pOther->IsValid()) MarkValid(); else MarkInvalid(); //MaskedFilterExportOptions m_Dither = pOther->m_Dither; m_bInterlaced = pOther->m_bInterlaced; return TRUE; }
void AbstractRenderView::initializeForFirstPaint() { if (m_onFirstPaintInitialized) { return; } m_onFirstPaintInitialized = true; // let the subclass create a context first initializeRenderContext(); auto updateRenWinDpi = [this] () -> void { auto renWin = renderWindow(); auto nativeParent = nativeParentWidget(); if (!renWin || !nativeParent) { return; } const auto dpi = static_cast<int>(nativeParent->windowHandle()->screen()->logicalDotsPerInch()); if (dpi != renWin->GetDPI()) { renWin->SetDPI(dpi); } }; if (auto nativeParent = nativeParentWidget()) { connect(nativeParent->windowHandle(), &QWindow::screenChanged, updateRenWinDpi); } updateRenWinDpi(); }
DPoint CalcAbsSizes(RefPtr<Pango::Layout> lay, double dpi) { SetDPI(lay, dpi); DPoint res; _CalcAbsSizes(lay, res.x, res.y); return res; }
PRBool nsThebesDeviceContext::CheckDPIChange() { PRInt32 oldDevPixels = mAppUnitsPerDevNotScaledPixel; PRInt32 oldInches = mAppUnitsPerInch; SetDPI(); return oldDevPixels != mAppUnitsPerDevNotScaledPixel || oldInches != mAppUnitsPerInch; }
void ImagemapDlg::OnAreaDrawingClicked() { //Make sure the "Area for imagemap - Selection" button is off SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE); //And set the width and height fields to reflect the width //and height of the drawing scaled by 96 DPI SetDPI(DRAWING, BMPFilter::GetDefaultExportDPI()); }
void TextContext::Init(RefPtr<Gdk::Pixbuf> canv_pix, double dpi) { ASSERT( canv_pix ); caiSur = GetAsImageSurface(canv_pix); caiCont = Cairo::Context::create(caiSur); panLay = Pango::Layout::create(caiCont); SetDPI(panLay, dpi); }
AsyncPanZoomController::AsyncPanZoomController(GeckoContentController* aGeckoContentController) : mState(NOTHING), mX(this), mY(this), mMetricsUpdated(false), mIsCompositing(false), mReentrantMonitor("asyncpanzoomcontroller"), mDPI(72), mGeckoContentController(aGeckoContentController) { SetDPI(mDPI); }
/******************************************************************************************** > virtual BOOL MakeBitmapExportOptions::RetrieveDefaults() Author: Colin_Barfoot (Xara Group Ltd) <*****@*****.**> Created: 29/10/96 Purpose: See BitmapExportInfo for interface details: gets GIF specific preferences ********************************************************************************************/ BOOL MakeBitmapExportOptions::RetrieveDefaults() { BOOL ok = FALSE; if (MaskedFilterExportOptions::RetrieveDefaults()) { SetDPI(g_Dpi); SetDepth(g_Depth); SetDither(g_Dither); ok = TRUE; } return ok; }
nsresult nsDeviceContextOS2::Init( nsNativeWidget aWidget) { mWidget = aWidget; CommonInit(::WinOpenWindowDC((HWND)aWidget)); static int initialized = 0; PRInt32 prefVal = -1; if (!initialized) { initialized = 1; // Set prefVal the value of the preference // "layout.css.dpi" // or -1 if we can't get it. // If it's negative, we pretend it's not set. // If it's 0, it means force use of the operating system's logical // resolution. // If it's positive, we use it as the logical resolution nsresult res; nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res)); if (NS_SUCCEEDED(res) && prefs) { res = prefs->GetIntPref("layout.css.dpi", &prefVal); if (NS_FAILED(res)) { prefVal = -1; } prefs->RegisterCallback("layout.css.dpi", prefChanged, (void *)this); } SetDPI(prefVal); } else { SetDPI(mDpi); // to setup p2t and t2p } return NS_OK; }
AsyncPanZoomController::AsyncPanZoomController(GeckoContentController* aGeckoContentController, GestureBehavior aGestures) : mGeckoContentController(aGeckoContentController), mX(this), mY(this), mMonitor("AsyncPanZoomController"), mLastSampleTime(TimeStamp::Now()), mState(NOTHING), mDPI(72) { if (aGestures == USE_GESTURE_DETECTOR) { mGestureEventListener = new GestureEventListener(this); } SetDPI(mDPI); }
NS_IMETHODIMP nsThebesDeviceContext::Init(nsIWidget *aWidget) { mWidget = aWidget; SetDPI(); #ifdef NS_DEBUG NS_ASSERTION(!mInitialized, "device context is initialized twice!"); mInitialized = PR_TRUE; #endif // register as a memory-pressure observer to free font resources // in low-memory situations. nsCOMPtr<nsIObserverService> obs(do_GetService("@mozilla.org/observer-service;1")); if (obs) obs->AddObserver(this, "memory-pressure", PR_TRUE); mScreenManager = do_GetService("@mozilla.org/gfx/screenmanager;1"); return NS_OK; }
NS_IMETHODIMP nsThebesDeviceContext::Init(nsIWidget *aWidget) { if (mScreenManager && mWidget == aWidget) return NS_OK; mWidget = aWidget; SetDPI(); if (mScreenManager) return NS_OK; // register as a memory-pressure observer to free font resources // in low-memory situations. nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); if (obs) obs->AddObserver(this, "memory-pressure", PR_TRUE); mScreenManager = do_GetService("@mozilla.org/gfx/screenmanager;1"); return NS_OK; }
void ImagemapDlg::SetOptions(ImagemapFilterOptions ifoSet) { //First let's set the options which we should get from ifoSet. //These are the controls which remember the values which the user set //for the last export. //Set the "save clickable areas as rectangles" SetLongGadgetValue(_R(IDC_IMAGEMAP_ALLRECTANGLES), ifoSet.m_fAllRectangles); //Set the "copy imagemap to clipboard" SetLongGadgetValue(_R(IDC_IMAGEMAP_CLIPBOARD), ifoSet.m_fClipboard); //Set up the "Approximate curves with lines" drop down box DeleteAllValues(_R(IDC_IMAGEMAP_APPROX)); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_VERYCLOSELY)), FALSE, 0); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_CLOSELY)), FALSE, 1); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_APPROXIMATELY)), FALSE, 2); SetStringGadgetValue(_R(IDC_IMAGEMAP_APPROX), &String_256(_R(IDS_IMAGEMAP_APPROX_NOTATALL)), FALSE, 3); SetComboListLength(_R(IDC_IMAGEMAP_APPROX)); //And choose the appropriate value switch (ifoSet.m_ffApprox) { case FF_VERYCLOSELY: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 0); break; case FF_CLOSELY: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 1); break; case FF_APPROXIMATELY: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 2); break; default: ERROR3("ImagemapDlg::SetOptions - invalid flattening factor"); case FF_NOTATALL: SetSelectedValueIndex(_R(IDC_IMAGEMAP_APPROX), 3); break; } //Now, let's set up the remaining controls with default values. These //controls do not remember their settings between exports //The "Map Name" combo box //First delete all the values that were previously in this box DeleteAllValues(_R(IDC_IMAGEMAP_MAPNAME)); //Have we been passed a list of names to put in the combo box? if (ms_plstNames) { //Yes. So go through them, one by one, putting them into the combo box StringListItem* psliThis=(StringListItem*) ms_plstNames->GetHead(); INT32 iListPos=0; while (psliThis!=NULL) { String_256 strToSet=psliThis->GetString(); SetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME), &strToSet, FALSE, iListPos); iListPos++; psliThis=(StringListItem*) ms_plstNames->GetNext(psliThis); } //And select the first item SetSelectedValueIndex(_R(IDC_IMAGEMAP_MAPNAME),0); } else //No. So simply set a default name into the combo box SetStringGadgetValue(_R(IDC_IMAGEMAP_MAPNAME), &String_256(_R(IDS_IMAGEMAP_DEFAULTMAPNAME)), FALSE,-1); SetComboListLength(_R(IDC_IMAGEMAP_MAPNAME)); //Set the Area For Imagemap radio buttons according to whether there is a selection //or not //Is there a selection? SelRange* pSelRange=GetApplication()->FindSelection(); if (pSelRange && !pSelRange->IsEmpty()) { //Yes. So enable the selection radio button (in case it was disabled before) EnableGadget(_R(IDC_IMAGEMAP_AREA_SELECTION), TRUE); //And select it SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), TRUE); SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_DRAWING), FALSE); //And set the width and height fields to reflect the width //and height of the selection scaled by 96 DPI SetDPI(SELECTION, BMPFilter::GetDefaultExportDPI()); } else { //No. So disable the selection radio button EnableGadget(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE); //And select the drawing radio button SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_SELECTION), FALSE); SetLongGadgetValue(_R(IDC_IMAGEMAP_AREA_DRAWING), TRUE); //And set the width and height fields to reflect the width //and height of the drawing scaled by 96 DPI SetDPI(DRAWING, BMPFilter::GetDefaultExportDPI()); } }