/* Copyright (C) 2017-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: WxdkdrawFrameStipples.cpt */ /** @file WxdkdrawFrameStipples.cpp The WxdkdrawFrameStipples module. */ #line 7 "WxdkdrawFrameStipples.cpt" #include "wxdkdraw.h" #ifndef WXDKDRAWFRAME_H_INCLUDED #include "WxdkdrawFrame.h" #endif #line 17 "WxdkdrawFrameStipples.cpt" /** Calculate bitmap dimensions. @param pw Address of width variable. @param ph Address of height variable. @param patt Pattern type. @param patco Pattern coefficients. */ static void calculate_bitmap_dimensions( int *pw, int *ph, int patt, double const *patco ) { int w = 0; /* Image width */ int h = 0; /* Image height */ #line 38 "WxdkdrawFrameStipples.cpt" switch (patt) { case WXD_FS_30_DEGREE_LEFT : case WXD_FS_30_DEGREE_RIGHT : case WXD_FS_30_DEGREE_SIEVE : { h = (int)ceil(patco[0]); w = (int)ceil(patco[1]); } break; case WXD_FS_45_DEGREE_LEFT : case WXD_FS_45_DEGREE_RIGHT : case WXD_FS_45_DEGREE_SIEVE : { w = h = (int)ceil(patco[2]); } break; case WXD_FS_HORIZONTAL_BRICKS : case WXD_FS_VERTICAL_BRICKS : { w = h = (int)ceil(patco[3]); } break; case WXD_FS_HORIZONTAL_LINES : case WXD_FS_VERTICAL_LINES : case WXD_FS_HORIZONTAL_VERTICAL_SIEVE : { w = h = (int)ceil(patco[4]); } break; case WXD_FS_HORIZONTAL_SHINGLES_LEFT : case WXD_FS_HORIZONTAL_SHINGLES_RIGHT : case WXD_FS_VERTICAL_SHINGLES_1 : case WXD_FS_VERTICAL_SHINGLES_2 : { w = h = (int)ceil(patco[5]); } break; case WXD_FS_LARGE_FISH_SCALES : { w = (int)ceil(patco[6]); h = (int)ceil(patco[7]); } break; case WXD_FS_SMALL_FISH_SCALES : { w = (int)ceil(patco[1]); h = (int)ceil(patco[1]); } break; case WXD_FS_CIRCLES : { w = h = (int)ceil(patco[3]); } break; case WXD_FS_HEXAGONS : { h = (int)ceil(patco[3]); w = (int)ceil(patco[8]); } break; case WXD_FS_OCTAGONS : { w = h = (int)ceil(patco[3]); } break; case WXD_FS_HORIZONTAL_TIRES : { w = (int)ceil(patco[1]); h = (int)ceil(patco[4]); } break; case WXD_FS_VERTICAL_TIRES : { h = (int)ceil(patco[1]); w = (int)ceil(patco[4]); } break; } #line 93 "WxdkdrawFrameStipples.cpt" #line 94 "WxdkdrawFrameStipples.cpt" if (NULL != pw) { *pw = w; } if (NULL != ph) { *ph = h; } #line 97 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. @param coeff Fixed coefficients. */ static void draw_pattern_30_left( wxGraphicsContext *gc, int w, int h, int lw, double const *coeff ) { double dh; double dw; double d_h; double d_w; #line 123 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); d_h = (double)h; d_w = (double)w; dh = (double)lw; dw = coeff[0] * dh; /* Diagonal line */ p1.MoveToPoint(0.0, 0.0); p1.AddLineToPoint(d_w, d_h); gc->StrokePath(p1); /* Line at top right corner */ p2.MoveToPoint((d_w - dw), (0.0 - dh)); p2.AddLineToPoint((d_w + dw), dh); gc->StrokePath(p2); /* Line at bottom left corner */ p3.MoveToPoint((0.0 - dw), (d_h - dh)); p3.AddLineToPoint(dw, (d_h + dh)); gc->StrokePath(p3); #line 149 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. @param coeff Fixed coefficients. */ static void draw_pattern_30_right( wxGraphicsContext *gc, int w, int h, int lw, double const *coeff ) { double dh; double dw; double d_h; double d_w; #line 175 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); d_h = (double)h; d_w = (double)w; dh = (double)lw; dw = coeff[0] * dh; /* Diagonal line */ p1.MoveToPoint(d_w, 0.0); p1.AddLineToPoint(0.0, d_h); gc->StrokePath(p1); /* Line at top left corner */ p2.MoveToPoint((0.0 - dw), dh); p2.AddLineToPoint(dw, (0.0 - dh)); gc->StrokePath(p2); /* Line at bottom right corner */ p3.MoveToPoint((d_w - dw), (d_h + dh)); p3.AddLineToPoint((d_w + dw), (d_h - dh)); gc->StrokePath(p3); #line 201 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_45_left( wxGraphicsContext *gc, int w, int h, int lw ) { double d_w; double d_h; #line 223 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; /* Diagonal line */ p1.MoveToPoint(0.0, 0.0); p1.AddLineToPoint(d_w, d_h); gc->StrokePath(p1); /* Line at top right corner */ p2.MoveToPoint((double)(w - 2 * lw), (double)(0 - 2 * lw)); p2.AddLineToPoint((double)(w + 2 * lw), (double)(0 + 2 * lw)); gc->StrokePath(p2); /* Line at bottom left corner */ p3.MoveToPoint((double)(0 - 2 * lw), (double)(h - 2 * lw)); p3.AddLineToPoint((double)(0 + 2 * lw), (double)(h + 2 * lw)); gc->StrokePath(p3); #line 247 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_45_right( wxGraphicsContext *gc, int w, int h, int lw ) { double d_w; double d_h; #line 269 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; /* Diagonal line */ p1.MoveToPoint(d_w, 0.0); p1.AddLineToPoint(0.0, d_h); gc->StrokePath(p1); /* Line at top right corner */ p2.MoveToPoint((double)(2 * lw), (double)(0 - 2 * lw)); p2.AddLineToPoint((double)(0 - 2 * lw), (double)(2 * lw)); gc->StrokePath(p2); /* Line at bottom left corner */ p3.MoveToPoint((double)(w + 2 * lw), (double)(h - 2 * lw)); p3.AddLineToPoint((double)(w - 2 * lw), (double)(h + 2 * lw)); gc->StrokePath(p3); #line 293 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_horizontal_bricks( wxGraphicsContext *gc, int w, int h, int lw ) { double x; double y; double d_w; double d_h; double d_lw; #line 318 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; d_lw = (double)lw; y = d_h / 4.0; x = d_w / 4.0; p1.MoveToPoint((0.0 - d_lw), y); p1.AddLineToPoint((d_w + d_lw), y); gc->StrokePath(p1); y = (3.0 * d_h) / 4.0; p2.MoveToPoint((0.0 - d_lw), y); p2.AddLineToPoint((d_w + d_lw), y); gc->StrokePath(p2); p3.MoveToPoint(x, y); y = d_h / 4.0; p3.AddLineToPoint(x, y); gc->StrokePath(p3); x = (3.0 * d_w) / 4.0; p4.MoveToPoint(x, y); p4.AddLineToPoint(x, (0.0 - d_lw)); gc->StrokePath(p4); y = (3.0 * d_h) / 4.0; p5.MoveToPoint(x, y); p5.AddLineToPoint(x, (d_h + d_lw)); gc->StrokePath(p5); #line 348 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_vertical_bricks( wxGraphicsContext *gc, int w, int h, int lw ) { double x; double y; double d_w; double d_h; double d_lw; #line 373 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; d_lw = (double)lw; y = d_h / 4.0; x = d_w / 4.0; p1.MoveToPoint(y, (0.0 - d_lw)); p1.AddLineToPoint(y, (d_w + d_lw)); gc->StrokePath(p1); y = (3.0 * d_h) / 4.0; p2.MoveToPoint(y, (0.0 - d_lw)); p2.AddLineToPoint(y, (d_w + d_lw)); gc->StrokePath(p2); p3.MoveToPoint(y, x); y = d_h / 4.0; p3.AddLineToPoint(y, x); gc->StrokePath(p3); x = (3.0 * d_w) / 4.0; p4.MoveToPoint(y, x); p4.AddLineToPoint((0.0 - d_lw), x); gc->StrokePath(p4); y = (3.0 * d_h) / 4.0; p5.MoveToPoint(y, x); p5.AddLineToPoint((d_h + d_lw), x); gc->StrokePath(p5); #line 403 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_horizontal_lines( wxGraphicsContext *gc, int w, int h, int lw ) { double y; double d_lw; #line 425 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); d_lw = (double)lw; y = (double)h / 2.0; p1.MoveToPoint((0.0 - d_lw), y); p1.AddLineToPoint(((double)w + d_lw), y); gc->StrokePath(p1); #line 432 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_vertical_lines( wxGraphicsContext *gc, int w, int h, int lw ) { double x; double d_lw; #line 454 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); d_lw = (double)lw; x = (double)w / 2.0; p1.MoveToPoint(x, (0.0 - d_lw)); p1.AddLineToPoint(x, ((double)h + d_lw)); gc->StrokePath(p1); #line 461 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_horizontal_shingles_left( wxGraphicsContext *gc, int w, int h, int lw ) { double x1; double x2; double x3; double dx; double y1; double y2; double y3; double y4; double y5; double d_w; double d_h; double d_lw; #line 493 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); wxGraphicsPath p6 = gc->CreatePath(); wxGraphicsPath p7 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; d_lw = (double)lw; y1 = 0.0 - (d_h / 6.0); y2 = d_h / 6.0; y3 = d_h / 2.0; y4 = (5.0 * d_h) / 6.0; y5 = (7.0 * d_h) / 6.0; x1 = d_w / 6.0; x2 = d_w / 2.0; x3 = (5.0 * d_w) / 6.0; dx = d_w / 12.0; p1.MoveToPoint((0.0 - d_lw), y2); p1.AddLineToPoint((d_w + d_lw), y2); gc->StrokePath(p1); p2.MoveToPoint((0.0 - d_lw), y3); p2.AddLineToPoint((d_w + d_lw), y3); gc->StrokePath(p2); p3.MoveToPoint((0.0 - d_lw), y4); p3.AddLineToPoint((d_w + d_lw), y4); gc->StrokePath(p3); p4.MoveToPoint((x3 + dx), y1); p4.AddLineToPoint((x3 - dx), y2); gc->StrokePath(p4); p5.MoveToPoint((x1 + dx), y2); p5.AddLineToPoint((x1 - dx), y3); gc->StrokePath(p5); p6.MoveToPoint((x2 + dx), y3); p6.AddLineToPoint((x2 - dx), y4); gc->StrokePath(p6); p7.MoveToPoint((x3 + dx), y4); p7.AddLineToPoint((x3 - dx), y5); gc->StrokePath(p7); #line 534 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_horizontal_shingles_right( wxGraphicsContext *gc, int w, int h, int lw ) { double x1; double x2; double x3; double dx; double y1; double y2; double y3; double y4; double y5; double d_h; double d_w; double d_lw; #line 566 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); wxGraphicsPath p6 = gc->CreatePath(); wxGraphicsPath p7 = gc->CreatePath(); d_h = (double)h; d_w = (double)w; d_lw = (double)lw; y1 = 0.0 - (d_h / 6.0); y2 = d_h / 6.0; y3 = d_h / 2.0; y4 = (5.0 * d_h) / 6.0; y5 = (7.0 * d_h) / 6.0; x1 = d_w / 6.0; x2 = d_w / 2.0; x3 = (5.0 * d_w) / 6.0; dx = d_w / 12.0; p1.MoveToPoint((0.0 - d_lw), y2); p1.AddLineToPoint((d_w + d_lw), y2); gc->StrokePath(p1); p2.MoveToPoint((0.0 - d_lw), y3); p2.AddLineToPoint((d_w + d_lw), y3); gc->StrokePath(p2); p3.MoveToPoint((0.0 - d_lw), y4); p3.AddLineToPoint((d_w + d_lw), y4); gc->StrokePath(p3); p4.MoveToPoint((x3 - dx), y1); p4.AddLineToPoint(x3 + dx, y2); gc->StrokePath(p4); p5.MoveToPoint((x2 - dx), y2); p5.AddLineToPoint((x2 + dx), y3); gc->StrokePath(p5); p6.MoveToPoint((x1 - dx), y3); p6.AddLineToPoint((x1 + dx), y4); gc->StrokePath(p6); p7.MoveToPoint((x3 - dx), y4); p7.AddLineToPoint((x3 + dx), y5); gc->StrokePath(p7); #line 607 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_vertical_shingles_1( wxGraphicsContext *gc, int w, int h, int lw ) { double x1; double x2; double x3; double dx; double y1; double y2; double y3; double y4; double y5; double d_w; double d_h; double d_lw; #line 639 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); wxGraphicsPath p6 = gc->CreatePath(); wxGraphicsPath p7 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; d_lw = (double)lw; y1 = 0.0 - (d_h / 6.0); y2 = d_h / 6.0; y3 = d_h / 2.0; y4 = (5.0 * d_h) / 6.0; y5 = (7.0 * d_h) / 6.0; x1 = d_w / 6.0; x2 = d_w / 2.0; x3 = (5.0 * d_w) / 6.0; dx = d_w / 12.0; p1.MoveToPoint(y2, (0.0 - d_lw)); p1.AddLineToPoint(y2, (d_w + d_lw)); gc->StrokePath(p1); p2.MoveToPoint(y3, (0.0 - d_lw)); p2.AddLineToPoint(y3, (d_w + d_lw)); gc->StrokePath(p2); p3.MoveToPoint(y4, (0.0 - d_lw)); p3.AddLineToPoint(y4, (d_w + d_lw)); gc->StrokePath(p3); p4.MoveToPoint(y1, (x3 - dx)); p4.AddLineToPoint(y2, (x3 + dx)); gc->StrokePath(p4); p5.MoveToPoint(y2, (x2 - dx)); p5.AddLineToPoint(y3, (x2 + dx)); gc->StrokePath(p5); p6.MoveToPoint(y3, (x1 - dx)); p6.AddLineToPoint(y4, (x1 + dx)); gc->StrokePath(p6); p7.MoveToPoint(y4, (x3 - dx)); p7.AddLineToPoint(y5, (x3 + dx)); gc->StrokePath(p7); #line 680 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_vertical_shingles_2( wxGraphicsContext *gc, int w, int h, int lw ) { double x1; double x2; double x3; double dx; double y1; double y2; double y3; double y4; double y5; double d_w; double d_h; double d_lw; #line 712 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); wxGraphicsPath p6 = gc->CreatePath(); wxGraphicsPath p7 = gc->CreatePath(); d_w = (double)w; d_h = (double)h; d_lw = (double)lw; y1 = 0.0 - (d_h / 6.0); y2 = d_h / 6.0; y3 = d_h / 2.0; y4 = (5.0 * d_h) / 6.0; y5 = (7.0 * d_h) / 6.0; x1 = d_w / 6.0; x2 = d_w / 2.0; x3 = (5.0 * d_w) / 6.0; dx = d_w / 12.0; p1.MoveToPoint(y2, (0.0 - d_lw)); p1.AddLineToPoint(y2, (d_w + d_lw)); gc->StrokePath(p1); p2.MoveToPoint(y3, (0.0 - d_lw)); p2.AddLineToPoint(y3, (d_w + d_lw)); gc->StrokePath(p2); p3.MoveToPoint(y4, (0.0 - d_lw)); p3.AddLineToPoint(y4, (d_w + d_lw)); gc->StrokePath(p3); p4.MoveToPoint(y1, (x3 + dx)); p4.AddLineToPoint(y2, (x3 - dx)); gc->StrokePath(p4); p5.MoveToPoint(y2, (x1 + dx)); p5.AddLineToPoint(y3, (x1 - dx)); gc->StrokePath(p5); p6.MoveToPoint(y3, (x2 + dx)); p6.AddLineToPoint(y4, (x2 - dx)); gc->StrokePath(p6); p7.MoveToPoint(y4, (x3 + dx)); p7.AddLineToPoint(y5, (x3 - dx)); gc->StrokePath(p7); #line 753 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param patco Coefficients for pattern drawing. @param patci Index of start coefficient in array. */ static void draw_pattern_fish_scales( wxGraphicsContext *gc, int w, int h, double const *patco, size_t patci ) { double x0; double y0; double x1; double y1; double d_w; double d_h; wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); #line 785 "WxdkdrawFrameStipples.cpt" d_w = (double)w; d_h = (double)h; #line 788 "WxdkdrawFrameStipples.cpt" #line 789 "WxdkdrawFrameStipples.cpt" x0 = 0.0; y0 = 0.0; x1 = d_w; y1 = 0.0; p1.MoveToPoint(x0, y0); p1.AddCurveToPoint( (x0 + patco[patci]), (y0 + patco[patci + 1]), (x1 - patco[patci + 2]), (y1 - patco[patci + 3]), x1, y1 ); gc->StrokePath(p1); x0 = (-1.0 * d_w) / 2.0; y0 = d_h / 2.0; x1 = x0 + d_w; y1 = y0; p2.MoveToPoint(x0, y0); p2.AddCurveToPoint( (x0 + patco[patci]), (y0 + patco[patci + 1]), (x1 - patco[patci + 2]), (y1 - patco[patci + 3]), x1, y1 ); x0 += d_w; x1 += d_w; p2.AddCurveToPoint( (x0 + patco[patci]), (y0 + patco[patci + 1]), (x1 - patco[patci + 2]), (y1 - patco[patci + 3]), x1, y1 ); gc->StrokePath(p2); x0 = 0.0; y0 = d_h; x1 = d_w; y1 = d_h; p3.MoveToPoint(x0, y0); p3.AddCurveToPoint( (x0 + patco[patci]), (y0 + patco[patci + 1]), (x1 - patco[patci + 2]), (y1 - patco[patci + 3]), x1, y1 ); gc->StrokePath(p3); x0 = (-1.0 * d_w) / 2.0; y0 = (-1.0 * d_h) / 2.0; x1 = x0 + d_w; y1 = y0; p4.MoveToPoint(x0, y0); p4.AddCurveToPoint( (x0 + patco[patci]), (y0 + patco[patci + 1]), (x1 - patco[patci + 2]), (y1 - patco[patci + 3]), x1, y1 ); x0 += d_w; x1 += d_w; p4.AddCurveToPoint( (x0 + patco[patci]), (y0 + patco[patci + 1]), (x1 - patco[patci + 2]), (y1 - patco[patci + 3]), x1, y1 ); gc->StrokePath(p4); #line 849 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. */ static void draw_pattern_circles( wxGraphicsContext *gc, int w, int h ) { double r; #line 868 "WxdkdrawFrameStipples.cpt" wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); r = (double)w / 2.0; p1.AddCircle(r, r, r); gc->StrokePath(p1); p2.AddCircle((0.0 - r), r, r); gc->StrokePath(p2); p3.AddCircle(r, (0.0 - r), r); gc->StrokePath(p3); p4.AddCircle((w + r), r, r); gc->StrokePath(p4); p5.AddCircle(r, (h + r), r); gc->StrokePath(p5); #line 885 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param coeff Fixed coefficients. */ static void draw_pattern_hexagons( wxGraphicsContext *gc, int w, int h, double const *coeff ) { double x1; double x2; double x3; double b; double d_h; wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); #line 912 "WxdkdrawFrameStipples.cpt" d_h = (double)h; b = d_h / 2.0; x1 = b / coeff[0]; x2 = b * coeff[0]; x3 = (coeff[0] + 1.0 / coeff[0]) * b; p1.MoveToPoint(x1, 0.0); p1.AddLineToPoint(x2, 0.0); p1.AddLineToPoint(x3, (d_h / 2.0)); p1.AddLineToPoint(x2, d_h); p1.AddLineToPoint(x1, d_h); p1.AddLineToPoint(0.0, (d_h / 2.0)); p1.AddLineToPoint(x1, 0.0); p1.CloseSubpath(); gc->StrokePath(p1); p2.MoveToPoint(x3, (d_h / 2.0)); p2.AddLineToPoint(w, (d_h / 2.0)); gc->StrokePath(p2); #line 930 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param lw Line width to draw pattern. */ static void draw_pattern_octagons( wxGraphicsContext *gc, int w, int h, int lw ) { double x1; double xc; double yc; double d_w; double d_h; double d_lw; wxGraphicsPath p1 = gc->CreatePath(); wxGraphicsPath p2 = gc->CreatePath(); wxGraphicsPath p3 = gc->CreatePath(); wxGraphicsPath p4 = gc->CreatePath(); wxGraphicsPath p5 = gc->CreatePath(); #line 961 "WxdkdrawFrameStipples.cpt" d_w = (double)w; d_h = (double)h; d_lw = (double)lw; /* x1 = d_w * (1.0 - 1.0 / (1.0 + M_SQRT2)); */ x1 = (w * M_SQRT2) / (2.0 * (1.0 + M_SQRT2)); xc = d_w / 2.0; yc = d_h / 2.0; p1.MoveToPoint((xc - x1), yc); p1.AddLineToPoint(xc, (yc - x1)); p1.AddLineToPoint((xc + x1), yc); p1.AddLineToPoint(xc, (yc + x1)); p1.AddLineToPoint((xc - x1), yc); p1.CloseSubpath(); gc->StrokePath(p1); p2.MoveToPoint((xc - x1), yc); p2.AddLineToPoint((0.0 - d_lw), yc); gc->StrokePath(p2); p3.MoveToPoint(xc, (yc - x1)); p3.AddLineToPoint(xc, (0.0 - d_lw)); gc->StrokePath(p3); p4.MoveToPoint((xc + x1), yc); p4.AddLineToPoint((d_w + d_lw), yc); gc->StrokePath(p4); p5.MoveToPoint(xc, (yc + x1)); p5.AddLineToPoint(xc, (d_h + d_lw)); gc->StrokePath(p5); #line 988 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. */ static void draw_pattern_horizontal_tires( wxGraphicsContext *gc, int w, int h ) { double y; double d_w; double d_h; size_t i; #line 1010 "WxdkdrawFrameStipples.cpt" d_w = (double)w; d_h = (double)h; y = 0.0; for (i = 0; i < 3; i++) { wxGraphicsPath p1 = gc->CreatePath(); p1.MoveToPoint((0.0 - d_w), y); p1.AddLineToPoint((0.0 - d_w / 2.0), (y - d_h)); p1.AddLineToPoint(0.0, y); p1.AddLineToPoint(((d_w) / 2.0), (y - d_h)); p1.AddLineToPoint(d_w, y); p1.AddLineToPoint((1.5 * d_w), (y - d_h)); p1.AddLineToPoint((2.0 * d_w), y); gc->StrokePath(p1); y += h; } #line 1026 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. */ static void draw_pattern_vertical_tires( wxGraphicsContext *gc, int w, int h ) { double x; double d_w; double d_h; size_t i; #line 1048 "WxdkdrawFrameStipples.cpt" d_w = (double)w; d_h = (double)h; x = 0.0; for (i = 0; i < 3; i++) { wxGraphicsPath p = gc->CreatePath(); p.MoveToPoint(x, (0.0 - d_h)); p.AddLineToPoint((x - d_w), (0.0 - d_h / 2.0)); p.AddLineToPoint(x, 0.0); p.AddLineToPoint((x - d_w), (d_h / 2.0)); p.AddLineToPoint(x, h); p.AddLineToPoint((x - d_w), (1.5 * d_h)); p.AddLineToPoint(x, (2.0 * d_h)); gc->StrokePath(p); x += w; } #line 1064 "WxdkdrawFrameStipples.cpt" } /** Draw the fill pattern into the stipple bitmap. @param gc Graphics context. @param w Image width. @param h Image height. @param pt Pattern type. @param lw Line width to draw pattern. @param patco Pattern coefficients. @param coeff Fixed coefficients. */ static void draw_fill_pattern( wxGraphicsContext *gc, int w, int h, int pt, int lw, double const *patco, double const *coeff ) { #line 1090 "WxdkdrawFrameStipples.cpt" switch (pt) { case WXD_FS_30_DEGREE_LEFT : { draw_pattern_30_left(gc, w, h, lw, coeff); } break; case WXD_FS_30_DEGREE_RIGHT : { draw_pattern_30_right(gc, w, h, lw, coeff); } break; case WXD_FS_30_DEGREE_SIEVE : { draw_pattern_30_left(gc, w, h, lw, coeff); draw_pattern_30_right(gc, w, h, lw, coeff); } break; case WXD_FS_45_DEGREE_LEFT : { draw_pattern_45_left(gc, w, h, lw); } break; case WXD_FS_45_DEGREE_RIGHT : { draw_pattern_45_right(gc, w, h, lw); } break; case WXD_FS_45_DEGREE_SIEVE : { draw_pattern_45_left(gc, w, h, lw); draw_pattern_45_right(gc, w, h, lw); } break; case WXD_FS_HORIZONTAL_BRICKS : { draw_pattern_horizontal_bricks(gc, w, h, lw); } break; case WXD_FS_VERTICAL_BRICKS : { draw_pattern_vertical_bricks(gc, w, h, lw); } break; case WXD_FS_HORIZONTAL_LINES : { draw_pattern_horizontal_lines(gc, w, h, lw); } break; case WXD_FS_VERTICAL_LINES : { draw_pattern_vertical_lines(gc, w, h, lw); } break; case WXD_FS_HORIZONTAL_VERTICAL_SIEVE : { draw_pattern_horizontal_lines(gc, w, h, lw); draw_pattern_vertical_lines(gc, w, h, lw); } break; case WXD_FS_HORIZONTAL_SHINGLES_LEFT : { draw_pattern_horizontal_shingles_left(gc, w, h, lw); } break; case WXD_FS_HORIZONTAL_SHINGLES_RIGHT : { draw_pattern_horizontal_shingles_right(gc, w, h, lw); } break; case WXD_FS_VERTICAL_SHINGLES_1 : { draw_pattern_vertical_shingles_1(gc, w, h, lw); } break; case WXD_FS_VERTICAL_SHINGLES_2 : { draw_pattern_vertical_shingles_2(gc, w, h, lw); } break; case WXD_FS_LARGE_FISH_SCALES : { draw_pattern_fish_scales(gc, w, h, patco, 9); } break; case WXD_FS_SMALL_FISH_SCALES : { draw_pattern_fish_scales(gc, w, h, patco, 13); } break; case WXD_FS_CIRCLES : { draw_pattern_circles(gc, w, h); } break; case WXD_FS_HEXAGONS : { draw_pattern_hexagons(gc, w, h, coeff); } break; case WXD_FS_OCTAGONS : { draw_pattern_octagons(gc, w, h, lw); } break; case WXD_FS_HORIZONTAL_TIRES : { draw_pattern_horizontal_tires(gc, w, h); } break; case WXD_FS_VERTICAL_TIRES : { draw_pattern_vertical_tires(gc, w, h); } break; } #line 1162 "WxdkdrawFrameStipples.cpt" } void WxdkdrawFrame::UpdateOneStipple(Wxd_stipple_t *psti) { int w = 0; /* Bitmap width */ int h = 0; /* Bitmap height */ int lw = 0; /* Line width to draw fill pattern */ #line 1174 "WxdkdrawFrameStipples.cpt" if (NULL != psti->bm) { #line 1175 "WxdkdrawFrameStipples.cpt" delete(psti->bm); psti->bm = NULL; } #if TRACE_DEBUG else { #line 1180 "WxdkdrawFrameStipples.cpt" } #endif calculate_bitmap_dimensions(&w, &h, (int)(psti->cd[0]), m_dPatterns); lw = (int)dk4ma_rint( (0.45 * drawco->m_dZoom * (drawco->m_ptRes).x) / 72.0 ); if (0 >= lw) { lw = 1; } #line 1188 "WxdkdrawFrameStipples.cpt" #line 1189 "WxdkdrawFrameStipples.cpt" #line 1190 "WxdkdrawFrameStipples.cpt" if ((1 < w) && (1 < h)) { #line 1191 "WxdkdrawFrameStipples.cpt" wxImage imag(w, h); wxColour fc( (int)(psti->cd[1]), (int)(psti->cd[2]), (int)(psti->cd[3]) ); wxColour sc( (int)(psti->cd[4]), (int)(psti->cd[5]), (int)(psti->cd[6]) ); wxBrush bru(fc); wxPen pen(sc, lw); wxGraphicsContext *gc = wxGraphicsContext::Create(imag); if (NULL != gc) { #line 1202 "WxdkdrawFrameStipples.cpt" gc->SetPen(wxNullPen); gc->SetBrush(bru); { wxGraphicsPath p = gc->CreatePath(); p.AddRectangle(0.0, 0.0, (double)w, (double)h); gc->FillPath(p); } gc->SetBrush(wxNullBrush); pen.SetCap(wxCAP_ROUND); pen.SetJoin(wxJOIN_ROUND); gc->SetPen(pen); draw_fill_pattern(gc,w,h,psti->cd[0],lw,m_dPatterns,m_dFactors); gc->SetPen(wxNullPen); gc->Flush(); delete gc; psti->bm = new wxBitmap(imag); } #if TRACE_DEBUG else { #line 1221 "WxdkdrawFrameStipples.cpt" } #endif } #if TRACE_DEBUG else { #line 1226 "WxdkdrawFrameStipples.cpt" } #endif #line 1229 "WxdkdrawFrameStipples.cpt" } void WxdkdrawFrame::UpdatePatternCoefficients(void) { size_t i; m_dPatterns[0] = (drawco->m_dZoom * drawco->m_ptRes.x) / (10.0 * m_dFactors[0]); m_dPatterns[1] = (drawco->m_dZoom * drawco->m_ptRes.x) / 10.0; m_dPatterns[2] = (drawco->m_dZoom * drawco->m_ptRes.x * M_SQRT2) / 20.0; m_dPatterns[3] = (drawco->m_dZoom * drawco->m_ptRes.x) / 5.0; m_dPatterns[4] = (drawco->m_dZoom * drawco->m_ptRes.x) / 20.0; m_dPatterns[5] = (drawco->m_dZoom * drawco->m_ptRes.x * 0.3); m_dPatterns[6] = (drawco->m_dZoom * drawco->m_ptRes.x * 14.54) / 72.0; m_dPatterns[7] = (drawco->m_dZoom * drawco->m_ptRes.x * 3.7) / 36.0; m_dPatterns[8] = (drawco->m_dZoom * drawco->m_ptRes.x * m_dFactors[0]) / 5.0; /* 9 to 16 */ for (i = 0; i < 8; i++) { m_dPatterns[9 + i] = drawco->m_dZoom * m_dFactors[1 + i]; } } void WxdkdrawFrame::UpdateStipples(void) { Wxd_stipple_t *psti; #line 1271 "WxdkdrawFrameStipples.cpt" UpdatePatternCoefficients(); if (NULL != m_pDrw) { dk4sto_it_reset(m_pDrw->i_stip); do { psti = (Wxd_stipple_t *)dk4sto_it_next(m_pDrw->i_stip); if (NULL != psti) { UpdateOneStipple(psti); } } while (NULL != psti); } #line 1282 "WxdkdrawFrameStipples.cpt" } /* vim: set ai sw=4 ts=4 : */