Repository navigation
feat(picture): give a new picture a shadow or a glow - #448
Merged
Merged
Conversation
add_picture takes shadow=PictureShadow(...) (colour, alpha 0..1, blur, direction 0..359 clockwise from the right, distance, inside) and glow=PictureGlow(...) (colour, alpha, radius), written into hp:effects as a Hancom document holds them. Hancom saves an alpha past 0..1 as the bound, a direction modulo 360 and an unknown shadow style as OUTSIDE, and draws a negative radius as 0, so such values are refused before anything is added (shape-picture-effect-value). Hancom lays the picture out as large as it and its outer shadow or glow together. The two classes are exported from hwpx.oxml (134 -> 136 names) and live in oxml/shape_position.py beside the picture's other checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
리뷰 결과: 막을 것은 없습니다. CI가 통과하면 병합합니다.
|
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
바뀐 점
그림을 만들 때(
doc.add_picture,HwpxOxmlParagraph.add_picture) 그림자와 빛남을 줄 수 있다. 두 클래스는hwpx.oxml에서 가져온다.PictureShadowcolor(#000000),alpha(0.5),blur(600),direction(45),distance(600),inside(False)hp:effects/hp:shadowPictureGlowcolor(#FFC000),alpha(0.5),radius(500)hp:effects/hp:glowalpha는 투명도다. 0이면 불투명하고, 1이면 그리지 않는다.direction은 오른쪽에서 시계 방향으로 잰 각도다. 0은 오른쪽, 90은 아래, 180은 왼쪽, 270은 위다.blur,distance,radius)는 HWPUNIT이다.skew·scale·effectsColor(RGB)가 들어가고, 순서는 그림자 다음에 빛남이다.한/글의 동작
shape-picture-effect-value로 거부한다. 한/글은 그런 값을 그대로 두지 않기 때문이다.alpha가 0~1 밖이면 끝값으로 저장한다.direction은 360으로 나눈 나머지로 저장한다(-90은 270, 450은 90).OUTSIDE로 저장한다.코드
oxml/shape_position.py: 다른 그림 검사 옆에PictureShadow·PictureGlow·validate_picture_effects·append_picture_effects를 둔다. 새 모듈을 두면import hwpx가 싣는 모듈 수 상한을 넘는다.oxml/objects.py:_create_picture_element와_paragraph_add_picture가shadow·glow를 받는다._document/media.py,document.py: 문서 수준add_picture가 같은 인자를 받고, 이진 항목을 넣기 전에 검사한다.oxml/__init__.py:PictureGlow·PictureShadow를 내보낸다(hwpx.oxml.__all__134 → 136,tests/test_oxml_modularization.py에 사유 주석).errors.py·docs/error-codes.md:shape-picture-effect-value.docs/coverage-ledger.*재생성:hp:glow·hp:effectsColor·hp:rgb·hp:scale·hp:skew를 코드가 쓴다.docs/support-matrix.md(동봉본 동기화),README.md·README_EN.md(알려진 제약, 예제 원장 해시), 변경 로그.tests/data/document_facade_surface.json:add_picture서명.쪽 수 추정이 효과가 늘린 그림 크기를 셈에 넣는 일은 이 PR에 넣지 않았다(후속).
테스트
tests/test_picture_adjustments.py:picture_shadow_and_glow.hwpx(아래 그림자 거리 800 + 빛남 700)의hp:effects아래 요소·속성과 같게 쓰는지 본다.🤖 Generated with Claude Code