Monday, June 19, 2006

swarm

in AddRing:

int swcnt; // number of vertices in swarm polygon
int swidx; // index of swarm polygon's current vertex
int swrad; // radius of swarm polygon, in pixels

double theta = (PI * 2) * (double(swidx) / swcnt); // can be better optimized
Ring.Shift.x += sin(theta) * swrad;
Ring.Shift.y += cos(theta) * swrad;
swidx++;
swidx %= swcnt; // can be better optimized

NOTE that this feature requires the skew curve fix (see above), otherwise curves will be horribly distorted.

skew curve fix

Skew distorts curved rings; to avoid this, MakeCurves must use the skewed origin.

wrong:
iorg = CPoint(round(org.x), round(org.y));

correct:
iorg = CPoint(round(xshift), round(yshift));

Monday, June 05, 2006

maximize list control within playlist dialog


void CPlaylistDlg::OnHideControls()
{
m_HideControls ^= 1;
CWnd *wp = GetWindow(GW_CHILD);
while (wp != NULL) {
if (wp != &m_List)
wp->ShowWindow(m_HideControls ? SW_HIDE : SW_SHOW);
wp = wp->GetNextWindow();
}
PostMessage(WM_SIZE);
}

void CPlaylistDlg::OnSize(UINT nType, int cx, int cy)
{
CToolDlg::OnSize(nType, cx, cy);
if (m_HideControls) {
CRect r;
GetClientRect(r);
m_List.MoveWindow(r);
} else
m_Resize.OnSize();
}

void CPlaylistDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CToolDlg::OnShowWindow(bShow, nStatus);
if (bShow && !m_HideControls)
m_Resize.OnSize();
}

Friday, June 02, 2006

MIDI support for video functions

Assuming MIDI ranges equal 5 (the default):

Video Select

num MIDI Video
pad Values Clip
0 0..12 0
1 13..25 1
2 26..38 2
3 39..51 3
4 52..63 4
5 64..76 5
6 77..89 6
7 90..101 7
8 102..114 8
9 115..126 9
. 127 None

Note that a value of 127 disables video. If this is undesirable, set Video Select's MIDI range to 4.99 instead of 5.

Video Blending

num MIDI
pad Values Blending description ROP code GDI name
0 0..12 ~Src & Dst AND inverted source with destination DSna
1 13..25 ~Src | Dst OR inverted source with destination DSno MERGEPAINT
2 26..38 Src & ~Dst AND source with inverted destination SDna SRCERASE
3 39..51 Src & ~Dst OR source with inverted destination SDno
4 52..63 Src & Dst AND source with destination DSa SRCAND
5 64..76 Src | Dst OR source with destination DSo SRCPAINT
6 77..89 Src ^ Dst XOR source with destination DSx SRCINVERT
7 90..101 ~(Src & Dst) AND source with destination, invert result DSan
8 102..114 ~(Src | Dst) OR source with destination, invert result DSon NOTSRCERASE
9 115..127 ~(Src ^ Dst) XOR source with destination, invert result DSxn

Video Cycle Length

num MIDI Cycle
pad Values Length
1 0..12 1
2 13..25 2
3 26..38 3
4 39..51 4
5 52..63 5
6 64..76 6
7 77..89 7
8 90..101 8
9 102..114 9
0 115..127 10

Note that numpad zero sets the cycle length to "all" which is effectively 10.