Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Direct Pixel Manipulation (looking for an example of TLN_GetBitmapPtr)
#2
Hi Alan,

Welcome here and thanks for your interest!

There isn't any problem with your direct pixel manipulation code. The problem is that any layer requires having a palette assigned. When you load a bitmap with TLN_LoadBitmap() and assign it with TLN_SetLayerBitmap(), it's own palette gets loaded and attached. But you're creating an empty bitmap without a palette. Of course the renderer shouldn't crash, just refuse to draw it. I have to fix this behavior.

To fix your code, you have to manually create and assign a palette with TLN_CreatePalette() and TLN_SetBitmapPalette():


Code:
    TLN_Bitmap bitmap = TLN_CreateBitmap(400, 240, 8);
    TLN_Palette palette = TLN_CreatePalette(256);
    TLN_SetBitmapPalette(bitmap, palette);
    TLN_SetLayerBitmap(0, bitmap);
    
You should get a black window because the default palette is black. To modify it, you can use TLN_SetPaletteColor().

Let me know if it works!
Reply


Messages In This Thread
RE: Direct Pixel Manipulation (looking for an example of TLN_GetBitmapPtr) - by megamarc - 08-27-2019, 05:11 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)