Skip to content

PageLayerTree image paint op에 brightness/contrast 필드 추가 필요 #508

@postmelee

Description

@postmelee

배경

rhwp v0.7.9 기준으로 PageRenderTreeImageNode에는 이미지 보정에 필요한 필드가 포함되어 있습니다.

  • effect
  • brightness
  • contrast
  • crop
  • original_size_hu

legacy/core SVG renderer도 이 값을 사용해 이미지 효과와 밝기/대비를 반영합니다. 예를 들어 samples/복학원서.hwp의 워터마크 이미지는 effect=GrayScale, brightness=-50, contrast=70 조합으로 출력됩니다.

반면 PageLayerTree JSON의 PaintOp::Image serialization은 현재 effect, crop, fillMode, originalSize, transform 등은 내보내지만 brightnesscontrast를 내보내지 않는 것으로 보입니다.

문제

downstream native renderer가 장기적으로 PageLayerTree만 backend replay contract로 사용하려면, image paint op 하나만 보고 core SVG와 같은 이미지 필터 결과를 재현할 수 있어야 합니다.

현재 JSON에는 effect만 있고 brightness/contrast가 없어서 다음 문제가 생깁니다.

  • PageRenderTree 기반 renderer는 brightness/contrast를 읽을 수 있음
  • PageLayerTree 기반 renderer는 같은 이미지 보정 값을 알 수 없음
  • PageLayerTree로 전환하는 downstream renderer가 core SVG와 시각적으로 다른 결과를 낼 수 있음

대표 증상은 samples/복학원서.hwp의 워터마크가 흐린 배경처럼 처리되지 않고 원본에 가까운 강한 이미지로 보일 수 있는 점입니다.

기대 동작

PageLayerTree의 image paint op JSON에도 brightnesscontrast가 포함되면 좋겠습니다.

예상 필드 예시:

{
  "type": "image",
  "bbox": { "x": 137.706, "y": 270.240, "width": 495.040, "height": 495.733 },
  "crop": { "left": 0, "top": 0, "right": 54600, "bottom": 54660 },
  "effect": "grayScale",
  "brightness": -50,
  "contrast": 70,
  "transform": { "rotation": 0.0, "horzFlip": false, "vertFlip": false }
}

기본값은 현재 ImageNode 기본값과 맞춰 brightness=0, contrast=0으로 두면 downstream 구현이 단순해질 것 같습니다.

제안

  • src/paint/json.rsPaintOp::Image JSON serialization에 brightness, contrast 추가
  • 관련 serialization test에 image brightness/contrast assertion 추가
  • incompatible schema change로 볼지 여부는 maintainer 판단에 따라 PAGE_LAYER_TREE_SCHEMA_VERSION bump 검토

downstream 관점

alhangeul-macos에서는 현재 제품 경로는 PageRenderTree를 유지하고 있지만, 장기적으로 PageLayerTree 전환을 검토하고 있습니다. 전환 전에 이 필드가 layer contract에 포함되면 native renderer가 core update를 더 안정적으로 따라갈 수 있습니다.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions