/*
* Pixel.cpp
* Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 2000.02.18
#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\DesktopDC.h>
namespace SOL {
class PixelView :public ApplicationView {
private:
void copy(DC& destDC, int dx, int dy, int width, int height,
DC& sourceDC, int sx, int sy)
{
for(int y = sy; y<sy+height; y++) {
for(int x = sx; x<sx+width; x++) {
COLORREF color = sourceDC.getPixel(x, y);
destDC.setPixel(x + dx, y+ dy, color);
}
}
}
private:
long paint(Event& event)
{
PaintDC pdc(this);
DesktopDC deskdc;
copy(pdc, 20, 20, 200, 200, deskdc, 0, 0);
return 0;
}
public:
PixelView(Application& applet, const TCHAR* label, Args& args)
:ApplicationView(applet, label, args)
{
addEventHandler(WM_PAINT, this,
(Handler)&PixelView::paint, null);
}
};
}
//
void Main(int argc, TCHAR** argv)
{
const TCHAR* appClass = _T("PixelView");
try {
Application applet(appClass, argc, argv);
Args args;
PixelView pixelview(applet, appClass, args);
pixelview.realize();
applet.run();
} catch (...) {
}
}
|