Click here to Skip to main content
15,922,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Changing the font of the CTabCtrl Pin
Mark Donkers15-Nov-01 3:07
Mark Donkers15-Nov-01 3:07 
GeneralRe: Changing the font of the CTabCtrl Pin
Nish Nishant15-Nov-01 3:25
sitebuilderNish Nishant15-Nov-01 3:25 
Generalredirecting display to go to printer Pin
14-Nov-01 14:59
suss14-Nov-01 14:59 
QuestionHow to get and set colors of the each pixel in a bitmap? Pin
chen14-Nov-01 14:25
chen14-Nov-01 14:25 
AnswerRe: How to get and set colors of the each pixel in a bitmap? Pin
Christian Graus14-Nov-01 14:29
protectorChristian Graus14-Nov-01 14:29 
AnswerRe: How to get and set colors of the each pixel in a bitmap? Pin
chen14-Nov-01 14:46
chen14-Nov-01 14:46 
GeneralRe: How to get and set colors of the each pixel in a bitmap? Pin
Christian Graus14-Nov-01 14:49
protectorChristian Graus14-Nov-01 14:49 
GeneralRe: How to get and set colors of the each pixel in a bitmap? Pin
chen14-Nov-01 14:59
chen14-Nov-01 14:59 
The CDIB class i used is wrote by Jorge Lodos (lodos@cigb.edu.cu) in 1998.
But there is no GetPixel and SetPixel function.
It looks like that:

// dib.h

#ifndef _INC_DIB
#define _INC_DIB

/* DIB constants */
#define PALVERSION 0x300

/* Dib Header Marker - used in writing DIBs to files */
#define DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')

/* DIB Macros*/
#define RECTWIDTH(lpRect) ((lpRect)->right - (lpRect)->left)
#define RECTHEIGHT(lpRect) ((lpRect)->bottom - (lpRect)->top)

// WIDTHBYTES performs DWORD-aligning of DIB scanlines. The "bits"
// parameter is the bit count for the scanline (biWidth * biBitCount),
// and this macro returns the number of DWORD-aligned bytes needed
// to hold those bits.

#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)

class CDib : public CObject
{
DECLARE_DYNAMIC(CDib)

// Constructors
public:
CDib();

public:
CPalette* m_pPalette;
LPBYTE m_pBits;
LPBITMAPINFO m_pBMI;

public:
DWORD Width() const;
DWORD Height() const;
WORD NumColors() const;
BOOL IsValid() const { return (m_pBMI != NULL); }

// Operations
public:
BOOL Paint(HDC, LPRECT, LPRECT) const;
HGLOBAL CopyToHandle() const;
DWORD Save(CFile& file) const;
DWORD Read(CFile& file);
DWORD ReadFromHandle(HGLOBAL hGlobal);
void Invalidate() { Free(); }
virtual void Serialize(CArchive& ar);
/* new added by chen 2001.11.14*/
void SetPixel( int iX, int iY, RGBQUAD& rgbPixel );
RGBQUAD GetPixel(int iX, int iY);
void AssertPosition( int iX, int iY );

// Implementation
public:
virtual ~CDib();

protected:
BOOL CreatePalette();
WORD PaletteSize() const;
void Free();

public:
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
#endif

protected:
CDib& operator = (CDib& dib);
};

#endif //!_INC_DIB

chen
GeneralRe: How to get and set colors of the each pixel in a bitmap? Pin
chen14-Nov-01 15:09
chen14-Nov-01 15:09 
GeneralRe: How to get and set colors of the each pixel in a bitmap? Pin
Christian Graus14-Nov-01 15:55
protectorChristian Graus14-Nov-01 15:55 
GeneralRe: How to get and set colors of the each pixel in a bitmap? Pin
Christian Graus14-Nov-01 15:57
protectorChristian Graus14-Nov-01 15:57 
GeneralNewB question of the day Pin
RobJones14-Nov-01 11:20
RobJones14-Nov-01 11:20 
GeneralRe: NewB question of the day Pin
Bill Wilson14-Nov-01 11:25
Bill Wilson14-Nov-01 11:25 
GeneralColor Usage in CreateDIBitmap Pin
AJ12314-Nov-01 11:20
AJ12314-Nov-01 11:20 
GeneralUsing Server Idle Time Pin
AJ12314-Nov-01 11:10
AJ12314-Nov-01 11:10 
GeneralRe: Using Server Idle Time Pin
Anders Molin14-Nov-01 14:22
professionalAnders Molin14-Nov-01 14:22 
GeneralInteraction Pin
Ever123414-Nov-01 9:26
Ever123414-Nov-01 9:26 
GeneralRe: Interaction Pin
Anders Molin14-Nov-01 14:26
professionalAnders Molin14-Nov-01 14:26 
GeneralRe: Interaction Pin
Mark Terrano16-Nov-01 11:55
Mark Terrano16-Nov-01 11:55 
GeneralStatusBar in a Dialog Pin
14-Nov-01 7:16
suss14-Nov-01 7:16 
GeneralCDC... I wan't the client area HOW TO Pin
Remi Morin14-Nov-01 5:38
Remi Morin14-Nov-01 5:38 
GeneralRe: CDC... I wan't the client area HOW TO Pin
14-Nov-01 7:13
suss14-Nov-01 7:13 
GeneralTIP: Problems comparing COleDateTime objects + COleDateTimeSpan accumulated errors Pin
14-Nov-01 5:28
suss14-Nov-01 5:28 
GeneralRe: TIP: Problems comparing COleDateTime objects + COleDateTimeSpan accumulated errors Pin
Bill Wilson15-Nov-01 14:05
Bill Wilson15-Nov-01 14:05 
QuestionIs it possible to change style only of some region in dialog? Pin
14-Nov-01 5:22
suss14-Nov-01 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.