<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>\r
</ClCompile>\r
<ClCompile Include="producer\image_scroll_producer.cpp" />\r
+ <ClCompile Include="util\image_algorithms.cpp" />\r
<ClCompile Include="util\image_loader.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="consumer\image_consumer.cpp">\r
<Filter>source\consumer</Filter>\r
</ClCompile>\r
+ <ClCompile Include="util\image_algorithms.cpp">\r
+ <Filter>source\util</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="producer\image_producer.h">\r
{\r
auto bitmap = load_image(filename_);\r
FreeImage_FlipVertical(bitmap.get());\r
- \r
+\r
core::pixel_format_desc desc;\r
desc.pix_fmt = core::pixel_format::bgra;\r
desc.planes.push_back(core::pixel_format_desc::plane(FreeImage_GetWidth(bitmap.get()), FreeImage_GetHeight(bitmap.get()), 4));\r
--- /dev/null
+#include <vector>\r
+#include <stdint.h>\r
+#include "../util/image_algorithms.h"\r
+\r
+namespace caspar { namespace image {\r
+\r
+std::vector<std::pair<int, int>> get_line_points(int num_pixels, double angle_radians)\r
+{\r
+ std::vector<std::pair<int, int>> line_points;\r
+ line_points.reserve(num_pixels);\r
+\r
+ double delta_x = std::cos(angle_radians);\r
+ double delta_y = -std::sin(angle_radians); // In memory is revered\r
+ double max_delta = std::max(std::abs(delta_x), std::abs(delta_y));\r
+ double amplification = 1.0 / max_delta;\r
+ delta_x *= amplification;\r
+ delta_y *= amplification;\r
+\r
+ for (int i = 1; i <= num_pixels; ++i)\r
+ line_points.push_back(std::make_pair(\r
+ static_cast<int>(std::floor(delta_x * static_cast<double>(i) + 0.5)), \r
+ static_cast<int>(std::floor(delta_y * static_cast<double>(i) + 0.5))));\r
+\r
+ return std::move(line_points);\r
+}\r
+\r
+}} //namespace caspar::image
\ No newline at end of file
*\r
* @return the x-y pairs.\r
*/\r
-std::vector<std::pair<int, int>> get_line_points(int num_pixels, double angle_radians)\r
-{\r
- std::vector<std::pair<int, int>> line_points;\r
- line_points.reserve(num_pixels);\r
-\r
- double delta_x = std::cos(angle_radians);\r
- double delta_y = -std::sin(angle_radians); // In memory is revered\r
- double max_delta = std::max(std::abs(delta_x), std::abs(delta_y));\r
- double amplification = 1.0 / max_delta;\r
- delta_x *= amplification;\r
- delta_y *= amplification;\r
-\r
- for (int i = 1; i <= num_pixels; ++i)\r
- line_points.push_back(std::make_pair(\r
- static_cast<int>(std::floor(delta_x * static_cast<double>(i) + 0.5)), \r
- static_cast<int>(std::floor(delta_y * static_cast<double>(i) + 0.5))));\r
-\r
- return std::move(line_points);\r
-}\r
+std::vector<std::pair<int, int>> get_line_points(int num_pixels, double angle_radians);\r
\r
/**\r
* Directionally blur a source image modelling the ImageView concept and store\r
#include <boost/exception/errinfo_file_name.hpp>\r
#include <boost/filesystem.hpp>\r
\r
+#include "image_algorithms.h"\r
+#include "image_view.h"\r
+\r
namespace caspar { namespace image {\r
\r
std::shared_ptr<FIBITMAP> load_image(const std::wstring& filename)\r
if(!bitmap)\r
BOOST_THROW_EXCEPTION(invalid_argument() << msg_info("Unsupported image format.")); \r
}\r
+\r
+ //PNG-images need to be premultiplied with their alpha\r
+ if(fif == FIF_PNG)\r
+ {\r
+ image_view<bgra_pixel> original_view(FreeImage_GetBits(bitmap.get()), FreeImage_GetWidth(bitmap.get()), FreeImage_GetHeight(bitmap.get()));\r
+ premultiply(original_view);\r
+ }\r
\r
return bitmap;\r
}\r