Skip to content

Instantly share code, notes, and snippets.

View getFitAspectRatioSize
static ofVec2f getFitAspectRatioSize(float maxWidth, float maxHeight, float imgWidth, float imgHeight)
{
ofVec2f result;
float widthRatio = maxWidth / imgWidth;
float heightRatio = maxHeight / imgHeight;
float bestRatio = min(widthRatio, heightRatio);
result.x = imgWidth * bestRatio;
result.y = imgHeight * bestRatio;
return result;
@jvcleave
jvcleave / ofApp.cpp
Last active Dec 26, 2018
videocore fast pixel access
View ofApp.cpp
#pragma once
#include "ofMain.h"
#include "ofAppEGLWindow.h"
#include "user-vcsm.h"
#include "ofxOMXPlayer.h"
#include "TerminalListener.h"
class ofApp : public ofBaseApp, public KeyListener{
View image_fx options
OMX_ImageFilterColourBalance
Number of Params: 4
Value Range: 0-255
Description: first value unknown or maybe not 0-255, 1-3 seem to be RGB.
OMX_ImageFilterColourSwap
Number of Params: 1
Value Range: 0-1
Description: Switches a mode - possibly an enum?
@jvcleave
jvcleave / video.c
Last active Nov 22, 2018
image_fx test
View video.c
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
View gist:a4ac1fbf23686ec035767315008538bf
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=1
hdmi_mode=4
disable_overscan=0
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24
View build_cross_gcc.sh
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
View ListBoxContent.h
#pragma once
#include "ofMain.h"
#include "ofxImGui.h"
class ListBoxContent
{
public:
View gist:c37f0bbcefde0ebc4f2467f0f6ff57b0
//--------------------------------------------------------------
void ofApp::setup() {
NSURL* videoUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"hands" ofType:@"m4v"]];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoUrl options:nil];
AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
generator.requestedTimeToleranceAfter = kCMTimeZero;
generator.requestedTimeToleranceBefore = kCMTimeZero;
@jvcleave
jvcleave / libpng.sh
Created Jan 1, 2017 — forked from dulacp/libpng.sh
Download & Compile Libpng for iOS (all architectures)
View libpng.sh
# Builds a Libpng framework for the iPhone and the iPhone Simulator.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using libpng in Xcode
# less painful.
#
# To configure the script, define:
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1)
#
# Then go get the source tar.bz of the libpng you want to build, shove it in the
# same directory as this script, and run "./libpng.sh". Grab a cuppa. And voila.
View gist:7ad83dde34acf30f7b7d4d2b1c847892
fbo.allocate(256, 256);
fbo.begin();
ofClear(0);
int step = 16;
int numRows, numCols;
numRows = numCols = fbo.getWidth() / step;
ofColor color1 = ofColor::white;
ofColor color2= ofColor::black;
ofColor lastColor = color1;