프로젝트

일반

사용자정보

개정판 a9a82876

IDa9a82876cd54d6a80b6a761203fcb81c5798b3c2
상위 8acc4862
하위 762737cd

김태성이(가) 약 2달 전에 추가함

issue #00000 export시 페이지 이미지 흐려지는 현상 수정

Change-Id: Ic8e9111a195008f0de03040d9dda92b486c0b778

차이점 보기:

KCOM/Controls/AdornerFinal.xaml.cs
728 728
                {
729 729
                    IViewBox instance = currentControl as IViewBox;
730 730
                    List<Point> am = (currentControl as IPath).PointSet;
731
                    List<double> xSet = am.Select(p => p.X).ToList();
732
                    List<double> ySet = am.Select(p => p.Y).ToList();
733
                    if (xSet.Min() < minX) minX = xSet.Min();
734
                    if (ySet.Min() < minY) minY = ySet.Min();
735
                    if (xSet.Max() > maxX) maxX = xSet.Max();
736
                    if (ySet.Max() > maxY) maxY = ySet.Max();
731
                    
732
                    if (am.Count() > 0)
733
                    {
734
                        List<double> xSet = am.Select(p => p.X).ToList();
735
                        List<double> ySet = am.Select(p => p.Y).ToList();
736
                        if (xSet.Min() < minX) minX = xSet.Min();
737
                        if (ySet.Min() < minY) minY = ySet.Min();
738
                        if (xSet.Max() > maxX) maxX = xSet.Max();
739
                        if (ySet.Max() > maxY) maxY = ySet.Max();
740
                    }
737 741
                }
738 742
                else if ((currentControl as IPath).PathData == null)
739 743
                {
KCOM/Controls/PrintControl.xaml.cs
465 465
            //{
466 466
            try
467 467
            {
468
                Load load = new Load();
469

  
470 468
                _definePages.Back_Image = new ImageBrush();
471 469
                //var defaultBitmapImage = new BitmapImage(new Uri(_DefaultTileUri + PageNo + ".png"));
472 470

  
......
505 503
                    printCanvas.Children.Clear();
506 504
                    printCanvas.Width = Convert.ToDouble(currentPage.PAGE_WIDTH);
507 505
                    printCanvas.Height = Convert.ToDouble(currentPage.PAGE_HEIGHT);
508
                    
509 506
                    printCanvas.Background = new ImageBrush{ ImageSource = new BitmapImage(uri)};
510

  
507
                    printCanvas.SnapsToDevicePixels = false;
508
                    printCanvas.UseLayoutRounding = false;
509
                    printCanvas.CacheMode = new BitmapCache(50);
510
                    RenderOptions.SetBitmapScalingMode(printCanvas, BitmapScalingMode.HighQuality);
511 511
                    //printCanvas.RenderTransformOrigin = new Point(0.5, 0.5);
512 512
                    //printCanvas.RenderTransform = new RotateTransform(currentPage.PAGE_ANGLE);
513 513
                    //ImageBrush background = new ImageBrush(bitmap);
......
515 515
                    //printCanvas.Background = new SolidColorBrush(Colors.Transparent);
516 516

  
517 517
                    Canvas canvas = new Canvas();
518

  
518
                    canvas.CacheMode = new BitmapCache(50);
519
                    canvas.SnapsToDevicePixels = false;
520
                    RenderOptions.SetBitmapScalingMode(canvas, BitmapScalingMode.HighQuality);
519 521
                    //foreach (var info in gridViewMarkup.SelectedItems.Cast<IKCOM.MarkupInfoItem>())
520 522
                    //{
521 523
                    //    load.User_Id = info.UserID;
......
538 540
                    var tasks = gridViewMarkup.SelectedItems.Cast<IKCOM.MarkupInfoItem>()
539 541
                                        .Select(async info =>
540 542
                                        {
543
                                            Load load = new Load();
541 544
                                            load.User_Id = info.UserID;
542 545
                                            load.document_id = _DocInfo.DOCUMENT_ID;
543 546
                                            load.Page_No = PageNo;
......
575 578
                                {
576 579
                                    var filepath = Path.Combine(TempImageDir, $"{PrintimgPath_List.Count() + 1}.png");
577 580

  
578
                                    if (export.ExportingFile(PrintView, printCanvas.Width, printCanvas.Height, filepath))
581
                                    if (export.ExportingFile(printCanvas, printCanvas.Width, printCanvas.Height, filepath))
579 582
                                    {
580 583
                                        PrintimgPath_List.Add(PrintimgPath_List.Count() + 1, filepath);
581 584
                                    }
KCOM/Events/Export.cs
158 158
            return myImage;
159 159
        }
160 160

  
161
        public bool ExportingFile(Visual visual, double pageWidth, double pageHeight, string fileName)
161
        public bool ExportingFile(Canvas visual, double pageWidth, double pageHeight, string fileName)
162 162
        {
163 163
            bool result = false;
164 164

  
165 165
            try
166 166
            {
167
                RenderOptions.SetBitmapScalingMode(visual, BitmapScalingMode.HighQuality);
167 168
                JpegBitmapEncoder png = new JpegBitmapEncoder();
168
                RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)pageWidth, (int)pageHeight, 96d, 96d, PixelFormats.Default);
169
                png.QualityLevel = 100;
169 170

  
170
                DrawingVisual drawingVisual = new DrawingVisual();
171
                DrawingContext drawingContext = drawingVisual.RenderOpen();
172
                VisualBrush visualBrush = new VisualBrush(visual);
173
                drawingContext.DrawRectangle(visualBrush, null, new System.Windows.Rect(new System.Windows.Point(0, 0), new System.Windows.Point(pageWidth, pageHeight)));
174
                drawingContext.Close();
171
                double dpi = 96d;
172

  
173
                RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)pageWidth, (int)pageHeight, dpi, dpi, PixelFormats.Pbgra32);
174

  
175
                //DrawingVisual drawingVisual = new DrawingVisual();
176
                //DrawingContext drawingContext = drawingVisual.RenderOpen();
177
                ////VisualBrush visualBrush = new VisualBrush(visual);
178
                //drawingContext.DrawRectangle(visual, null, new System.Windows.Rect(new System.Windows.Point(0, 0), new System.Windows.Point(pageWidth, pageHeight)));
179
                //drawingContext.Close();
175 180

  
176
                renderBitmap.Render(drawingVisual);
181
                renderBitmap.Render(visual);
177 182
                png.Frames.Add(BitmapFrame.Create(renderBitmap));
178 183

  
179 184
                using (FileStream fileStream = File.Create(fileName))
KCOM/Events/Load.cs
16 16
    public class Load
17 17
    {
18 18

  
19

  
19 20
        public string document_id
20 21
        {
21 22
            get;
MarkupToPDF/Controls/Parsing/MarkupParse.cs
208 208
        /// 데이터베이스의 마크업데이터를 컨트롤로 변환한다.
209 209
        /// </summary>
210 210
        /// <param name="MarkupString"></param>
211
        public static async Task<bool> ParseAsync(string baseUri, string sProjectNo, string MarkupString, Canvas Layer,double PageAngle, 
211
        public static async Task<bool> ParseAsync(string baseUri, string sProjectNo, string MarkupString, System.Windows.Controls.Canvas Layer,double PageAngle, 
212 212
            string DisplayColor, string ToolTipMessage, System.Threading.CancellationToken? cts, Dictionary<string, string> STAMP_Contents = null)
213 213
        {
214 214
            bool result = false;

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)