| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_ |
| 8 #define CORE_INCLUDE_FXGE_FX_DIB_H_ | 8 #define CORE_INCLUDE_FXGE_FX_DIB_H_ |
| 9 | 9 |
| 10 #include "../fxcrt/fx_basic.h" | 10 #include "../fxcrt/fx_basic.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 | 173 |
| 174 | 174 |
| 175 virtual uint8_t* GetBuffer() const | 175 virtual uint8_t* GetBuffer() const |
| 176 { | 176 { |
| 177 return NULL; | 177 return NULL; |
| 178 } | 178 } |
| 179 | 179 |
| 180 virtual const uint8_t* GetScanline(int line) const = 0; | 180 virtual const uint8_t* GetScanline(int line) const = 0; |
| 181 | 181 |
| 182 virtual FX_BOOL» » SkipToScanline(int line, IFX_Pause* pPause) cons
t | 182 virtual bool» » SkipToScanline(int line, IFX_Pause* pPause) cons
t |
| 183 { | 183 { |
| 184 return FALSE; | 184 return false; |
| 185 } | 185 } |
| 186 | 186 |
| 187 virtual void DownSampleScanline(int line, uint8_t* dest_scan,
int dest_bpp, | 187 virtual void DownSampleScanline(int line, uint8_t* dest_scan,
int dest_bpp, |
| 188 int dest_width, FX_BOOL bFlipX, int c
lip_left, int clip_width) const = 0; | 188 int dest_width, bool bFlipX, int clip
_left, int clip_width) const = 0; |
| 189 | 189 |
| 190 virtual void SetDownSampleSize(int width, int height) const {
} | 190 virtual void SetDownSampleSize(int width, int height) const {
} |
| 191 | 191 |
| 192 int GetBPP() const | 192 int GetBPP() const |
| 193 { | 193 { |
| 194 return m_bpp; | 194 return m_bpp; |
| 195 } | 195 } |
| 196 | 196 |
| 197 FX_BOOL» » » IsAlphaMask() const | 197 bool» » » IsAlphaMask() const |
| 198 { | 198 { |
| 199 return m_AlphaFlag == 1; | 199 return m_AlphaFlag == 1; |
| 200 } | 200 } |
| 201 | 201 |
| 202 FX_BOOL» » » HasAlpha() const | 202 bool» » » HasAlpha() const |
| 203 { | 203 { |
| 204 return m_AlphaFlag & 2 ? TRUE : FALSE; | 204 return m_AlphaFlag & 2 ? true : false; |
| 205 } | 205 } |
| 206 | 206 |
| 207 FX_BOOL» » » IsOpaqueImage() const | 207 bool» » » IsOpaqueImage() const |
| 208 { | 208 { |
| 209 return !(m_AlphaFlag & 3); | 209 return !(m_AlphaFlag & 3); |
| 210 } | 210 } |
| 211 | 211 |
| 212 FX_BOOL» » » IsCmykImage() const | 212 bool» » » IsCmykImage() const |
| 213 { | 213 { |
| 214 return m_AlphaFlag & 4 ? TRUE : FALSE; | 214 return m_AlphaFlag & 4 ? true : false; |
| 215 } | 215 } |
| 216 | 216 |
| 217 | 217 |
| 218 | 218 |
| 219 int GetPaletteSize() const | 219 int GetPaletteSize() const |
| 220 { | 220 { |
| 221 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); | 221 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); |
| 222 } | 222 } |
| 223 | 223 |
| 224 FX_DWORD GetPaletteEntry(int index) const; | 224 FX_DWORD GetPaletteEntry(int index) const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 CFX_DIBitmap* CloneConvert(FXDIB_Format format, const FX_RECT* pClip =
NULL, void* pIccTransform = NULL) const; | 241 CFX_DIBitmap* CloneConvert(FXDIB_Format format, const FX_RECT* pClip =
NULL, void* pIccTransform = NULL) const; |
| 242 | 242 |
| 243 CFX_DIBitmap* StretchTo(int dest_width, int dest_height, FX_DWORD flag
s = 0, const FX_RECT* pClip = NULL) const; | 243 CFX_DIBitmap* StretchTo(int dest_width, int dest_height, FX_DWORD flag
s = 0, const FX_RECT* pClip = NULL) const; |
| 244 | 244 |
| 245 | 245 |
| 246 CFX_DIBitmap* TransformTo(const CFX_AffineMatrix* pMatrix, int& left,
int &top, | 246 CFX_DIBitmap* TransformTo(const CFX_AffineMatrix* pMatrix, int& left,
int &top, |
| 247 FX_DWORD flags = 0, const FX_RECT* pClip = NULL)
const; | 247 FX_DWORD flags = 0, const FX_RECT* pClip = NULL)
const; |
| 248 | 248 |
| 249 CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; | 249 CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; |
| 250 | 250 |
| 251 FX_BOOL» » » CopyAlphaMask(const CFX_DIBSource* pAlphaMask, c
onst FX_RECT* pClip = NULL); | 251 bool» » » CopyAlphaMask(const CFX_DIBSource* pAlphaMask, c
onst FX_RECT* pClip = NULL); |
| 252 | 252 |
| 253 CFX_DIBitmap*» SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_RECT* pC
lip = NULL) const; | 253 CFX_DIBitmap*» SwapXY(bool bXFlip, bool bYFlip, const FX_RECT* pClip =
NULL) const; |
| 254 | 254 |
| 255 CFX_DIBitmap*» FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const; | 255 CFX_DIBitmap*» FlipImage(bool bXFlip, bool bYFlip) const; |
| 256 | 256 |
| 257 void GetOverlapRect(int& dest_left, int& dest_top, in
t& width, int& height, int src_width, | 257 void GetOverlapRect(int& dest_left, int& dest_top, in
t& width, int& height, int src_width, |
| 258 int src_height, int& src_left, int& src_top,
const CFX_ClipRgn* pClipRgn); | 258 int src_height, int& src_left, int& src_top,
const CFX_ClipRgn* pClipRgn); |
| 259 | 259 |
| 260 CFX_DIBitmap* m_pAlphaMask; | 260 CFX_DIBitmap* m_pAlphaMask; |
| 261 protected: | 261 protected: |
| 262 | 262 |
| 263 CFX_DIBSource(); | 263 CFX_DIBSource(); |
| 264 | 264 |
| 265 int m_Width; | 265 int m_Width; |
| 266 | 266 |
| 267 int m_Height; | 267 int m_Height; |
| 268 | 268 |
| 269 int m_bpp; | 269 int m_bpp; |
| 270 | 270 |
| 271 FX_DWORD m_AlphaFlag; | 271 FX_DWORD m_AlphaFlag; |
| 272 | 272 |
| 273 FX_DWORD m_Pitch; | 273 FX_DWORD m_Pitch; |
| 274 | 274 |
| 275 FX_DWORD* m_pPalette; | 275 FX_DWORD* m_pPalette; |
| 276 | 276 |
| 277 void BuildPalette(); | 277 void BuildPalette(); |
| 278 | 278 |
| 279 FX_BOOL» » » BuildAlphaMask(); | 279 bool» » » BuildAlphaMask(); |
| 280 | 280 |
| 281 int FindPalette(FX_DWORD color) const; | 281 int FindPalette(FX_DWORD color) const; |
| 282 | 282 |
| 283 void GetPalette(FX_DWORD* pal, int alpha) const; | 283 void GetPalette(FX_DWORD* pal, int alpha) const; |
| 284 }; | 284 }; |
| 285 class CFX_DIBitmap : public CFX_DIBSource | 285 class CFX_DIBitmap : public CFX_DIBSource |
| 286 { | 286 { |
| 287 public: | 287 public: |
| 288 | 288 |
| 289 virtual ~CFX_DIBitmap(); | 289 virtual ~CFX_DIBitmap(); |
| 290 | 290 |
| 291 CFX_DIBitmap(); | 291 CFX_DIBitmap(); |
| 292 | 292 |
| 293 CFX_DIBitmap(const CFX_DIBitmap& src); | 293 CFX_DIBitmap(const CFX_DIBitmap& src); |
| 294 | 294 |
| 295 FX_BOOL» » » Create(int width, int height, FXDIB_Format forma
t, uint8_t* pBuffer = NULL, int pitch = 0); | 295 bool» » » Create(int width, int height, FXDIB_Format forma
t, uint8_t* pBuffer = NULL, int pitch = 0); |
| 296 | 296 |
| 297 FX_BOOL» » » Copy(const CFX_DIBSource* pSrc); | 297 bool» » » Copy(const CFX_DIBSource* pSrc); |
| 298 | 298 |
| 299 virtual uint8_t* GetBuffer() const | 299 virtual uint8_t* GetBuffer() const |
| 300 { | 300 { |
| 301 return m_pBuffer; | 301 return m_pBuffer; |
| 302 } | 302 } |
| 303 | 303 |
| 304 virtual const uint8_t* GetScanline(int line) const | 304 virtual const uint8_t* GetScanline(int line) const |
| 305 { | 305 { |
| 306 return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL; | 306 return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL; |
| 307 } | 307 } |
| 308 | 308 |
| 309 virtual void DownSampleScanline(int line, uint8_t* dest_scan, int des
t_bpp, | 309 virtual void DownSampleScanline(int line, uint8_t* dest_scan, int des
t_bpp, |
| 310 int dest_width, FX_BOOL bFlipX, int clip_
left, int clip_width) const; | 310 int dest_width, bool bFlipX, int clip_lef
t, int clip_width) const; |
| 311 | 311 |
| 312 void TakeOver(CFX_DIBitmap* pSrcBitmap); | 312 void TakeOver(CFX_DIBitmap* pSrcBitmap); |
| 313 | 313 |
| 314 FX_BOOL» » » ConvertFormat(FXDIB_Format format, void* pIccTra
nsform = NULL); | 314 bool» » » ConvertFormat(FXDIB_Format format, void* pIccTra
nsform = NULL); |
| 315 | 315 |
| 316 void Clear(FX_DWORD color); | 316 void Clear(FX_DWORD color); |
| 317 | 317 |
| 318 FX_DWORD GetPixel(int x, int y) const; | 318 FX_DWORD GetPixel(int x, int y) const; |
| 319 | 319 |
| 320 void SetPixel(int x, int y, FX_DWORD color); | 320 void SetPixel(int x, int y, FX_DWORD color); |
| 321 | 321 |
| 322 FX_BOOL» » » LoadChannel(FXDIB_Channel destChannel, const CFX
_DIBSource* pSrcBitmap, FXDIB_Channel srcChannel); | 322 bool» » » LoadChannel(FXDIB_Channel destChannel, const CFX
_DIBSource* pSrcBitmap, FXDIB_Channel srcChannel); |
| 323 | 323 |
| 324 FX_BOOL» » » LoadChannel(FXDIB_Channel destChannel, int value
); | 324 bool» » » LoadChannel(FXDIB_Channel destChannel, int value
); |
| 325 | 325 |
| 326 FX_BOOL» » » MultiplyAlpha(int alpha); | 326 bool» » » MultiplyAlpha(int alpha); |
| 327 | 327 |
| 328 FX_BOOL» » » MultiplyAlpha(const CFX_DIBSource* pAlphaMask); | 328 bool» » » MultiplyAlpha(const CFX_DIBSource* pAlphaMask); |
| 329 | 329 |
| 330 FX_BOOL» » » TransferBitmap(int dest_left, int dest_top, int
width, int height, | 330 bool» » » TransferBitmap(int dest_left, int dest_top, int
width, int height, |
| 331 const CFX_DIBSource* pSrcBitmap, int src_left
, int src_top, void* pIccTransform = NULL); | 331 const CFX_DIBSource* pSrcBitmap, int src_left
, int src_top, void* pIccTransform = NULL); |
| 332 | 332 |
| 333 FX_BOOL» » » CompositeBitmap(int dest_left, int dest_top, int
width, int height, | 333 bool» » » CompositeBitmap(int dest_left, int dest_top, int
width, int height, |
| 334 const CFX_DIBSource* pSrcBitmap, int src_lef
t, int src_top, | 334 const CFX_DIBSource* pSrcBitmap, int src_lef
t, int src_top, |
| 335 int blend_type = FXDIB_BLEND_NORMAL, const C
FX_ClipRgn* pClipRgn = NULL, FX_BOOL bRgbByteOrder = FALSE, void* pIccTransform
= NULL); | 335 int blend_type = FXDIB_BLEND_NORMAL, const C
FX_ClipRgn* pClipRgn = NULL, bool bRgbByteOrder = false, void* pIccTransform = N
ULL); |
| 336 | 336 |
| 337 FX_BOOL» » » TransferMask(int dest_left, int dest_top, int wi
dth, int height, | 337 bool» » » TransferMask(int dest_left, int dest_top, int wi
dth, int height, |
| 338 const CFX_DIBSource* pMask, FX_DWORD color, int
src_left, int src_top, int alpha_flag = 0, void* pIccTransform = NULL); | 338 const CFX_DIBSource* pMask, FX_DWORD color, int
src_left, int src_top, int alpha_flag = 0, void* pIccTransform = NULL); |
| 339 | 339 |
| 340 FX_BOOL» » » CompositeMask(int dest_left, int dest_top, int w
idth, int height, | 340 bool» » » CompositeMask(int dest_left, int dest_top, int w
idth, int height, |
| 341 const CFX_DIBSource* pMask, FX_DWORD color, in
t src_left, int src_top, | 341 const CFX_DIBSource* pMask, FX_DWORD color, in
t src_left, int src_top, |
| 342 int blend_type = FXDIB_BLEND_NORMAL, const CFX
_ClipRgn* pClipRgn = NULL, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, vo
id* pIccTransform = NULL); | 342 int blend_type = FXDIB_BLEND_NORMAL, const CFX
_ClipRgn* pClipRgn = NULL, bool bRgbByteOrder = false, int alpha_flag = 0, void*
pIccTransform = NULL); |
| 343 | 343 |
| 344 FX_BOOL» » » CompositeRect(int dest_left, int dest_top, int w
idth, int height, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL
); | 344 bool» » » CompositeRect(int dest_left, int dest_top, int w
idth, int height, FX_DWORD color, int alpha_flag = 0, void* pIccTransform = NULL
); |
| 345 | 345 |
| 346 FX_BOOL» » » ConvertColorScale(FX_DWORD forecolor, FX_DWORD b
ackcolor); | 346 bool» » » ConvertColorScale(FX_DWORD forecolor, FX_DWORD b
ackcolor); |
| 347 | 347 |
| 348 FX_BOOL» » » DitherFS(const FX_DWORD* pPalette, int pal_size,
const FX_RECT* pRect = NULL); | 348 bool» » » DitherFS(const FX_DWORD* pPalette, int pal_size,
const FX_RECT* pRect = NULL); |
| 349 protected: | 349 protected: |
| 350 | 350 |
| 351 uint8_t* m_pBuffer; | 351 uint8_t* m_pBuffer; |
| 352 | 352 |
| 353 FX_BOOL» » » m_bExtBuf; | 353 bool» » » m_bExtBuf; |
| 354 | 354 |
| 355 FX_BOOL» » » GetGrayData(void* pIccTransform = NULL); | 355 bool» » » GetGrayData(void* pIccTransform = NULL); |
| 356 }; | 356 }; |
| 357 class CFX_DIBExtractor | 357 class CFX_DIBExtractor |
| 358 { | 358 { |
| 359 public: | 359 public: |
| 360 | 360 |
| 361 CFX_DIBExtractor(const CFX_DIBSource* pSrc); | 361 CFX_DIBExtractor(const CFX_DIBSource* pSrc); |
| 362 | 362 |
| 363 ~CFX_DIBExtractor(); | 363 ~CFX_DIBExtractor(); |
| 364 | 364 |
| 365 operator CFX_DIBitmap*() | 365 operator CFX_DIBitmap*() |
| 366 { | 366 { |
| 367 return m_pBitmap; | 367 return m_pBitmap; |
| 368 } | 368 } |
| 369 private: | 369 private: |
| 370 | 370 |
| 371 CFX_DIBitmap* m_pBitmap; | 371 CFX_DIBitmap* m_pBitmap; |
| 372 }; | 372 }; |
| 373 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; | 373 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; |
| 374 class CFX_FilteredDIB : public CFX_DIBSource | 374 class CFX_FilteredDIB : public CFX_DIBSource |
| 375 { | 375 { |
| 376 public: | 376 public: |
| 377 | 377 |
| 378 CFX_FilteredDIB(); | 378 CFX_FilteredDIB(); |
| 379 | 379 |
| 380 ~CFX_FilteredDIB(); | 380 ~CFX_FilteredDIB(); |
| 381 | 381 |
| 382 void» » » » » LoadSrc(const CFX_DIBSource* pSr
c, FX_BOOL bAutoDropSrc = FALSE); | 382 void» » » » » LoadSrc(const CFX_DIBSource* pSr
c, bool bAutoDropSrc = false); |
| 383 | 383 |
| 384 virtual FXDIB_Format GetDestFormat() = 0; | 384 virtual FXDIB_Format GetDestFormat() = 0; |
| 385 | 385 |
| 386 virtual FX_DWORD* GetDestPalette() = 0; | 386 virtual FX_DWORD* GetDestPalette() = 0; |
| 387 | 387 |
| 388 | 388 |
| 389 virtual void TranslateScanline(uint8_t* dest_buf, con
st uint8_t* src_buf) const = 0; | 389 virtual void TranslateScanline(uint8_t* dest_buf, con
st uint8_t* src_buf) const = 0; |
| 390 | 390 |
| 391 virtual void TranslateDownSamples(uint8_t* dest_buf,
const uint8_t* src_buf, int pixels, int Bpp) const = 0; | 391 virtual void TranslateDownSamples(uint8_t* dest_buf,
const uint8_t* src_buf, int pixels, int Bpp) const = 0; |
| 392 protected: | 392 protected: |
| 393 virtual const uint8_t* GetScanline(int line) const; | 393 virtual const uint8_t* GetScanline(int line) const; |
| 394 virtual void DownSampleScanline(int line, uint8_t* de
st_scan, int dest_bpp, | 394 virtual void DownSampleScanline(int line, uint8_t* de
st_scan, int dest_bpp, |
| 395 int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const
; | 395 int dest_width, bool bFlipX, int clip_left, int clip_width) const; |
| 396 | 396 |
| 397 const CFX_DIBSource* m_pSrc; | 397 const CFX_DIBSource* m_pSrc; |
| 398 | 398 |
| 399 FX_BOOL» » » » » m_bAutoDropSrc; | 399 bool» » » » » m_bAutoDropSrc; |
| 400 | 400 |
| 401 uint8_t* m_pScanline; | 401 uint8_t* m_pScanline; |
| 402 }; | 402 }; |
| 403 class IFX_ScanlineComposer | 403 class IFX_ScanlineComposer |
| 404 { | 404 { |
| 405 public: | 405 public: |
| 406 virtual ~IFX_ScanlineComposer() { } | 406 virtual ~IFX_ScanlineComposer() { } |
| 407 | 407 |
| 408 virtual void ComposeScanline(int line, const uint8_t* scanlin
e, const uint8_t* scan_extra_alpha = NULL) = 0; | 408 virtual void ComposeScanline(int line, const uint8_t* scanlin
e, const uint8_t* scan_extra_alpha = NULL) = 0; |
| 409 | 409 |
| 410 virtual FX_BOOL» » SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette) = 0; | 410 virtual bool» » SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette) = 0; |
| 411 }; | 411 }; |
| 412 class CFX_ScanlineCompositor | 412 class CFX_ScanlineCompositor |
| 413 { | 413 { |
| 414 public: | 414 public: |
| 415 CFX_ScanlineCompositor(); | 415 CFX_ScanlineCompositor(); |
| 416 | 416 |
| 417 ~CFX_ScanlineCompositor(); | 417 ~CFX_ScanlineCompositor(); |
| 418 | 418 |
| 419 FX_BOOL» » » » Init(FXDIB_Format dest_format, FXDIB_For
mat src_format, int32_t width, FX_DWORD* pSrcPalette, | 419 bool» » » » Init(FXDIB_Format dest_format, FXDIB_For
mat src_format, int32_t width, FX_DWORD* pSrcPalette, |
| 420 FX_DWORD mask_color, int blend_type, FX_BOOL bClip,
FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); | 420 FX_DWORD mask_color, int blend_type, bool bClip, bo
ol bRgbByteOrder = false, int alpha_flag = 0, void* pIccTransform = NULL); |
| 421 | 421 |
| 422 | 422 |
| 423 void CompositeRgbBitmapLine(uint8_t* dest_sca
n, const uint8_t* src_scan, int width, const uint8_t* clip_scan, | 423 void CompositeRgbBitmapLine(uint8_t* dest_sca
n, const uint8_t* src_scan, int width, const uint8_t* clip_scan, |
| 424 const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NU
LL); | 424 const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NU
LL); |
| 425 | 425 |
| 426 | 426 |
| 427 void CompositePalBitmapLine(uint8_t* dest_sca
n, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, | 427 void CompositePalBitmapLine(uint8_t* dest_sca
n, const uint8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, |
| 428 const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NU
LL); | 428 const uint8_t* src_extra_alpha = NULL, uint8_t* dst_extra_alpha = NU
LL); |
| 429 | 429 |
| 430 | 430 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 442 | 442 |
| 443 int m_MaskAlpha, | 443 int m_MaskAlpha, |
| 444 m_MaskRed, | 444 m_MaskRed, |
| 445 m_MaskGreen, | 445 m_MaskGreen, |
| 446 m_MaskBlue, | 446 m_MaskBlue, |
| 447 m_MaskBlack; | 447 m_MaskBlack; |
| 448 int m_BlendType; | 448 int m_BlendType; |
| 449 void* m_pIccTransform; | 449 void* m_pIccTransform; |
| 450 uint8_t* m_pCacheScanline; | 450 uint8_t* m_pCacheScanline; |
| 451 int m_CacheSize; | 451 int m_CacheSize; |
| 452 FX_BOOL m_bRgbByteOrder; | 452 bool m_bRgbByteOrder; |
| 453 }; | 453 }; |
| 454 class CFX_BitmapComposer : public IFX_ScanlineComposer | 454 class CFX_BitmapComposer : public IFX_ScanlineComposer |
| 455 { | 455 { |
| 456 public: | 456 public: |
| 457 | 457 |
| 458 CFX_BitmapComposer(); | 458 CFX_BitmapComposer(); |
| 459 | 459 |
| 460 ~CFX_BitmapComposer(); | 460 ~CFX_BitmapComposer(); |
| 461 | 461 |
| 462 | 462 |
| 463 void Compose(CFX_DIBitmap* pDest, const CFX_C
lipRgn* pClipRgn, int bitmap_alpha, | 463 void Compose(CFX_DIBitmap* pDest, const CFX_C
lipRgn* pClipRgn, int bitmap_alpha, |
| 464 FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOOL
bVertical, | 464 FX_DWORD mask_color, FX_RECT& dest_rect, bool bV
ertical, |
| 465 FX_BOOL bFlipX, FX_BOOL bFlipY, FX_BOOL bRgbByte
Order = FALSE, | 465 bool bFlipX, bool bFlipY, bool bRgbByteOrder = f
alse, |
| 466 int alpha_flag = 0, void* pIccTransform = NULL,
int blend_type = FXDIB_BLEND_NORMAL); | 466 int alpha_flag = 0, void* pIccTransform = NULL,
int blend_type = FXDIB_BLEND_NORMAL); |
| 467 | 467 |
| 468 virtual FX_BOOL» » SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); | 468 virtual bool» » SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); |
| 469 | 469 |
| 470 | 470 |
| 471 virtual void ComposeScanline(int line, const uint8_t* scanlin
e, const uint8_t* scan_extra_alpha); | 471 virtual void ComposeScanline(int line, const uint8_t* scanlin
e, const uint8_t* scan_extra_alpha); |
| 472 protected: | 472 protected: |
| 473 | 473 |
| 474 void DoCompose(uint8_t* dest_scan, const uint
8_t* src_scan, int dest_width, const uint8_t* clip_scan, | 474 void DoCompose(uint8_t* dest_scan, const uint
8_t* src_scan, int dest_width, const uint8_t* clip_scan, |
| 475 const uint8_t* src_extra_alpha = NULL, uint8_t
* dst_extra_alpha = NULL); | 475 const uint8_t* src_extra_alpha = NULL, uint8_t
* dst_extra_alpha = NULL); |
| 476 CFX_DIBitmap* m_pBitmap; | 476 CFX_DIBitmap* m_pBitmap; |
| 477 const CFX_ClipRgn* m_pClipRgn; | 477 const CFX_ClipRgn* m_pClipRgn; |
| 478 FXDIB_Format m_SrcFormat; | 478 FXDIB_Format m_SrcFormat; |
| 479 int m_DestLeft, m_DestTop, m_DestWidth, m_De
stHeight, m_BitmapAlpha; | 479 int m_DestLeft, m_DestTop, m_DestWidth, m_De
stHeight, m_BitmapAlpha; |
| 480 FX_DWORD m_MaskColor; | 480 FX_DWORD m_MaskColor; |
| 481 const CFX_DIBitmap* m_pClipMask; | 481 const CFX_DIBitmap* m_pClipMask; |
| 482 CFX_ScanlineCompositor m_Compositor; | 482 CFX_ScanlineCompositor m_Compositor; |
| 483 FX_BOOL» » » » m_bVertical, m_bFlipX, m_bFlipY; | 483 bool» » » » m_bVertical, m_bFlipX, m_bFlipY; |
| 484 int m_AlphaFlag; | 484 int m_AlphaFlag; |
| 485 void* m_pIccTransform; | 485 void* m_pIccTransform; |
| 486 FX_BOOL m_bRgbByteOrder; | 486 bool m_bRgbByteOrder; |
| 487 int m_BlendType; | 487 int m_BlendType; |
| 488 void ComposeScanlineV(int line, const uint8_t
* scanline, const uint8_t* scan_extra_alpha = NULL); | 488 void ComposeScanlineV(int line, const uint8_t
* scanline, const uint8_t* scan_extra_alpha = NULL); |
| 489 uint8_t* m_pScanlineV; | 489 uint8_t* m_pScanlineV; |
| 490 uint8_t* m_pClipScanV; | 490 uint8_t* m_pClipScanV; |
| 491 uint8_t* m_pAddClipScan; | 491 uint8_t* m_pAddClipScan; |
| 492 uint8_t* m_pScanlineAlphaV; | 492 uint8_t* m_pScanlineAlphaV; |
| 493 }; | 493 }; |
| 494 class CFX_BitmapStorer : public IFX_ScanlineComposer | 494 class CFX_BitmapStorer : public IFX_ScanlineComposer |
| 495 { | 495 { |
| 496 public: | 496 public: |
| 497 | 497 |
| 498 CFX_BitmapStorer(); | 498 CFX_BitmapStorer(); |
| 499 | 499 |
| 500 ~CFX_BitmapStorer(); | 500 ~CFX_BitmapStorer(); |
| 501 | 501 |
| 502 virtual void ComposeScanline(int line, const uint8_t* scanlin
e, const uint8_t* scan_extra_alpha); | 502 virtual void ComposeScanline(int line, const uint8_t* scanlin
e, const uint8_t* scan_extra_alpha); |
| 503 | 503 |
| 504 virtual FX_BOOL» » SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); | 504 virtual bool» » SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); |
| 505 | 505 |
| 506 CFX_DIBitmap* GetBitmap() | 506 CFX_DIBitmap* GetBitmap() |
| 507 { | 507 { |
| 508 return m_pBitmap; | 508 return m_pBitmap; |
| 509 } | 509 } |
| 510 | 510 |
| 511 CFX_DIBitmap* Detach(); | 511 CFX_DIBitmap* Detach(); |
| 512 | 512 |
| 513 void Replace(CFX_DIBitmap* pBitmap); | 513 void Replace(CFX_DIBitmap* pBitmap); |
| 514 private: | 514 private: |
| 515 CFX_DIBitmap* m_pBitmap; | 515 CFX_DIBitmap* m_pBitmap; |
| 516 }; | 516 }; |
| 517 class CStretchEngine; | 517 class CStretchEngine; |
| 518 class CFX_ImageStretcher | 518 class CFX_ImageStretcher |
| 519 { | 519 { |
| 520 public: | 520 public: |
| 521 | |
| 522 CFX_ImageStretcher(); | 521 CFX_ImageStretcher(); |
| 523 | |
| 524 ~CFX_ImageStretcher(); | 522 ~CFX_ImageStretcher(); |
| 525 | 523 |
| 526 int32_t» » Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource*
pBitmap, | 524 bool Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap, |
| 527 int dest_width, int dest_height, const FX_RECT& bitmap
_rect, FX_DWORD flags); | 525 int dest_width, int dest_height, const FX_RECT& bitmap_rect, |
| 526 FX_DWORD flags); |
| 528 | 527 |
| 528 bool Continue(IFX_Pause* pPause); |
| 529 bool StartQuickStretch(); |
| 530 bool StartStretch(); |
| 531 bool ContinueQuickStretch(IFX_Pause* pPause); |
| 532 bool ContinueStretch(IFX_Pause* pPause); |
| 529 | 533 |
| 530 int32_t Continue(IFX_Pause* pPause); | |
| 531 IFX_ScanlineComposer* m_pDest; | 534 IFX_ScanlineComposer* m_pDest; |
| 532 const CFX_DIBSource* m_pSource; | 535 const CFX_DIBSource* m_pSource; |
| 533 CStretchEngine*» » m_pStretchEngine; | 536 CStretchEngine*» m_pStretchEngine; |
| 534 FX_DWORD m_Flags; | 537 FX_DWORD m_Flags; |
| 535 FX_BOOL» » » m_bFlipX, | 538 bool» » » m_bFlipX; |
| 536 m_bFlipY; | 539 bool» » » m_bFlipY; |
| 537 int»» » » m_DestWidth, | 540 int»» » » m_DestWidth; |
| 538 m_DestHeight; | 541 int»» » » m_DestHeight; |
| 539 FX_RECT m_ClipRect; | 542 FX_RECT m_ClipRect; |
| 540 int m_LineIndex; | 543 int m_LineIndex; |
| 541 int m_DestBPP; | 544 int m_DestBPP; |
| 542 uint8_t* m_pScanline; | 545 uint8_t* m_pScanline; |
| 543 uint8_t* m_pMaskScanline; | 546 uint8_t*» » m_pMaskScanline; |
| 544 FXDIB_Format m_DestFormat; | 547 FXDIB_Format m_DestFormat; |
| 545 int32_t» » m_Status; | 548 int32_t» » » m_Status; |
| 546 | |
| 547 int32_t» » StartQuickStretch(); | |
| 548 | |
| 549 int32_t» » StartStretch(); | |
| 550 | |
| 551 int32_t» » ContinueQuickStretch(IFX_Pause* pPause); | |
| 552 | |
| 553 int32_t» » ContinueStretch(IFX_Pause* pPause); | |
| 554 }; | 549 }; |
| 555 class CFX_ImageTransformer | 550 class CFX_ImageTransformer |
| 556 { | 551 { |
| 557 public: | 552 public: |
| 558 | |
| 559 CFX_ImageTransformer(); | 553 CFX_ImageTransformer(); |
| 560 | |
| 561 ~CFX_ImageTransformer(); | 554 ~CFX_ImageTransformer(); |
| 562 | 555 |
| 563 int32_t» Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix
, int flags, const FX_RECT* pClip); | 556 bool Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix, |
| 557 int flags, const FX_RECT* pClip); |
| 564 | 558 |
| 559 bool Continue(IFX_Pause* pPause); |
| 565 | 560 |
| 566 int32_t Continue(IFX_Pause* pPause); | |
| 567 CFX_AffineMatrix* m_pMatrix; | 561 CFX_AffineMatrix* m_pMatrix; |
| 568 FX_RECT m_StretchClip; | 562 FX_RECT m_StretchClip; |
| 569 int»» » m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight
; | 563 int»» » m_ResultLeft; |
| 564 int»» » m_ResultTop; |
| 565 int»» » m_ResultWidth; |
| 566 int»» » m_ResultHeight; |
| 570 CFX_AffineMatrix m_dest2stretch; | 567 CFX_AffineMatrix m_dest2stretch; |
| 571 CFX_ImageStretcher m_Stretcher; | 568 CFX_ImageStretcher m_Stretcher; |
| 572 CFX_BitmapStorer m_Storer; | 569 CFX_BitmapStorer m_Storer; |
| 573 FX_DWORD m_Flags; | 570 FX_DWORD m_Flags; |
| 574 int m_Status; | 571 int m_Status; |
| 575 }; | 572 }; |
| 576 class CFX_ImageRenderer | 573 class CFX_ImageRenderer |
| 577 { | 574 { |
| 578 public: | 575 public: |
| 579 | |
| 580 CFX_ImageRenderer(); | 576 CFX_ImageRenderer(); |
| 581 | |
| 582 ~CFX_ImageRenderer(); | 577 ~CFX_ImageRenderer(); |
| 583 | 578 |
| 584 int32_t» » » Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn*
pClipRgn, | 579 bool Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, |
| 585 const CFX_DIBSource* pSource, int bitmap_alpha, | 580 const CFX_DIBSource* pSource, int bitmap_alpha, |
| 586 FX_DWORD mask_color, const CFX_AffineMatrix* pMatr
ix, FX_DWORD dib_flags, | 581 FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix, |
| 587 FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0,
void* pIccTransform = NULL, | 582 FX_DWORD dib_flags, bool bRgbByteOrder = false, |
| 588 int blend_type = FXDIB_BLEND_NORMAL); | 583 int alpha_flag = 0, void* pIccTransform = NULL, |
| 584 int blend_type = FXDIB_BLEND_NORMAL); |
| 589 | 585 |
| 590 int32_t» » » Continue(IFX_Pause* pPause); | 586 bool Continue(IFX_Pause* pPause); |
| 587 |
| 591 protected: | 588 protected: |
| 592 CFX_DIBitmap* m_pDevice; | 589 CFX_DIBitmap* m_pDevice; |
| 593 const CFX_ClipRgn* m_pClipRgn; | 590 const CFX_ClipRgn* m_pClipRgn; |
| 594 int m_BitmapAlpha; | 591 int m_BitmapAlpha; |
| 595 FX_DWORD m_MaskColor; | 592 FX_DWORD m_MaskColor; |
| 596 CFX_AffineMatrix m_Matrix; | 593 CFX_AffineMatrix m_Matrix; |
| 597 CFX_ImageTransformer* m_pTransformer; | 594 CFX_ImageTransformer* m_pTransformer; |
| 598 CFX_ImageStretcher m_Stretcher; | 595 CFX_ImageStretcher m_Stretcher; |
| 599 CFX_BitmapComposer m_Composer; | 596 CFX_BitmapComposer m_Composer; |
| 600 int m_Status; | 597 int m_Status; |
| 601 int m_DestLeft, m_DestTop; | 598 int m_DestLeft, m_DestTop; |
| 602 FX_RECT m_ClipBox; | 599 FX_RECT m_ClipBox; |
| 603 FX_DWORD m_Flags; | 600 FX_DWORD m_Flags; |
| 604 int m_AlphaFlag; | 601 int m_AlphaFlag; |
| 605 void* m_pIccTransform; | 602 void* m_pIccTransform; |
| 606 FX_BOOL» » » » m_bRgbByteOrder; | 603 bool» » » » m_bRgbByteOrder; |
| 607 int m_BlendType; | 604 int m_BlendType; |
| 608 }; | 605 }; |
| 609 | 606 |
| 610 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_ | 607 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_ |
| OLD | NEW |