Sorting Network Verify and Draw
Check Whether Comparator Networks Sort and Draw Them
RenderableComparatorNet.h
Go to the documentation of this file.
1
3
4// MIT License
5//
6// Copyright (c) 2022 Ian Parberry
7//
8// Permission is hereby granted, free of charge, to any person obtaining a copy
9// of this software and associated documentation files (the "Software"), to deal
10// in the Software without restriction, including without limitation the rights
11// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12// copies of the Software, and to permit persons to whom the Software is
13// furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included in all
16// copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24// SOFTWARE.
25
26#ifndef __RenderableComparatorNet_h__
27#define __RenderableComparatorNet_h__
28
29#include "Defines.h"
30#include "ComparatorNetwork.h"
31
36
38 protected:
39 const Gdiplus::REAL m_fPenWidth = 2.0f;
40 const Gdiplus::REAL m_fXDelta = 24.0f;
41 const Gdiplus::REAL m_fYDelta = 16.0f;
42 const Gdiplus::REAL m_fYDelta2 = 8.0f;
43 const Gdiplus::REAL m_fDiameter = 8.0f;
44
45 Gdiplus::Bitmap* m_pBitmap = nullptr;
46
47 eDrawStyle m_eDrawStyle = eDrawStyle::Horizontal;
48
49 Gdiplus::Graphics* m_pGraphics = nullptr;
50 Gdiplus::Pen* m_pPen = nullptr;
51 Gdiplus::Pen* m_pRedPen = nullptr;
52 Gdiplus::SolidBrush* m_pBrush = nullptr;
53 Gdiplus::SolidBrush* m_pRedBrush = nullptr;
54
55 FILE* m_pOutput = nullptr;
56 eExport m_eExportType = eExport::Png;
57
58 Gdiplus::REAL ComputeBitmapHeight();
59
60 void DrawChannels(const float fLen);
61 void DrawComparator(const UINT, const UINT, const float, bool=false);
62 void DrawComparators();
63
64 public:
66
67 void Draw(const eDrawStyle);
68
69 HRESULT ExportToPNG(LPWSTR);
70 HRESULT ExportToTex(LPWSTR);
71 HRESULT ExportToSVG(LPWSTR);
72
73 Gdiplus::Bitmap* GetBitmap();
74}; //CRenderableComparatorNet
75
76#endif //__RenderableComparatorNet_h__
Interface for the comparator network CComparatorNetwork.
Useful definitions.
eDrawStyle
Drawing style.
Definition: Defines.h:34
eExport
Export type.
Definition: Defines.h:42
Comparator network.
Renderable comparator network.
const Gdiplus::REAL m_fYDelta2
Extra vertical gap between layers in pixels.
HRESULT ExportToSVG(LPWSTR)
Export in SVG format.
void DrawComparator(const UINT, const UINT, const float, bool=false)
Draw a comparator.
Gdiplus::Pen * m_pRedPen
Pointer to graphics pen.
HRESULT ExportToTex(LPWSTR)
Export in TeX format.
Gdiplus::Bitmap * GetBitmap()
Get bitmap pointer.
Gdiplus::SolidBrush * m_pBrush
Pointer to graphics brush.
const Gdiplus::REAL m_fPenWidth
Pen width in pixels.
HRESULT ExportToPNG(LPWSTR)
Export in PNG format.
Gdiplus::Bitmap * m_pBitmap
Pointer to a bitmap image.
const Gdiplus::REAL m_fDiameter
Diameter of circles in pixels.
Gdiplus::REAL ComputeBitmapHeight()
Compute bitmap height.
Gdiplus::SolidBrush * m_pRedBrush
Pointer to graphics brush.
Gdiplus::Pen * m_pPen
Pointer to graphics pen.
Gdiplus::Graphics * m_pGraphics
Pointer to graphics object.
void DrawChannels(const float fLen)
Draw channels.
const Gdiplus::REAL m_fXDelta
Gap between channels in pixels.
const Gdiplus::REAL m_fYDelta
Vertical comparator gap in pixels.
eDrawStyle m_eDrawStyle
Drawing style.
void Draw(const eDrawStyle)
Draw to a Gdiplus::Bitmap.
eExport m_eExportType
Export type.
void DrawComparators()
Draw all comparators.