void convertToRGB(uint32_t *outPixels) const { for (unsigned int x = 0; x < m_width; ++x) { for (unsigned int y = 0; y < m_height; ++y) { PixelSample &sample = pixelAt(x, y); if (sample.filterAccum != 0) { outPixels[x + y*m_width] = mapRGB(sample.accum / sample.filterAccum); } else { outPixels[x + y*m_width] = mapRGB(Vec()); } } } }
void colorControl(int redLevel, int greenLevel, int blueLevel) { redDump = mapRGB(redLevel, 0, 255, 0, 100); greenDump = mapRGB(greenLevel, 0, 255, 0, 100); blueDump = mapRGB(blueLevel, 0, 255, 0, 100); if(switchStatus){ dimColorChange(); notify_color_change(redLevel, greenLevel, blueLevel); // set_all_color_status(redLevel, greenLevel, blueLevel); } else printf("Turn on Lamp First\n"); }
void Item::draw(Camera *camera) const { Surface *dst = camera->get_surface(); Uint32 color; switch(m_type) { case 1: color = mapRGB(255, 0, 0); break; case 2: color = mapRGB(0, 255, 0); break; case 3: color = mapRGB(0, 0, 255); break; } dst->draw_circle(color, m_circle[0] - camera->get_x(), m_circle[1] - camera->get_y(), m_circle[2]); }
void dimColorChange(){ int dimm = dimValue; int redDimm = mapRGB(redDump, 0, 100, 0, dimm); int greenDimm = mapRGB(greenDump, 0, 100, 0, dimm); int blueDimm = mapRGB(blueDump, 0, 100, 0, dimm); softPwmWrite(pinRed, redDimm); softPwmWrite(pinGreen, greenDimm); softPwmWrite(pinBlue, blueDimm); printf("Status %s. R: %d G: %d B: %d\n", switchStatus ? "on" : "off", redDimm, greenDimm, blueDimm); fflush(stdout); }
void CircleBullet::draw(Camera *camera) const { Surface *dst = camera->get_surface(); Circle *circle = (Circle *)m_shape; int x = (int)(circle->get_x() - camera->get_x()); int y = (int)(circle->get_y() - camera->get_y()); int r = (int)(circle->get_r()); dst->draw_circle(mapRGB(255, 255, 255), x, y, r, 1); }
void RectBullet::draw(Camera *camera) const { Surface *dst = camera->get_surface(); Rect *rect = (Rect *)m_shape; int x = (int)(rect->get_x() - camera->get_x()); int y = (int)(rect->get_y() - camera->get_y()); Rect dims(x, y, rect->get_w(), rect->get_h()); dst->draw_rect(mapRGB(255, 255, 255), dims, 2); }
void LineBullet::draw(Camera *camera) const { Surface *dst = camera->get_surface(); Line *line = (Line *)m_shape; int x1 = (int)(line->get_x1() - camera->get_x()); int y1 = (int)(line->get_y1() - camera->get_y()); int x2 = (int)(line->get_x2() - camera->get_x()); int y2 = (int)(line->get_y2() - camera->get_y()); dst->draw_line(mapRGB(255, 255, 255), x1, y1, x2, y2); }
void Console::draw(Surface *dst) const { if (m_visible == false) return; Uint32 bg_color = mapRGB(0, 0, 0); Uint32 text_color = mapRGB(0, 255, 0); int cur_line = 0; int base_x = 5; int base_y = 5; Rect dims(0, 0, dst->get_w(), 2 * base_y + m_font_size * m_max_lines); dst->draw_rect(bg_color, dims); list<string>::const_iterator it; for (it = m_lines.begin(); it != m_lines.end(); it++) { dst->draw_string(m_font, (*it).c_str(), text_color, base_x, base_y + m_font_size * cur_line); cur_line++; } dst->draw_string(m_font, m_input.c_str(), text_color, base_x, base_y + m_font_size * cur_line); }
void dimmingControl(int _dimValue) { dimValue = mapRGB(_dimValue, 0, 255, 0, 100); if(switchStatus) { dimColorChange(); notify_load_level_change(_dimValue); // set_all_load_level(_dimValue); } else printf("Turn on Lamp First\n"); }