OverlayDraw - /* C Copyright (c) 2007 Muhammad Haggag This...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Copyright (c) 2007 Muhammad Haggag C This software is provided 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for any damages arising from the use of this software. s Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: t 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. t 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. a 3. This notice may not be removed or altered from any source distribution. */ #include "stdafx.h" #include "OverlayDraw.h" #include "Exception.h" # namespace { int Clamp(int value, int low, int high) { if(value < low) return low; else if(value > high) return high; r return value; } } namespace Overlay { struct RgbColor { BYTE red, green, blue; B static RgbColor FromImage( int x, int y) { assert(x >= 0 & x = 0 && y a const int pitch = image.width * 3; const int index = 3 * x + y * pitch; const RgbColor result = { image.data[index + 0], image.data[index + 1],
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
image.data[index + 2] }; } return result; } }; } struct YuvColor { BYTE y, u, v; B { YuvColor result = { Clamp( 0.29 * color.red + 0.59 * color.green + 0.14 * color.blue, 0, 235), Clamp(128.0 - 0.14 * color.red - 0.29 * color.green + 0.43 * color.blue, 0,240), Clamp(128.0 + 0.36 * color.red - 0.29 * color.green - 0.07
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/31/2011 for the course CS 302 taught by Professor J.parker during the Spring '08 term at University of Texas.

Page1 / 6

OverlayDraw - /* C Copyright (c) 2007 Muhammad Haggag This...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online