Skip to content

Instantly share code, notes, and snippets.

muiz6 /
Last active Aug 15, 2020
How to get color from a theme attribute with java in android.
package com.muiz6.example;
import android.content.Context;
import android.content.res.Resources;
import android.util.TypedValue;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.NonNull;
muiz6 / bitmap-example.cpp
Created Jun 27, 2020
Example code on how to write a bitmap file from scratch.
View bitmap-example.cpp
#include <cstdint> // for specific size integers
#include <fstream> // for file handling
using namespace std;
struct BmpHeader {
char bitmapSignatureBytes[2] = {'B', 'M'};
uint32_t sizeOfBitmapFile = 54 + 786432; // total size of bitmap file
uint32_t reservedBytes = 0;
uint32_t pixelDataOffset = 54;
} bmpHeader;