-1
\$\begingroup\$

I have an image and wants to draw multiple diagonal lines in the image. if we look into main program it takes input bmp file and generates one pattern. what I need to insert diagonal lines in that pattern.

#include "StdAfx.h"
#include "AlgorithmPATTERN.h"
#include "FunctionDNIe4LCD.h"

void CAlgorithmPATTERN::LoadParams()
{
	R_PATT_SEL	= GetProfileInt(_T("R_PATT_SEL"),	0);		
}

void CAlgorithmPATTERN::SaveParams()
{
	WriteProfileInt(_T("R_PATT_SEL"),	R_PATT_SEL);
}

BOOL CAlgorithmPATTERN::SetProperties()
{
	CString str_PATTERN[2] = {	_T("0==Bypass"),
	};

	AddPropertyItem(_T("R_PATT_SEL"),	PI_COMBO,	&R_PATT_SEL, 2, str_PATTERN);

	return TRUE;
}

BOOL CAlgorithmPATTERN::BeginRunning()
{
	return TRUE;
}
	
void CAlgorithmPATTERN::PATTERN_TOP(CFrameInt& frame_in, CFunctionDNIe4LCD &func)
{
//---------------------------------------------------------------------------------------
// declare : input / image height / image width / frame number / several variables
//---------------------------------------------------------------------------------------
	int **FrameY=frame_in.GetYY(),**FrameU=frame_in.GetUU(),**FrameV=frame_in.GetVV();
	int IH = frame_in.GetHeight();			// height of image
	int IW = frame_in.GetWidth();			// width of image
	int F_NUM = frame_in.GetFrameNumber();	// frame number
	int	I_R, I_G, I_B;						// input
	int	O_R, O_G, O_B;						// output
	int	i,j;
	double	rs;									// ramp step

	double circle_val;

	int R_10BIT = (func.m_AlgorithmCM5.IN_BIT) ? 1 : 0;

	int BIT_ACCUR;

	if(R_10BIT)	BIT_ACCUR = 10;
	else		BIT_ACCUR = 8;

	int ACCUR = 1<<BIT_ACCUR;
	int ACCUR_ = (1<<BIT_ACCUR)-1;

//---------------------------------------------------------------------------------------
// Main Processing
//---------------------------------------------------------------------------------------
	for(i=0; i<IH; i++)
	{
		for(j=0; j<IW; j++)
		{
			// input r,g,b data
			I_R = FrameY[i][j];
			I_G = FrameU[i][j];
			I_B = FrameV[i][j];

			if(R_PATT_SEL==0)			// R_PATT_SEL : 0 --> bypass
			{
				O_R = I_R;
				O_G = I_G;
				O_B = I_B;
			}
			FrameY[i][j] = min(ACCUR_,max(0,O_R));
			FrameU[i][j] = min(ACCUR_,max(0,O_G));
			FrameV[i][j] = min(ACCUR_,max(0,O_B));
		}
	}
}

I have another Bmp.h file in my project which contains several API's and functions and it contains: void DrawLine(int x0,int y0,int x1,int y1,unsigned char r,unsigned char g, unsigned char b); I don't know how to use this function in my main program to generate diagonal lines pattern. can anyone please have a look into it ?
Thank you

\$\endgroup\$
  • \$\begingroup\$ Looks like there is a lot of information missing here. What is that bmp header? What is the drawline function? What API are you using? Please use the edit feature to edit the question. \$\endgroup\$ – Vaillancourt Dec 2 at 14:04
  • \$\begingroup\$ I edit my main application code. would it be sufficient information ? Thanks \$\endgroup\$ – user134194 Dec 3 at 0:40
  • \$\begingroup\$ Is this a homework? Have you written all of this? How would we know how to use an API we know nothing about? \$\endgroup\$ – Vaillancourt Dec 3 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.