Lesson 8 Crap
-
- Posts: 2
- Joined: March 13th, 2019, 8:50 pm
Re: Lesson 8 Crap
Is the year time stamp correct? Nuts...anyways. What if you were sooo stupid you couldn't figure out how to use fukbmp? I would rather ask for help here as opposed to the you tube comments. If nobody responds within a day I will probably try the help forum should I feel so inclined. I will just keep trying. I just want to understand it before I move on....sort of. Thanks in advance.
-
- Posts: 2
- Joined: March 13th, 2019, 8:50 pm
Re: Lesson 8 Crap
I can't figure out how to use Fukbmp. Thanks for the reply but I really should be able to figure it out. It must be inside the code somewhere. If I still can't after today I will try back. Thanks for the video's. Awesome humor in them!
Re: Lesson 8 Crap
Hmmm, it's been so goddamn long I don't really recall it myself.
Here is what I used for the new series (think of it as fukbmp V2)
Code: Select all
#define NOMINMAX
#include <windows.h>
#include <algorithm>
namespace Gdiplus
{
using std::min;
using std::max;
}
#include <gdiplus.h>
#include <fstream>
#include <string>
#include <experimental\filesystem>
#pragma comment(lib,"gdiplus.lib")
namespace fs = std::experimental::filesystem::v1;
namespace gdi = Gdiplus;
const std::string in_path = "images";
const std::string out_path = "code";
const std::string out_ext = ".txt";
const gdi::Color alphakey( 192,192,192 );
int main()
{
gdi::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
gdi::GdiplusStartup( &gdiplusToken,&gdiplusStartupInput,nullptr );
for( const auto& e : fs::directory_iterator( in_path ) )
{
if( e.status().type() == fs::_File_type::regular )
{
const fs::path p = e;
if( p.extension() == ".png" )
{
std::ofstream out_file( out_path + "\\" + p.stem().generic_string() + out_ext );
gdi::Bitmap bitmap( p.c_str() );
for( size_t y = 0; y < bitmap.GetHeight(); y++ )
{
for( size_t x = 0; x < bitmap.GetWidth(); x++ )
{
gdi::Color pixel;
bitmap.GetPixel( x,y,&pixel );
if( pixel.GetValue() != alphakey.GetValue() )
{
out_file << "\tgfx.PutPixel( " << x << " + x," << y << " + y,"
<< int( pixel.GetR() ) << ","
<< int( pixel.GetG() ) << ","
<< int( pixel.GetB() ) << " );\n";
}
}
}
}
}
}
gdi::GdiplusShutdown( gdiplusToken );
return 0;
}
Chili