Exemple #1
0
void CFX_RGBLed::Commit()
{
  if (Changed())
  {
    CFX_Color newcolor;
    
    uint8_t brightness = GetBrightness();
    if (brightness == 255)
    {
      newcolor = m_color;
    }
    else
    {
      float factor = (float)brightness/255;
      newcolor = m_color * factor;
    }
    
    if (m_commonAnode)
    {
      analogWrite(m_redpin, 255 - newcolor.Red());
      analogWrite(m_greenpin, 255 - newcolor.Green());
      analogWrite(m_bluepin, 255 - newcolor.Blue());
    }
    else
    {
      analogWrite(m_redpin, newcolor.Red());
      analogWrite(m_greenpin, newcolor.Green());
      analogWrite(m_bluepin, newcolor.Blue());
    }
    SetChanged(false);
  }
}
Exemple #2
0
/**
 * Called from the moving actor's main loop.
 */
static void CheckBrightness(PMOVER pMover) {
	int brightness;

	if (pMover->hCpath == NOPOLY || pMover->bHidden)
		return;

	brightness = GetBrightness(pMover->hCpath, pMover->objY);

	if (brightness != pMover->brightness) {
		// Do it all immediately on first appearance,
		// otherwise do it iteratively

		if (pMover->brightness == BOGUS_BRIGHTNESS)
			pMover->brightness = brightness;	// all the way
		else if (brightness > pMover->brightness)
			pMover->brightness++;			// ramp up
		else
			pMover->brightness--;			// ramp down

		DimPartPalette(BgPal(),
				pMover->startColor,
				pMover->paletteLength,
				pMover->brightness);
	}
}
bool BaseV4L2VideoCapture::SetBrightness(int32_t value) {
  //return v4l2_s_ctrl(V4L2_CID_BRIGHTNESS, value);
  if(_pVideoCaptureFiltersCapability->VerifyBrightness(value)){
    if(v4l2_s_ctrl(V4L2_CID_BRIGHTNESS, value)){
      _pVideoCaptureFilters->brightness = GetBrightness();
      return true;
    }
    else
      return false;
  }
  else
    return false;
}
bool BaseV4L2VideoCapture::InitVideoCaptureFilters() {
  if(_pVideoCaptureFilters == NULL)
    _pVideoCaptureFilters = new VideoCaptureFilters();

  _pVideoCaptureFilters->brightness = GetBrightness();
  _pVideoCaptureFilters->contrast = GetContrast();
  _pVideoCaptureFilters->hue = GetHUE();
  _pVideoCaptureFilters->saturation = GetSaturation();
  _pVideoCaptureFilters->sharpness = GetSharpness();
  _pVideoCaptureFilters->gamma = GetGamma();
  _pVideoCaptureFilters->backlightCompensation = GetBacklightCompensation();

  // Below is for debug sake
  //FATAL("brightness : %d\n contrast : %d\n hue : %d\n saturation : %d\n sharpness : %d\n gamma : %d\n backlightCompensation :%d", _pVideoCaptureFilters->brightness , _pVideoCaptureFilters->contrast, _pVideoCaptureFilters->hue, _pVideoCaptureFilters->saturation , _pVideoCaptureFilters->sharpness, _pVideoCaptureFilters->gamma, _pVideoCaptureFilters->backlightCompensation);
  return true;
}
Exemple #5
0
void CTextureTool::Refresh ()
{
if (!m_bInited)
	return;
if (!GetMine ())
	return;
//Beep (1000,100);
	HINSTANCE	hInst = AfxGetApp()->m_hInstance;
	CComboBox	*cbTexture1 = CBTexture1 ();
	CComboBox	*cbTexture2 = CBTexture2 ();
	INT16			texture1, texture2, mode;
	bool			bShowTexture;
	int			i, j;
	CDSegment	*seg;
	CDSide		*side;
	CDWall		*pWall;
	CDColor		*color;
// enable buttons as required
/*
EditButton->EnableWindow((file_type == RDL_FILE || path [0] == NULL) ? FALSE: TRUE);
LightButton->EnableWindow((file_type==RDL_FILE) ? FALSE:TRUE);
PickButton->EnableWindow(path [0] ? TRUE:FALSE);
*/
// set animation frames to zero
#if TEXTOOLDLG == 0
m_frame [0] = 0;
m_frame [1] = 0;
#endif

seg = m_mine->CurrSeg ();
side = m_mine->CurrSide ();
color = m_mine->CurrLightColor ();
int nSide = m_mine->Current ()->side;
texture1 = side->nBaseTex;
texture2 = side->nOvlTex & 0x3fff;
pWall = m_mine->CurrWall ();
m_nColorIndex = (pWall && (pWall->type == WALL_TRANSPARENT)) ? pWall->cloak_value : color->index;
m_rgbColor.peRed = (char) (255.0 * color->color.r);
m_rgbColor.peGreen = (char) (255.0 * color->color.g);
m_rgbColor.peBlue = (char) (255.0 * color->color.b);
if ((texture1 < 0) || (texture1 >= MAX_TEXTURES))
	texture1 = 0;
if ((texture2 < 0) || (texture2 >= MAX_TEXTURES))
	texture2 = 0;
GetBrightness ((m_bUse2nd && !m_bUse1st) ? texture2 : texture1);
mode = side->nOvlTex & 0xc000;
// set edit fields to % of light and enable them
for (i = 0; i < 4; i++) {
/*
	switch(mode) {
		case (INT16) 0x0000: 
			j = i;       
			break;
		case (INT16) 0x4000: 
			j = (i + 3) % 4; 
			break;
		case (INT16) 0x8000: 
			j = (i + 2) % 4;
			break;
		case (INT16) 0xC000: 
			j = (i + 1) % 4;
			break;
		default: 
			j = i;
		}
*/
	j = (i + lightIdxFromMode [mode / 0x4000]) % 4;
	m_lights [j] = (double) ((UINT16) side->uvls [i].l) / 327.68;
	}

if (seg->children [nSide]==-1)
	bShowTexture = TRUE;
else {
	UINT16 nWall = side->nWall;
	bShowTexture = (nWall < m_mine->GameInfo ().walls.count);
	}
if (bShowTexture) {
	if ((texture1!=last_texture1) || (texture2!=last_texture2) || (mode!=last_mode)) {
		last_texture1 = texture1;
		last_texture2 = texture2;
		last_mode = mode;
		LoadString (hInst, texture_resource + texture1, message, sizeof (message));
		cbTexture1->SetCurSel (i = cbTexture1->SelectString (-1, message));  // unselect if string not found
		if (side->nOvlTex) {
			LoadString (hInst, texture_resource + texture2, message, sizeof (message));
			cbTexture2->SetCurSel (cbTexture2->SelectString (-1, message));  // unselect if string not found
			}
		else
			cbTexture2->SelectString (-1, "(none)");
		}
	}
else {
	last_texture1 = -1;
	last_texture2 = -1;
	cbTexture1->SelectString (-1, "(none)");
	cbTexture2->SelectString (-1, "(none)");
	}
RefreshAlignment ();
UpdateData (FALSE);
#if TEXTOOLDLG
CTexToolDlg::Refresh ();
#else
UpdateTextureWnd ();
#endif
UpdateAlignWnd ();
UpdateLightWnd ();
UpdatePaletteWnd ();
}
Exemple #6
0
void Get_LED_Pattern(uint8_t * no, uint16_t * delay, uint8_t * bri){
	*no = (uint32_t)LED_PATTERN;
	*delay = (uint32_t)MILLI_DELAY;
	*bri = (uint32_t)GetBrightness();
}