mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-23 09:34:07 +00:00
pixmap works
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@70 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
20
src/frame.c
20
src/frame.c
@@ -1,25 +1,8 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
MwLLPixmap pixmap;
|
||||
|
||||
static void create(MwWidget handle) {
|
||||
MwSetDefault(handle);
|
||||
|
||||
int y, x;
|
||||
unsigned char* dat = malloc(640 * 480 * 3);
|
||||
for(y = 0; y < 480; y++) {
|
||||
for(x = 0; x < 640; x++) {
|
||||
unsigned char* px = &dat[(y * 640 + x) * 3];
|
||||
double c = (double)x / 640 * 255 / 2 + (double)y / 480 * 255 / 2;
|
||||
|
||||
px[0] = c;
|
||||
px[1] = 0;
|
||||
px[2] = 0;
|
||||
}
|
||||
}
|
||||
pixmap = MwLLCreatePixmap(handle->lowlevel, dat, 640, 480);
|
||||
free(dat);
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
@@ -33,8 +16,7 @@ static void draw(MwWidget handle) {
|
||||
|
||||
MwDrawFrameEx(handle, &r, base, 1, 1);
|
||||
MwDrawFrameEx(handle, &r, base, 0, 1);
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
|
||||
// MwDrawRect(handle, &r, base);
|
||||
MwDrawRect(handle, &r, base);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user