【发布时间】:2012-02-19 08:15:01
【问题描述】:
如标题所述。我正在尝试绘制伽马色调曲线,但我不知道该怎么做。我可以做线性色调曲线就好了,但是在绘制伽玛色调曲线时,我完全失去了它。引用自http://www.mediachance.com/pseam/help/curves.html(第一张或第二张图)
代码如下
#include <math.h>
static COLORREF red=RGB(255,0,0);
static COLORREF blue=RGB(0,0,255);
static COLORREF green=RGB(0,255,0);
绘制伽马色调曲线时我应该加入的部分
for(int y=0; y<bih.biHeight; y++)
{
for(int x=0; x<bih.biWidth; x++)
{
SetPixel(hdc, x, bih.biHeight-x, red);
}
// The X axis of the graph
HPEN hLinePen1;
COLORREF qLineColor1;
qLineColor1 = RGB(255, 0, 0);
hLinePen1 = CreatePen(PS_SOLID, 2, qLineColor1);
hPenOld1 = (HPEN)SelectObject(hdc, hLinePen1);
line(hdc,0, bih.biHeight, bih.biWidth, bih.biHeight);
SelectObject(hdc, hPenOld1);
DeleteObject(hLinePen1);
// The Y axis of the graph
HPEN hLinePen2;
COLORREF qLineColor2;
qLineColor2 = RGB(255, 0, 0);
hLinePen2 = CreatePen(PS_SOLID, 2, qLineColor2);
hPenOld2 = (HPEN)SelectObject(hdc, hLinePen2);
line(hdc,0, bih.biHeight, 0, bih.biWidth-bih.biHeight);
SelectObject(hdc, hPenOld2);
DeleteObject(hLinePen2);
【问题讨论】:
-
你有“我可以做线性色调曲线就好了,但是当涉及到绘制伽马色调曲线”的代码或链接?
标签: c++ graph drawing pixel image