Teknik makale

PDFium: low-vision color filters and reading modes in Delphi

Delphi ve C++Builder uygulamalarına PDFium VCL Component iş akışlarını, Lazarus/FPC projelerine PDFium LCL Component iş akışlarını; görüntüleme, render, formlar, yazdırma, preflight raporları ve standart odaklı doğrulama için kaynak kodlu bileşenlerle ekleyin.

Bu yazı developers adding viewing aids for users who need contrast, color inversion, or reduced visual strain için hazırlanmıştır. low-vision color filters and reading modes konusunu tek bir bileşen çağrısı olarak değil, üretim düzeyinde belge mühendisliği olarak ele alır.

Pratik risk şudur: display filters can help users read documents, but they can also mislead review workflows if the application does not explain that the source PDF is unchanged. Bu nedenle akışın yazılı sözleşmeye, gözlemlenebilir tanılara ve gerçekçi regresyon dosyalarına ihtiyacı vardır.

Mimari kararlar

Keep visual assistance separate from document editing. available modes such as high contrast, grayscale, inverted color, and warm background / whether filters apply to pages, thumbnails, selection highlights, and annotations

  • available modes such as high contrast, grayscale, inverted color, and warm background
  • whether filters apply to pages, thumbnails, selection highlights, and annotations
  • preference persistence per user, per document, or per application profile
  • screen capture, print, and export behavior while filters are active

Uygulama akışı

Apply filters in the rendering pipeline. Aşağıdaki sıra, iş akışını Delphi ve C++Builder ekipleri için incelenebilir tutar.

  1. add filter selection to viewer state rather than PDF modification code
  2. render representative text, images, forms, and annotations through each mode
  3. keep selection colors and focus indicators visible under every filter
  4. show whether printing uses the original PDF appearance or the filtered view
  5. record mode settings when users report readability issues

Doğrulama kanıtı

Usability evidence for low-vision modes. Bu alanları çıktı veya destek kaydıyla birlikte saklayın.

  • filter mode, contrast ratio spot checks, zoom level, and page rendering backend
  • selection, annotation, form-field, and focus visibility under the active mode
  • preference storage decision and reset path
  • support screenshot that clearly labels filtered display state

A filter is a view, not a document change

Low-vision support should alter the rendered presentation without changing the PDF bytes. Users need predictable toggles, persistent preferences, clear print behavior, and fallback text when a document cannot be read visually.

Decision table for low-vision color filters and reading modes

A decision table keeps product ownership visible when the same workflow is reused by a desktop tool, service job, and support utility.

DecisionEngineering reasonEvidence
available modes such as high contrast, grayscale, inverted color, and warm backgroundadd filter selection to viewer state rather than PDF modification codefilter mode, contrast ratio spot checks, zoom level, and page rendering backend
whether filters apply to pages, thumbnails, selection highlights, and annotationsrender representative text, images, forms, and annotations through each modeselection, annotation, form-field, and focus visibility under the active mode
preference persistence per user, per document, or per application profilekeep selection colors and focus indicators visible under every filterpreference storage decision and reset path

Mühendislik inceleme notları: low-vision color filters and reading modes

Özelliğin bir demoyu aşıp sürüm, destek ve müşteri eskalasyonu sırasında savunulabilir olduğunu doğrulamak için bu inceleme notlarını kullanın.

  • Karar: available modes such as high contrast, grayscale, inverted color, and warm background. Uygulama baskı noktası: render representative text, images, forms, and annotations through each mode. Kabul kanıtı: preference storage decision and reset path. Regresyon tetikleyicisi: dark-mode application chrome should not reduce document focus visibility
  • Karar: whether filters apply to pages, thumbnails, selection highlights, and annotations. Uygulama baskı noktası: keep selection colors and focus indicators visible under every filter. Kabul kanıtı: support screenshot that clearly labels filtered display state. Regresyon tetikleyicisi: image-heavy PDFs may lose detail under aggressive contrast transforms
  • Karar: preference persistence per user, per document, or per application profile. Uygulama baskı noktası: show whether printing uses the original PDF appearance or the filtered view. Kabul kanıtı: filter mode, contrast ratio spot checks, zoom level, and page rendering backend. Regresyon tetikleyicisi: highlight colors can disappear if filters are applied after overlay painting
  • Karar: screen capture, print, and export behavior while filters are active. Uygulama baskı noktası: record mode settings when users report readability issues. Kabul kanıtı: selection, annotation, form-field, and focus visibility under the active mode. Regresyon tetikleyicisi: printing a filtered view may be desired for accessibility but wrong for legal review

Sınır durumları

  • image-heavy PDFs may lose detail under aggressive contrast transforms
  • highlight colors can disappear if filters are applied after overlay painting
  • printing a filtered view may be desired for accessibility but wrong for legal review
  • dark-mode application chrome should not reduce document focus visibility

Delphi / C++Builder notes

PDFium Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. Important terms include color filter, contrast, inversion, reading mode, render pipeline, accessibility.

Delphi kod örneği

Aşağıdaki Delphi taslağı bu konu için pratik bir servis sınırını gösterir. Politika kontrollerini, günlüklemeyi ve doğrulamayı dar ürün çağrısı bölümünün dışında tutarak akışı test edilebilir bırakın.

procedure TPreviewForm.ApplyReadingTheme(const Theme: TReadingTheme);
begin
  FCurrentTheme := Theme;
  RenderCurrentPage;
  ApplyBitmapColorMatrix(FPageBitmap, Theme.ColorMatrix);
  PaintContrastCheckedBitmap(FPageBitmap);
  LogAccessibilitySetting(Theme.Name);
end;

Üretim kontrol listesi

  • İş akışını boş bir dosyada, normal bir müşteri dosyasında ve en kötü durum dosyasında çalıştırın
  • Oluşturulan PDF'yi hedef görüntüleyici, doğrulayıcı, yazıcı veya aşağı akış uygulamasıyla açın
  • Ürün sürümünü, profil sürümünü, giriş karmasını, çıktı yolunu, geçen süreyi ve uyarı sayısını kaydedin
  • Parolaları, sertifikaları, geçici dosyaları ve müşteri verilerini açık saklama kuralları altında tutun
  • Bir müşteri dosyası yeni bir uç durum ortaya çıkardığında regresyon belgeleri ekleyin

Ürün belgeleri

PDFium Component

Ek kod örnekleri

// Engine-level: grayscale applied during rasterization
GrayA := Pdf.RenderPage(0, 0, W, H, ro0, [reGrayscale]);

// Post-process: render in color, convert the finished bitmap
GrayB := Pdf.RenderPage(0, 0, W, H);
GrayscalePdfBitmap(GrayB);
// Affects the on-screen view only
PdfView.PageColor := $00D9EDF2;  // warm paper tone behind page content

// RenderPage output ignores PageColor; pass the color explicitly
Bmp := Pdf.RenderPage(0, 0, W, H, ro0, [], $00D9EDF2);