WeddingPlatform.Web 1.0.0.0
지도, 갤러리, 방명록, 계좌 안내와 배경음악을 링크 하나에 담는 무료 모바일 청첩장 서비스입니다.
로딩중...
검색중...
일치하는것 없음
WeddingPlatform.Services.OgImageGenerator 클래스 참조

더 자세히 ...

정적 Public 멤버 함수

static void EnsureGenerated (string wwwrootPath)

정적 Private 멤버 함수

static void DrawCenteredText (Graphics g, string text, Font font, Color color, float cx, float cy)
static void DrawCircle (Graphics g, float x, float y, float diameter, int alphaPercent)
static void DrawRoundedRect (Graphics g, RectangleF rect, float radius, Color fill, Color stroke, float strokeWidth)
static void FillRoundedRect (Graphics g, Brush brush, RectangleF rect, float radius)
static GraphicsPath RoundedRectPath (RectangleF rect, float r)

상세한 설명

앱 시작 시 wwwroot/img/og-platform.jpg 를 자동 생성한다. System.Drawing (net8.0-windows) 사용.

OgImageGenerator.cs 파일의 16 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ DrawCenteredText()

void WeddingPlatform.Services.OgImageGenerator.DrawCenteredText ( Graphics g,
string text,
Font font,
Color color,
float cx,
float cy )
inlinestaticprivate

Draw Centered Text 작업을 수행합니다.

매개변수
gg에 사용할 Graphics 값입니다.
texttext에 사용할 string 값입니다.
fontfont에 사용할 Font 값입니다.
colorcolor에 사용할 Color 값입니다.
cxcx에 사용할 float 값입니다.
cycy에 사용할 float 값입니다.

OgImageGenerator.cs 파일의 164 번째 라인에서 정의되었습니다.

165 {
166 using var brush = new SolidBrush(color);
167 var size = g.MeasureString(text, font);
168 g.DrawString(text, font, brush, cx - size.Width / 2f, cy - size.Height / 2f);
169 }

다음에 의해서 참조됨 : EnsureGenerated().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ DrawCircle()

void WeddingPlatform.Services.OgImageGenerator.DrawCircle ( Graphics g,
float x,
float y,
float diameter,
int alphaPercent )
inlinestaticprivate

Draw Circle 작업을 수행합니다.

매개변수
gg에 사용할 Graphics 값입니다.
xx에 사용할 float 값입니다.
yy에 사용할 float 값입니다.
diameterdiameter에 사용할 float 값입니다.
alphaPercentalpha Percent에 사용할 int 값입니다.

OgImageGenerator.cs 파일의 219 번째 라인에서 정의되었습니다.

220 {
221 int alpha = (int)(255 * alphaPercent / 100.0);
222 using var brush = new SolidBrush(Color.FromArgb(alpha, 200, 168, 130));
223 g.FillEllipse(brush, x, y, diameter, diameter);
224 }

다음에 의해서 참조됨 : EnsureGenerated().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ DrawRoundedRect()

void WeddingPlatform.Services.OgImageGenerator.DrawRoundedRect ( Graphics g,
RectangleF rect,
float radius,
Color fill,
Color stroke,
float strokeWidth )
inlinestaticprivate

Draw Rounded Rect 작업을 수행합니다.

매개변수
gg에 사용할 Graphics 값입니다.
rectrect에 사용할 RectangleF 값입니다.
radiusradius에 사용할 float 값입니다.
fillfill에 사용할 Color 값입니다.
strokestroke에 사용할 Color 값입니다.
strokeWidthstroke Width에 사용할 float 값입니다.

OgImageGenerator.cs 파일의 282 번째 라인에서 정의되었습니다.

284 {
285 using var path = RoundedRectPath(rect, radius);
286 using var fillBrush = new SolidBrush(fill);
287 g.FillPath(fillBrush, path);
288 using var pen = new Pen(stroke, strokeWidth);
289 g.DrawPath(pen, path);
290 }

다음을 참조함 : RoundedRectPath().

다음에 의해서 참조됨 : EnsureGenerated().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ EnsureGenerated()

void WeddingPlatform.Services.OgImageGenerator.EnsureGenerated ( string wwwrootPath)
inlinestatic

Ensure Generated 작업을 수행합니다.

매개변수
wwwrootPathwwwroot Path에 사용할 string 값입니다.

OgImageGenerator.cs 파일의 34 번째 라인에서 정의되었습니다.

35 {
36 var imgDir = Path.Combine(wwwrootPath, "img");
37 var outPath = Path.Combine(imgDir, "og-platform.jpg");
38
39 if (File.Exists(outPath)) return;
40
41 Directory.CreateDirectory(imgDir);
42
43 const int W = 1200, H = 630;
44 using var bmp = new Bitmap(W, H, PixelFormat.Format32bppArgb);
45 using var g = Graphics.FromImage(bmp);
46 g.SmoothingMode = SmoothingMode.AntiAlias;
47 g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
48
49 // ── 배경 그라데이션 ───────────────────────────────────────
50 using (var bgBrush = new LinearGradientBrush(
51 new Point(0, 0), new Point(W, H),
52 Color.FromArgb(253, 246, 238),
53 Color.FromArgb(238, 220, 200)))
54 {
55 g.FillRectangle(bgBrush, 0, 0, W, H);
56 }
57
58 // ── 장식 원 ───────────────────────────────────────────────
59 DrawCircle(g, -80, -80, 320, 12);
60 DrawCircle(g, 920, 350, 400, 10);
61 DrawCircle(g, 970, -60, 160, 8);
62 DrawCircle(g, 50, 420, 200, 8);
63
64 // ── 카드 ─────────────────────────────────────────────────
65 var cardRect = new RectangleF(200, 100, 800, 430);
66 DrawRoundedRect(g, cardRect, 24,
67 Color.FromArgb(220, 255, 255, 255),
68 Color.FromArgb(80, 200, 168, 130), 2);
69
70 // ── 이모지 대신 하트 아이콘 (텍스트) ─────────────────────
71 using var iconFont = new Font("Segoe UI Emoji", 48, FontStyle.Regular, GraphicsUnit.Pixel);
72 DrawCenteredText(g, "💒", iconFont, Color.FromArgb(58, 46, 40), W / 2f, 200);
73
74 // ── 메인 타이틀 ───────────────────────────────────────────
75 using var titleFont = new Font("맑은 고딕", 46, FontStyle.Bold, GraphicsUnit.Pixel);
76 DrawCenteredText(g, "무료 모바일 청첩장", titleFont, Color.FromArgb(58, 46, 40), W / 2f, 285);
77
78 // ── 서브타이틀 ────────────────────────────────────────────
79 using var subFont = new Font("맑은 고딕", 22, FontStyle.Regular, GraphicsUnit.Pixel);
80 DrawCenteredText(g, "사진 · 음악 · 지도 · 방명록 · 계좌 안내", subFont,
81 Color.FromArgb(122, 106, 94), W / 2f, 348);
82
83 // ── 구분선 ────────────────────────────────────────────────
84 using var linePen = new Pen(Color.FromArgb(128, 200, 168, 130), 1.5f);
85 g.DrawLine(linePen, 420, 382, 780, 382);
86
87 // ── 배지 ─────────────────────────────────────────────────
88 var badgeRect = new RectangleF(470, 398, 260, 42);
89 using var badgeBrush = new SolidBrush(Color.FromArgb(200, 168, 130));
90 FillRoundedRect(g, badgeBrush, badgeRect, 21);
91 using var badgeFont = new Font("맑은 고딕", 17, FontStyle.Bold, GraphicsUnit.Pixel);
92 DrawCenteredText(g, "5분이면 완성 · 완전 무료", badgeFont, Color.White, W / 2f, 425);
93
94 // ── 도메인 ────────────────────────────────────────────────
95 using var domFont = new Font("Arial", 19, FontStyle.Regular, GraphicsUnit.Pixel);
96 DrawCenteredText(g, "wedding.codemaru.co.kr", domFont,
97 Color.FromArgb(100, 58, 46, 40), W / 2f, 492);
98
99 // ── JPEG 저장 ─────────────────────────────────────────────
100 var jpegParams = new EncoderParameters(1);
101 jpegParams.Param[0] = new EncoderParameter(Encoder.Quality, 92L);
102 var jpegCodec = ImageCodecInfo.GetImageEncoders()
103 .First(c => c.FormatID == ImageFormat.Jpeg.Guid);
104
105 bmp.Save(outPath, jpegCodec, jpegParams);
106 }

다음을 참조함 : DrawCenteredText(), DrawCircle(), DrawRoundedRect(), FillRoundedRect().

다음에 의해서 참조됨 : WeddingPlatform.Program.Run().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ FillRoundedRect()

void WeddingPlatform.Services.OgImageGenerator.FillRoundedRect ( Graphics g,
Brush brush,
RectangleF rect,
float radius )
inlinestaticprivate

Fill Rounded Rect 작업을 수행합니다.

매개변수
gg에 사용할 Graphics 값입니다.
brushbrush에 사용할 Brush 값입니다.
rectrect에 사용할 RectangleF 값입니다.
radiusradius에 사용할 float 값입니다.

OgImageGenerator.cs 파일의 332 번째 라인에서 정의되었습니다.

333 {
334 using var path = RoundedRectPath(rect, radius);
335 g.FillPath(brush, path);
336 }

다음을 참조함 : RoundedRectPath().

다음에 의해서 참조됨 : EnsureGenerated().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ RoundedRectPath()

GraphicsPath WeddingPlatform.Services.OgImageGenerator.RoundedRectPath ( RectangleF rect,
float r )
inlinestaticprivate

Rounded Rect Path 작업을 수행합니다.

매개변수
rectrect에 사용할 RectangleF 값입니다.
rr에 사용할 float 값입니다.
반환값
Rounded Rect Path 작업에서 생성한 GraphicsPath 결과입니다.

OgImageGenerator.cs 파일의 370 번째 라인에서 정의되었습니다.

371 {
372 var path = new GraphicsPath();
373 path.AddArc(rect.X, rect.Y, r * 2, r * 2, 180, 90);
374 path.AddArc(rect.Right - r * 2, rect.Y, r * 2, r * 2, 270, 90);
375 path.AddArc(rect.Right - r * 2, rect.Bottom - r * 2, r * 2, r * 2, 0, 90);
376 path.AddArc(rect.X, rect.Bottom - r * 2, r * 2, r * 2, 90, 90);
377 path.CloseFigure();
378 return path;
379 }

다음에 의해서 참조됨 : DrawRoundedRect(), FillRoundedRect().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: