Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 23rd, 2004, 02:52 AM
ck ck is offline
Authorized User
Join Date: Dec 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get bitmap pixel to store in the array

 i'm a beginner of visual C++, anybody know or can teach me how to get bitmap pixel, read it, write it, then save it, then load & display it on the static control in MFC??? & all tis codes is it write in header file(.h) or source file(.cpp)??? thanks

below is the codes..but dunnno right or wrong...& it got bugs also...

struct Image {
 int rows;
 int colds;
 unsigned char *Data;
 unsigned char Type;

#define BASIC 0

#include <stdlib.h>
#include <memory.h>

void ReadArray(Image *Img, const char *filename)
    FILE *fl;
    int x;

        fl = fopen(filename, "ra");

    for(x=0; x<Img->rows; ++x)
            fread(Img->Data + x*Img->cols, Img->cols,1,fl);

void WriteArray(Image *Img, const char *filename)
    FILE *fl;
    int y;

        fl = fopen(filename, "wa");

    for(y=0; y<Img->rows; ++y)
            fwrite(Img->Data + y*Img->cols, Img->cols,1,fl);


Similar Threads
Thread Thread Starter Forum Replies Last Post
read bitmap pixel ersantombalak VB How-To 2 February 13th, 2007 07:20 AM
Store time into Array derekl ASP.NET 1.0 and 1.1 Basics 3 December 18th, 2006 09:41 AM
Store Array of Form Values lbunnell Beginning PHP 1 June 21st, 2005 10:13 AM
How to get bitmap pixel to store in the array ck C++ Programming 1 January 20th, 2005 05:02 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.