Workshop o mikrokontrolérech na SKSP 2024.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.0 KiB

3 months ago
/*
* Image Library -- Dumping of image signatures
*
* (c) 2006 Pavel Charvat <pchar@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
*/
#include <ucw/lib.h>
#include <images/images.h>
#include <images/signature.h>
#include <stdio.h>
byte *
image_vector_dump(byte *buf, struct image_vector *vec)
{
byte *p = buf;
*p++ = '(';
for (uint i = 0; i < IMAGE_VEC_F; i++)
{
if (i)
*p++ = ' ';
p += sprintf(p, "%u", vec->f[i]);
}
*p++ = ')';
*p = 0;
return buf;
}
byte *
image_region_dump(byte *buf, struct image_region *reg)
{
byte *p = buf;
p += sprintf(p, "(txt=");
for (uint i = 0; i < IMAGE_REG_F; i++)
{
if (i)
*p++ = ' ';
p += sprintf(p, "%u", reg->f[i]);
}
p += sprintf(p, " shp=");
for (uint i = 0; i < IMAGE_REG_H; i++)
{
if (i)
*p++ = ' ';
p += sprintf(p, "%u", reg->h[i]);
}
p += sprintf(p, " wa=%u wb=%u)", reg->wa, reg->wb);
*p = 0;
return buf;
}