1 Screenshot
2 Source code
/*
* Pixel.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 2000.02.18
// 2012/06/28
#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\DesktopDC.h>
#include <sol\MemoryDC.h>
#include "resource.h"
namespace SOL {
class PixelView :public ApplicationView {
private:
void setPixel(DC& destDC, int dx, int dy, int width, int height)
{
for(int y = 0; y<height; y++) {
for(int x = 0; x<width; x++) {
COLORREF color = RGB(x, y, (x+y)/2);
destDC.setPixel(x + dx, y+ dy, color);
}
}
}
private:
long paint(Event& event)
{
PaintDC pdc(this);
setPixel(pdc, 10, 10, 256, 256);
return 0;
}
public:
PixelView(Application& applet, const TCHAR* label, Args& args)
:ApplicationView(applet, label, args)
{
addEventHandler(WM_PAINT, this,
(Handler)&PixelView::paint, NULL);
addCallback(XmNmenuCallback, IDM_EXIT, this,
(Callback)&PixelView::exit, NULL);
}
};
}
//
void Main(int argc, TCHAR** argv)
{
ModuleFileName module(argv[0]);
const TCHAR* name = module.getFileName();
try {
Application applet(name, argc, argv);
Args args;
args.set(XmNclassStyle, 0);
PixelView pixelview(applet, name, args);
pixelview.realize();
applet.run();
} catch (Exception& ex) {
caught(ex);
} catch (...) {
caught(UnknownException());
}
}
Last modified: 1 Feb 2017
Copyright (c) 2017 Antillia.com ALL RIGHTS RESERVED.