コード例 #1
0
ファイル: testBitmap.c プロジェクト: hmcaio/mycutils
int main()
{
    Bitmap bm;

    bm = bitmapCreate(10);
    if (!bm)
    {
        fprintf(stderr, "Failed to create bitmap.\n");
        return 1;
    }

    bitmapPrint(bm);

    bitmapSet(&bm, 3);
    bitmapSet(&bm, 0);
    bitmapSet(&bm, 8);

    bitmapPrint(bm);

    bitmapUnset(&bm, 3);

    bitmapPrint(bm);

    bitmapClear(&bm);
    
    bitmapPrint(bm);

    bitmapDestroy(&bm);

    printf("End\n");

    return 0;
}
コード例 #2
0
ファイル: barcode.c プロジェクト: david-sackmary/distro-mods
/* draw a vertical line in the given bitmap */
static void bitmapVlin (Bitmap *b, int x, int y1, int y2)
{
    while (y1 <= y2)
    {
        bitmapSet (b, x, y1, 1);
        y1++;
    }
}
コード例 #3
0
ファイル: barcode.c プロジェクト: david-sackmary/distro-mods
/* copy the given rectangle to the given destination from the given source. */
static void bitmapCopyRect (Bitmap *dest, int dx, int dy,
                            Bitmap *src, int sx, int sy, int width, int height)
{
    int x, y;

    for (y = 0; y < height; y++)
    {
	for (x = 0; x < width; x++)
	{
	    bitmapSet (dest, x + dx, y + dy, bitmapGet (src, x + sx, y + sy));
	}
    }
}
コード例 #4
0
ファイル: barcode.c プロジェクト: david-sackmary/distro-mods
/* scale a bitmap into another bitmap */
static void bitmapScale (Bitmap *dest, Bitmap *src, int mag)
{
    int x, y, x2, y2;

    for (y = 0; y < BARCODE_HEIGHT; y++)
    {
	for (x = 0; x < BARCODE_WIDTH; x++)
	{
	    int v = bitmapGet (src, x, y);
	    for (x2 = 0; x2 < mag; x2++) 
	    {
		for (y2 = 0; y2 < mag; y2++) 
		{
		    bitmapSet (dest, x * mag + x2, y * mag + y2, v);
		}
	    }
	}
    }
}