album pic works
This commit is contained in:
parent
3bff63163c
commit
8706626129
4 changed files with 35 additions and 3 deletions
|
|
@ -219,10 +219,10 @@ int main() {
|
|||
MwNleftPadding, 16,
|
||||
NULL);
|
||||
|
||||
pxalbumdata = malloc(128 * 128 * 4);
|
||||
memset(pxalbumdata, 0, 128 * 128 * 4);
|
||||
pxalbumdata = malloc(ALBUMWIDTH * ALBUMWIDTH * 4);
|
||||
memset(pxalbumdata, 0, ALBUMWIDTH * ALBUMWIDTH * 4);
|
||||
|
||||
pxalbum = MwLoadRaw(window, pxalbumdata, 128, 128);
|
||||
pxalbum = MwLoadRaw(window, pxalbumdata, ALBUMWIDTH, ALBUMWIDTH);
|
||||
pxskipback = MwLoadXPM(window, skipback_xpm);
|
||||
pxplay = MwLoadXPM(window, play_xpm);
|
||||
pxpause = MwLoadXPM(window, pause_xpm);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define ALBUMWIDTH 128
|
||||
|
||||
typedef struct numkv {
|
||||
char* key;
|
||||
int value;
|
||||
|
|
@ -40,6 +42,7 @@ extern MwWidget album, info;
|
|||
extern MwWidget bskipback, bplay, bpause, bstop, bskipfwd, brepeat, bshuffle;
|
||||
extern MwWidget eltime, seekbar, rmtime;
|
||||
extern MwWidget tree, list;
|
||||
extern unsigned char* pxalbumdata;
|
||||
extern MwLLPixmap pxalbum;
|
||||
|
||||
/* db.c */
|
||||
|
|
|
|||
2
mauplay/stb_image.c
Normal file
2
mauplay/stb_image.c
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb_image.h>
|
||||
27
mauplay/ui.c
27
mauplay/ui.c
|
|
@ -1,6 +1,7 @@
|
|||
#include "mauplay.h"
|
||||
|
||||
#include <stb_ds.h>
|
||||
#include <stb_image.h>
|
||||
|
||||
static void* play_queue;
|
||||
static void* all_music;
|
||||
|
|
@ -204,6 +205,32 @@ static void window_tick(MwWidget handle, void* user, void* client) {
|
|||
if(queue_last != queue_seek && queue_seek != -1) {
|
||||
int ind;
|
||||
char* buf;
|
||||
size_t sz;
|
||||
unsigned char* img;
|
||||
|
||||
img = id3_findimage(queue[queue_seek].path, &sz);
|
||||
if(img != NULL){
|
||||
int iw, ih, ic;
|
||||
unsigned char* data = stbi_load_from_memory(img, sz, &iw, &ih, &ic, 4);
|
||||
if(data != NULL){
|
||||
int y, x;
|
||||
for(y = 0; y < ALBUMWIDTH; y++){
|
||||
for(x = 0; x < ALBUMWIDTH; x++){
|
||||
int ix = x * iw / ALBUMWIDTH;
|
||||
int iy = y * ih / ALBUMWIDTH;
|
||||
unsigned char* ipx = &data[(iy * iw + ix) * 4];
|
||||
unsigned char* opx = &((MwLLCommonPixmap)pxalbum)->raw[(y * ALBUMWIDTH + x) * 4];
|
||||
|
||||
memcpy(opx, ipx, 4);
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
}
|
||||
|
||||
MwLLPixmapUpdate(pxalbum);
|
||||
MwForceRender(album);
|
||||
free(img);
|
||||
}
|
||||
|
||||
if(ui_last == play_queue) {
|
||||
pthread_mutex_unlock(&audio_mutex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue